index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
-rw-r--r-- | public/assets/css/style.css | 4 | ||||
-rw-r--r-- | public/assets/images/icon_full_screen.png | bin | 0 -> 593 bytes | |||
-rw-r--r-- | public/assets/images/icon_unfull_screen.png | bin | 0 -> 598 bytes | |||
-rw-r--r-- | public/index.html | 8 | ||||
-rw-r--r-- | src/index.js | 11 |
5 files changed, 22 insertions, 1 deletions
diff --git a/public/assets/css/style.css b/public/assets/css/style.css index 13d1fa5..91ef42c 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -380,6 +380,10 @@ img.logo { position: absolute; } +input[type="file"] { + display: none; +} + @media (width >= 1800px) { #record-sheet { flex-direction: row; diff --git a/public/assets/images/icon_full_screen.png b/public/assets/images/icon_full_screen.png Binary files differnew file mode 100644 index 0000000..94a7ee4 --- /dev/null +++ b/public/assets/images/icon_full_screen.png diff --git a/public/assets/images/icon_unfull_screen.png b/public/assets/images/icon_unfull_screen.png Binary files differnew file mode 100644 index 0000000..83c9c3d --- /dev/null +++ b/public/assets/images/icon_unfull_screen.png diff --git a/public/index.html b/public/index.html index a846733..d907d05 100644 --- a/public/index.html +++ b/public/index.html @@ -121,8 +121,12 @@ <span class="inning-bottom">◒</span> </span> <button id="show-dialog" type="button">Change map</button> - <button id="fullscreen" type="button">Fullscreen</button> <button id="download-save" type="button">Save</button> + <button id="upload-save" type="button">Load</button> + <button id="fullscreen" type="button"> + <img src="assets/images/icon_full_screen.png" height="12" /> + </button> + <span style="white-space: nowrap;"> Prone: <input type="checkbox" id="toggle-prone-counter" /> <button type="button" class="set-firing-arc" data-size="small"> @@ -197,6 +201,8 @@ </form> </dialog> + <input type="file" accept="image/svg+xml"/> + <script src="index.js"></script> <script src="soldier_record_block.js"></script> </body> diff --git a/src/index.js b/src/index.js index 3efa5a7..1a7a6c7 100644 --- a/src/index.js +++ b/src/index.js @@ -12,6 +12,7 @@ const mapPlaceholder = document.querySelector('.map-placeholder'), // fileName = localStorage.getItem('map') || (env === 'test' ? 'test_map' : 'map1'), fileName = localStorage.getItem('map') || 'map1', map = `assets/images/${fileName}.svg`, + fileInputEl = document.querySelector('input[type="file"]'), toggleContentVis = (function () { document.querySelectorAll('#content div').forEach(div => { @@ -64,6 +65,7 @@ function clearMoveEndedIndicators(records) { } function load() { + URL.revokeObjectURL(this.data); const svg = this.contentDocument.querySelector('svg'), startLocs = svg.querySelector('.start-locations'); @@ -156,3 +158,12 @@ document.querySelector('#download-save').addEventListener('click', e => { element.click(); // document.body.removeChild(element); }); + +document.querySelector('#upload-save').addEventListener('click', () => { + fileInputEl.click(); +}); + +document.querySelector('input[type="file"]').addEventListener('change', e => { + const [file] = fileInputEl.files; + document.querySelector('object').data = URL.createObjectURL(file); +}); |