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

kill: tooltip on attackers

raylu 12 жил өмнө
parent
commit
e4987ed6a0

+ 19 - 13
web/static/css/kill.ccss

@@ -39,21 +39,9 @@
 		width: 32px
 		height: 32px
 		position: relative // for .tooltip
-
-		.tooltip:
-			display: none
-			position: absolute
-			top: 32px
-			left: 8px
-			line-height: 1em
-			padding: 8px 10px
-			background-color: rgba(40, 40, 40, 0.9)
-			white-space: nowrap
-			text-align: center
-			z-index: 1
-			pointer-events: none
 		&:hover .tooltip:
 			display: block
+
 	.avail:
 		border: 1px solid #888
 
@@ -96,6 +84,11 @@ table#attackers:
 		&:nth-child(3):
 			white-space: normal
 			line-height: 0
+			overflow: visible
+			> div:
+				position: relative // for .tooltip
+				&:hover .tooltip:
+					display: block
 		&:nth-child(4):
 			text-align: right
 			padding-right: 8px
@@ -144,3 +137,16 @@ table#items:
 		background-color: #041
 	.destroyed:
 		color: #a22
+
+.tooltip:
+	display: none
+	position: absolute
+	top: 32px
+	left: 8px
+	line-height: 1em
+	padding: 8px 10px
+	background-color: rgba(40, 40, 40, 0.9)
+	white-space: nowrap
+	text-align: center
+	z-index: 1
+	pointer-events: none

+ 8 - 2
web/static/js/kill.js

@@ -194,8 +194,14 @@ window.addEvent('domready', function() {
 		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')
+			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()));