Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/map_select_dialog.js')
-rw-r--r--src/modules/map_select_dialog.js19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/modules/map_select_dialog.js b/src/modules/map_select_dialog.js
index 2a4622a..bbc2374 100644
--- a/src/modules/map_select_dialog.js
+++ b/src/modules/map_select_dialog.js
@@ -1,9 +1,23 @@
+import sideShow from './assets/images/scenario-side_show.svg';
+import dragonHunting from './assets/images/scenario-dragon_hunting.svg';
+// import raceAgainstTime from './assets/images/scenario-race_against_time.svg';
+
export function init() {
const showButton = document.getElementById('show-dialog'),
mapDialog = document.getElementById('map-dialog'),
selectEl = mapDialog.querySelector('select'),
confirmBtn = mapDialog.querySelector('#confirm-btn');
+ let option = document.createElement('option');
+ option.setAttribute('value', sideShow);
+ option.textContent = 'BattleTroops Scenario 1: Side Show';
+ selectEl.appendChild(option);
+
+ option = document.createElement('option');
+ option.setAttribute('value', dragonHunting);
+ option.textContent = 'BattleTroops Scenario 2: Dragon Hunting';
+ selectEl.appendChild(option);
+
return {
selectCurrentOptionOnPageLoad() {
mapDialog.querySelectorAll('option').forEach(option =>
@@ -34,9 +48,12 @@ export function init() {
e.preventDefault();
localStorage.removeItem('pan-zoom');
localStorage.setItem('map', selectEl.value);
- loadFn(`assets/images/${selectEl.value}.svg`);
+ // loadFn(`assets/images/${selectEl.value}.svg`);
+ loadFn(selectEl.value);
mapDialog.close();
});
}
};
}
+
+export const defaultMap = sideShow;