| Conditions | 1 |
| Paths | 1 |
| Total Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | 'use strict'; |
||
| 9 | function options($timeout, $state, state, savegame) { |
||
| 10 | let ct = this; |
||
| 11 | ct.state = state; |
||
| 12 | |||
| 13 | ct.reset = function (ask) { |
||
| 14 | let confirmation = true; |
||
| 15 | if (ask) { |
||
| 16 | confirmation = confirm('Are you sure you want to reset? This will permanently erase your progress.'); |
||
| 17 | } |
||
| 18 | |||
| 19 | if (confirmation === true) { |
||
| 20 | localStorage.removeItem('playerStoredITE'); |
||
| 21 | savegame.initSave(); |
||
| 22 | } |
||
| 23 | }; |
||
| 24 | |||
| 25 | ct.importExportSave = function () { |
||
| 26 | if (state.export) { |
||
| 27 | try { |
||
| 28 | state.player = JSON.parse(atob(state.export)); |
||
| 29 | savegame.versionControl(); |
||
| 30 | } catch (error) { |
||
| 31 | alert('Invalid save file.'); |
||
| 32 | } |
||
| 33 | } else { |
||
| 34 | let exportText = btoa(JSON.stringify(state.player)); |
||
| 35 | |||
| 36 | state.export = exportText; |
||
| 37 | } |
||
| 38 | }; |
||
| 39 | } |
||
| 40 |