| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206 |
- window.addEvent('domready', function() {
- var kill_id = document.location.pathname.split('/').getLast();
- ykill.api('/kill/' + kill_id, function(data) {
- var kill = data['kill'];
- var victim = data['victim'];
- document.title += ' - ' + victim['character_name'] + ' - ' + victim['ship_name'];
- var table = $('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': ykill.format_system(kill['system_name'], kill['security'], kill['security_status'])})
- ),
- new Element('tr').adopt(
- new Element('td').grab(
- ykill.portrait(victim['character_id'], victim['character_name'], 'character', '_64.jpg')
- ),
- new Element('td').grab(new Element('a', {
- 'html': victim['character_name'], 'href': '/character/' + victim['character_id']
- }))
- ),
- new Element('tr').adopt(
- new Element('td').grab(
- ykill.portrait(victim['corporation_id'], victim['corporation_name'], 'corporation', '_64.png')
- ),
- new Element('td').grab(new Element('a', {
- 'html': victim['corporation_name'], 'href': '/corporation/' + victim['corporation_id']
- }))
- )
- );
- 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').grab(new Element('a', {
- 'html': victim['alliance_name'], 'href': '/alliance/' + victim['alliance_id']
- }))
- ));
- 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', {'html': 'cost'}),
- new Element('td', {'html': ykill.format_isk(kill['cost'])})
- )
- );
- 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;
- var has_charges = (['high', 'medium', 'low'].indexOf(slot) > -1);
- items[slot].each(function(item) {
- var div;
- if (has_charges && item['charge'])
- div = $('charge_' + item['flag']);
- else
- div = $('slot_' + item['flag']);
- div.setStyle('background-image', 'url(//image.eveonline.com/type/' + item['type_id'] + '_32.png)');
- div.grab(new Element('div', {'class': 'tooltip', 'html': item['item_name']}));
- });
- });
- table = $('attackers');
- table.grab(new Element('tr').grab(
- new Element('td', {'class': 'attacker_type', 'colspan': 4, 'html': 'final blow'})
- ));
- show_attacker(table, data['final_blow']);
- if (data['attackers'].length) {
- table.grab(new Element('tr').grab(
- new Element('td', {'class': 'attacker_type', 'colspan': 4, 'html': 'attackers'})
- ));
- data['attackers'].each(function(char) {
- show_attacker(table, char);
- });
- }
- table = $('items');
- table.adopt(
- new Element('tr').grab(
- new Element('td', {'html': 'ship', 'colspan': 4, 'class': 'slot'})
- ),
- new Element('tr').adopt(
- new Element('td').grab(
- ykill.portrait(victim['ship_type_id'], victim['ship_name'], 'type', '_32.png')
- ),
- new Element('td', {'html': victim['ship_name']}),
- new Element('td'),
- new Element('td', {'html': ykill.format_isk(victim['ship_cost'])})
- )
- );
- var slots = [
- 'subsystem', 'high', 'medium', 'low', 'rig', 'drone bay',
- 'cargo', 'special hold', 'ship hangar', 'fleet hangar', 'implant', '???'
- ];
- slots.each(function(slot) {
- if (!items[slot])
- return;
- table.grab(new Element('tr').grab(
- new Element('td', {'html': slot, 'colspan': 4, '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_name = item['item_name'];
- var item_class = item['dropped'] ? 'dropped' : 'destroyed';
- var count = item[item_class];
- var cost = item['cost'] * count;
- if (item['singleton'] == 2) {
- item_name += ' (copy)';
- cost /= 1000;
- }
- if (item['type_id'] == 33329 && item['flag'] == 89) // Genolution 'Auroral' AU-79 in implant slot
- cost = 'n/a';
- else
- cost = ykill.format_isk(cost);
- 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_name}),
- new Element('td', {'html': count, 'class': item_class}),
- new Element('td', {'html': cost})
- ));
- });
- });
- });
- 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(
- new Element('div').adopt(
- ykill.portrait(char['ship_type_id'], char['ship_name'], 'type', '_32.png'),
- new Element('div', {'class': 'tooltip', 'html': char['ship_name']})
- ),
- new Element('div').adopt(
- ykill.portrait(char['weapon_type_id'], char['weapon_name'], 'type', '_32.png'),
- new Element('div', {'class': 'tooltip', 'html': char['weapon_name']})
- )
- );
- tr.grab(td);
- tr.grab(new Element('td').appendText(char['damage'].toLocaleString()));
- table.grab(tr);
- }
- });
|