summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2021-04-06 21:20:16 +0200
committerAki <please@ignore.pl>2021-04-06 21:20:16 +0200
commit942b2af131b40df3b68302438eb22c830535560d (patch)
tree0261e17d9d1876560bbe3231a87a11f13b34758a
parent1fab13e97b98bacd8e5613da00ac934dbfcd98d8 (diff)
downloadderelict-prototype-942b2af131b40df3b68302438eb22c830535560d.zip
derelict-prototype-942b2af131b40df3b68302438eb22c830535560d.tar.gz
derelict-prototype-942b2af131b40df3b68302438eb22c830535560d.tar.bz2
Added teams to visualization
-rw-r--r--derelict.js7
-rw-r--r--style.css19
2 files changed, 24 insertions, 2 deletions
diff --git a/derelict.js b/derelict.js
index 0329729..9a28f07 100644
--- a/derelict.js
+++ b/derelict.js
@@ -57,7 +57,8 @@ class Wreck {
const object2d = new CSS2DObject(this.domElement)
this.killmail = killmail
- this.domElement.className = 'wreck'
+ const team = killmail.team > 1 ? "teamA" : "teamB"
+ this.domElement.classList.add('wreck', team)
const shipTypeId = this.killmail.victim.ship_type_id
fetch(`${ESI}/universe/types/${shipTypeId}/?datasource=tranquility`, {cache: "force-cache"})
.then(response => response.json())
@@ -146,7 +147,9 @@ function init() {
.then(response => response.json())
.then(killmails => {
const url = km => `${ESI}/killmails/${km.id}/${km.hash}/?datasource=tranquility`
- const retrieve = km => fetch(url(km)).then(response => response.json())
+ const retrieve = km => fetch(url(km))
+ .then(response => response.json())
+ .then(data => { data.team = km.team; return data })
return Promise.all(killmails.map(retrieve))
})
.then(killmails => {
diff --git a/style.css b/style.css
index 2440d71..cd62930 100644
--- a/style.css
+++ b/style.css
@@ -23,6 +23,25 @@ body {
border: 2px solid #eee;
}
+.wreck::before {
+ display: block;
+ content: '';
+ position: absolute;
+ bottom: 0px;
+ right: 0px;
+ width: 6px;
+ height: 6px;
+ overflow: hidden;
+}
+
+.wreck.teamA::before {
+ background: #cc0899;
+}
+
+.wreck.teamB::before {
+ background: #14ea6a;
+}
+
.wreck::after {
display: block;
content: attr(data-label);