1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
window.addEvent('domready', function() {
var kill_id = document.location.pathname.split('/').getLast();
ykill.api('/kill/' + kill_id, function(data) {
var table = $('victim');
var kill = data['kill'];
var victim = data['victim'];
table.adopt(
new Element('tr').adopt(
new Element('td', {'html': 'time'}),
new Element('td', {'html': kill['kill_time']})
),
new Element('tr').adopt(
new Element('td', {'html': 'system'}),
new Element('td', {'html': kill['solarSystemName'] + ' (' + kill['security'].toFixed(1) + ')'})
),
new Element('tr').adopt(
new Element('td').grab(
ykill.portrait(victim['character_id'], victim['character_name'], 'character', '_64.jpg')
),
new Element('td', {'html': victim['character_name']})
),
new Element('tr').adopt(
new Element('td').grab(
ykill.portrait(victim['corporation_id'], victim['corporation_name'], 'corporation', '_64.png')
),
new Element('td', {'html': victim['corporation_name']})
)
);
if (victim['alliance_id'])
table.grab(new Element('tr').adopt(
new Element('td').grab(
ykill.portrait(victim['alliance_id'], victim['alliance_name'], 'alliance', '_64.png')
),
new Element('td', {'html': victim['alliance_name']})
));
if (victim['faction_id'])
table.grab(new Element('tr').adopt(
new Element('td').grab(
ykill.portrait(victim['faction_id'], victim['faction_name'], 'alliance', '_64.png')
),
new Element('td', {'html': victim['faction_name']})
));
table.grab(new Element('tr').adopt(
new Element('td').grab(
ykill.portrait(victim['ship_type_id'], victim['ship_name'], 'type', '_64.png')
),
new Element('td', {'html': victim['ship_name']})
));
var items = data['items'];
var div = $('ship');
div.setStyle('background-image', 'url(//image.eveonline.com/render/' + victim['ship_type_id'] + '_256.png)');
Object.each(data['slots'], function(num, slot) {
var divs = $(slot).getChildren();
for (var i = 0; i < num; i++)
divs[i].addClass('avail');
if (!items[slot])
return;
items[slot].each(function(item) {
var div = $('slot_' + item['flag']);
var bg_img = div.getStyle('background-image');
if (bg_img == 'none')
set_bg_item(div, item['type_id']);
else {
var charge_div = $('charge_' + item['flag']);
if (item['capacity']) {
set_bg_item(div, item['type_id']);
charge_div.setStyle('background-image', bg_img);
} else {
set_bg_item(charge_div, item['type_id']);
}
}
});
});
table = $('attackers');
show_attacker(table, data['final_blow']);
data['attackers'].each(function(char) {
show_attacker(table, char);
});
table = $('items');
var slots = ['subsystem', 'high', 'medium', 'low', 'rig', 'drone bay', 'cargo', 'special hold', 'implant', '???'];
slots.each(function(slot) {
if (!items[slot])
return;
table.grab(new Element('tr').grab(
new Element('td', {'html': slot, 'colspan': 3, 'class': 'slot'})
));
if (slot == 'high') {
var highs = {'dropped': {}, 'destroyed': {}};
items[slot].each(function(item) {
var d = item['dropped'] ? 'dropped' : 'destroyed';
var count = item[d];
if (highs[d][item['type_id']])
highs[d][item['type_id']][d] += item[d];
else
highs[d][item['type_id']] = item;
});
items[slot] = [];
Object.each(highs, function(item_class) {
Object.each(item_class, function(item) {
items[slot].push(item);
});
});
}
items[slot].each(function(item) {
var type_id = item['type_id'];
var item_class = item['dropped'] ? 'dropped' : 'destroyed';
var count = item[item_class];
table.grab(new Element('tr').adopt(
new Element('td').grab(
new Element('img', {
'src': '//image.eveonline.com/Type/' + type_id + '_32.png',
'alt': item['item_name'],
})
),
new Element('td', {'html': item['item_name']}),
new Element('td', {'html': count, 'class': item_class})
));
});
});
});
function set_bg_item(div, type_id) {
div.setStyle('background-image', 'url(//image.eveonline.com/type/' + type_id + '_32.png)');
}
function show_attacker(table, char) {
var tr = new Element('tr');
var td = new Element('td');
td.grab(ykill.portrait(char['character_id'], char['character_name'], 'character', '_32.jpg'));
if (char['alliance_id'])
td.grab(ykill.portrait(char['alliance_id'], char['alliance_name'], 'alliance', '_32.png'));
else if (char['faction_id'])
td.grab(ykill.portrait(char['faction_id'], char['faction_name'], 'alliance', '_32.png'));
else
td.grab(ykill.portrait(char['corporation_id'], char['corporation_name'], 'corporation', '_32.png'));
tr.grab(td);
td = new Element('td');
td.appendText(char['character_name']);
td.grab(new Element('br'));
td.appendText(char['corporation_name']);
if (char['alliance_id']) {
td.grab(new Element('br'));
td.appendText(char['alliance_name']);
}
if (char['faction_id']) {
td.grab(new Element('br'));
td.appendText(char['faction_name']);
}
tr.grab(td);
td = new Element('td').adopt(
ykill.portrait(char['ship_type_id'], char['ship_name'], 'type', '_32.png'),
ykill.portrait(char['weapon_type_id'], char['weapon_name'], 'type', '_32.png')
);
tr.grab(td);
tr.grab(new Element('td').appendText(char['damage']));
table.grab(tr);
}
});
|