diff options
Diffstat (limited to 'web/static/js')
-rw-r--r-- | web/static/js/common.js | 8 | ||||
-rw-r--r-- | web/static/js/corporation.js | 5 | ||||
-rw-r--r-- | web/static/js/kill.js | 22 |
3 files changed, 25 insertions, 10 deletions
diff --git a/web/static/js/common.js b/web/static/js/common.js index 547c349..e7a4e75 100644 --- a/web/static/js/common.js +++ b/web/static/js/common.js @@ -1,16 +1,20 @@ Object.append(window.ykill, { - 'api': function (path, cb) { + 'api': function(path, cb) { new Request.JSON({ 'url': ykill.api_host + path, 'onSuccess': cb, }).get(); }, - 'portrait': function (id, text, img_dir, img_suffix) { + 'portrait': function(id, text, img_dir, img_suffix) { var img = new Element('img', { 'src': '//image.eveonline.com/' + img_dir + '/' + id + img_suffix, 'alt': text, }); return img; }, + + 'format_isk': function(isk) { + return isk.toLocaleString('en-US', {'minimumFractionDigits': 2, 'maximumFractionDigits': 2}); + }, }); diff --git a/web/static/js/corporation.js b/web/static/js/corporation.js index 73d1b4b..606ce3e 100644 --- a/web/static/js/corporation.js +++ b/web/static/js/corporation.js @@ -59,6 +59,11 @@ window.addEvent('domready', function() { td.appendText(' / ' + final_blow['faction_name']); tr.grab(td); + td = new Element('td'); + var millions = kill['cost'] / (100 * 1000000); + td.appendText(ykill.format_isk(millions)); + tr.grab(td); + table.grab(tr); }); }); diff --git a/web/static/js/kill.js b/web/static/js/kill.js index a37c30c..baac084 100644 --- a/web/static/js/kill.js +++ b/web/static/js/kill.js @@ -1,7 +1,6 @@ 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']; @@ -43,12 +42,18 @@ window.addEvent('domready', function() { ), 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') + table.adopt( + 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']}) ), - new Element('td', {'html': victim['ship_name']}) - )); + new Element('tr').adopt( + new Element('td', {'html': 'cost'}), + new Element('td', {'html': ykill.format_isk(kill['cost'] / 100)}) + ) + ); var items = data['items']; var div = $('ship'); @@ -98,7 +103,7 @@ window.addEvent('domready', function() { if (!items[slot]) return; table.grab(new Element('tr').grab( - new Element('td', {'html': slot, 'colspan': 3, 'class': 'slot'}) + new Element('td', {'html': slot, 'colspan': 4, 'class': 'slot'}) )); if (slot == 'high') { var highs = {'dropped': {}, 'destroyed': {}}; @@ -129,7 +134,8 @@ window.addEvent('domready', function() { }) ), new Element('td', {'html': item['item_name']}), - new Element('td', {'html': count, 'class': item_class}) + new Element('td', {'html': count, 'class': item_class}), + new Element('td', {'html': ykill.format_isk(item['cost'] / 100)}) )); }); }); |