Эх сурвалжийг харах

ship as item on kill, hide cents

also, set height on kill page so loading images doesn't adjust heights
and fix firefox kill_list ellipsis
raylu 12 жил өмнө
parent
commit
ed59e1b3c6

+ 7 - 2
db/queries.py

@@ -92,6 +92,13 @@ def kill(kill_id):
 			else:
 				attackers.append(char)
 
+		try:
+			ship_cost = db.get(c, 'SELECT cost FROM item_costs WHERE type_id = ?',
+					victim['ship_type_id'])
+			victim['ship_cost'] = ship_cost['cost']
+		except db.NoRowsException:
+			victim['ship_cost'] = 0
+
 		item_rows = db.query(c, '''
 			SELECT items.type_id, flag, dropped, destroyed, singleton,
 				cost, typeName AS item_name, capacity
@@ -169,8 +176,6 @@ def top_cost():
 			ORDER BY cost DESC
 			LIMIT 25
 			''')
-	#for kill in kills:
-	#	kill['kill_time'] = _format_kill_time(kill['kill_time'])
 	return kills
 
 def _format_kill_time(kill_time):

+ 1 - 1
web/static/css/home.ccss

@@ -4,7 +4,7 @@
 #expensive:
 	margin: 0 auto
 
-	td:nth-child(3):
+	td:nth-child(4):
 		text-align: right
 		padding-right: 3px
 

+ 2 - 1
web/static/css/kill.ccss

@@ -87,7 +87,7 @@ table#attackers:
 			width: 70px
 
 	td:
-		height: 64px
+		height: 66px
 		&:nth-child(1):
 			white-space: normal
 			line-height: 0
@@ -132,6 +132,7 @@ table#items:
 
 	td:nth-child(1):not(.slot):
 		line-height: 0
+		height: 34px
 	td:nth-child(3):
 		text-align: right
 		font-weight: bold

+ 4 - 4
web/static/css/kill_list.ccss

@@ -10,13 +10,13 @@ table#kills:
 	th.system:
 		width: 120px
 	th.victim_portrait:
-		width: 64px
+		width: 66px
 	th.victim:
-		width: 250px
+		width: 248px
 	th.killer_portrait:
-		width: 64px
+		width: 66px
 	th.killer:
-		width: 250px
+		width: 248px
 	th.value:
 		width: 62px
 

+ 2 - 2
web/static/css/search.ccss

@@ -1,5 +1,5 @@
 #wrapper:
-	padding: 20px
+	padding: 2px 20px 20px
 
 h2:
-	margin-top: 0
+	margin: 1em 0 0.4em

+ 10 - 0
web/static/js/common.js

@@ -22,9 +22,19 @@
 		},
 
 		'format_isk': function(isk) {
+			isk /= 100;
+			if (!locale_options)
+				return parseFloat(isk.toFixed(0)).toLocaleString();
+			return isk.toLocaleString('en-US', {'maximumFractionDigits': 0});
+		},
+		'format_millions': function(isk) {
+			isk /= 100 * 1000 * 1000;
 			if (!locale_options)
 				return parseFloat(isk.toFixed(2)).toLocaleString();
 			return isk.toLocaleString('en-US', {'minimumFractionDigits': 2, 'maximumFractionDigits': 2});
 		},
+		'format_billions': function(isk) {
+			return ykill.format_millions(isk / 1000);
+		}
 	});
 })();

+ 2 - 1
web/static/js/home.js

@@ -5,10 +5,11 @@ window.addEvent('domready', function() {
 			table.grab(new Element('tr').adopt(
 				new Element('td').grab(ykill.portrait(kill['ship_type_id'], kill['ship_name'], 'type', '_32.png')),
 				new Element('td', {'html': kill['ship_name']}),
+				new Element('td', {'html': kill['system_name'] + ' (' + kill['security'].toFixed(1) + ')'}),
 				new Element('td').grab(
 					new Element('a', {
 						'href': '/kill/' + kill['kill_id'],
-						'html': ykill.format_isk(kill['cost'] / (100 * 1000 * 1000 * 1000))
+						'html': ykill.format_billions(kill['cost'])
 					})
 				)
 			));

+ 16 - 9
web/static/js/kill.js

@@ -42,16 +42,10 @@ window.addEvent('domready', function() {
 				),
 				new Element('td', {'html': victim['faction_name']})
 			));
-		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']})
-			),
+		table.grab(
 			new Element('tr').adopt(
 				new Element('td', {'html': 'cost'}),
-				new Element('td', {'html': ykill.format_isk(kill['cost'] / 100)})
+				new Element('td', {'html': ykill.format_isk(kill['cost'])})
 			)
 		);
 
@@ -98,6 +92,19 @@ window.addEvent('domready', function() {
 		}
 
 		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', 'implant', '???'];
 		slots.each(function(slot) {
 			if (!items[slot])
@@ -135,7 +142,7 @@ window.addEvent('domready', function() {
 					),
 					new Element('td', {'html': item['item_name']}),
 					new Element('td', {'html': count, 'class': item_class}),
-					new Element('td', {'html': ykill.format_isk(item['cost'] / 100)})
+					new Element('td', {'html': ykill.format_isk(item['cost'])})
 				));
 			});
 		});

+ 1 - 2
web/static/js/kill_list.js

@@ -62,8 +62,7 @@ window.addEvent('domready', function() {
 			tr.grab(td);
 
 			td = new Element('td');
-			var millions = kill['cost'] / (100 * 1000000);
-			td.appendText(ykill.format_isk(millions));
+			td.appendText(ykill.format_millions(kill['cost']));
 			if (victim[entity_type + '_id'] == entity_id)
 				td.addClass('loss');
 			tr.grab(td);