diff options
author | Aki <please@ignore.pl> | 2021-05-11 23:42:23 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2021-05-11 23:42:23 +0200 |
commit | 5f6d51abbf731e4d5d9b9f5e8633c137325681aa (patch) | |
tree | fe09303944cce538b6282c0847f0f680d6121d44 | |
parent | 813ce4ad2f931938fb11e13957e4c7232ad1d517 (diff) | |
download | derelict-prototype-5f6d51abbf731e4d5d9b9f5e8633c137325681aa.zip derelict-prototype-5f6d51abbf731e4d5d9b9f5e8633c137325681aa.tar.gz derelict-prototype-5f6d51abbf731e4d5d9b9f5e8633c137325681aa.tar.bz2 |
Moving js side slightly towards more libarary-like model
-rw-r--r-- | derelict.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/derelict.js b/derelict.js index 53358d6..155df23 100644 --- a/derelict.js +++ b/derelict.js @@ -205,8 +205,7 @@ function processKillmails(obj, killmails, icon) { toggleAll() } -function init() { - const container = document.getElementById("container") +export function init({id, container, toolbar}) { const renderer = new THREE.WebGLRenderer({antialias: true}) const renderer2d = new CSS2DRenderer() @@ -218,13 +217,12 @@ function init() { container.appendChild(renderer.domElement) container.appendChild(renderer2d.domElement) - const url = new URL(window.location.href) const loader = new THREE.TextureLoader() const skybox = loader.loadAsync("https://i.imgur.com/rDGOLFC.jpg") // TODO: Don't use imgur as CDN. let icon = loadWreckIcon() - fetch(url.pathname.replace("view", "battles")) + fetch(`/battles/${id}`) .then(response => response.json()) .then(killmails => { const url = km => `${ESI}/killmails/${km.id}/${km.hash}/?datasource=tranquility` @@ -237,5 +235,3 @@ function init() { icon.then(icon => processKillmails({skybox, renderer, renderer2d, container}, killmails, icon)) }) } - -init() |