mirror of
https://github.com/orangeglo/gbnp.git
synced 2026-04-26 00:28:34 -05:00
Save some settings to localstorage
This commit is contained in:
parent
20bb05d404
commit
7050143831
|
|
@ -147,12 +147,12 @@
|
|||
<div class="flex-item">
|
||||
<input id="englishPatch-input" type="checkbox" v-model:checked="englishPatch"/>
|
||||
<label for="englishPatch-input">Translate the menu into English.</label>
|
||||
<!-- <a href="img/menu_comparison.png">Comparison here.</a> -->
|
||||
<!-- <a href="img/menu_comparison.png">?</a> -->
|
||||
</div>
|
||||
<div class="flex-item">
|
||||
<input id="forceDMG-input" type="checkbox" v-model:checked="forceDMG"/>
|
||||
<label for="forceDMG-input">Use the DMG menu and music on color systems.</label>
|
||||
<!-- <a href="img/menu_comparison.png">Comparison here.</a> -->
|
||||
<a href="img/menu_comparison.png">?</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,7 @@
|
|||
const parseBool = (boolString) => {
|
||||
return boolString.toLowerCase() === 'true';
|
||||
};
|
||||
|
||||
Vue.component('bitmap-preview', {
|
||||
props: ['data'],
|
||||
mounted: function() {
|
||||
|
|
@ -74,6 +78,8 @@ let app = new Vue({
|
|||
fontsLoaded: false,
|
||||
},
|
||||
created: function() {
|
||||
this.loadSettingsFromStorage();
|
||||
|
||||
this.processor.menu = this.menu;
|
||||
this.processor.tickerText = this.tickerText;
|
||||
this.processor.forceDMG = this.forceDMG;
|
||||
|
|
@ -94,11 +100,21 @@ let app = new Vue({
|
|||
},
|
||||
watch: {
|
||||
roms: function() { this.processor.roms = this.roms; },
|
||||
forceDMG: function() { this.processor.forceDMG = this.forceDMG; },
|
||||
cartType: function() { this.processor.cartType = this.cartType; },
|
||||
englishPatch: function() { this.processor.englishPatch = this.englishPatch; },
|
||||
forceDMG: function() {
|
||||
this.processor.forceDMG = this.forceDMG;
|
||||
this.writeSettingsToStorage();
|
||||
},
|
||||
cartType: function() {
|
||||
this.processor.cartType = this.cartType;
|
||||
this.writeSettingsToStorage();
|
||||
},
|
||||
englishPatch: function() {
|
||||
this.processor.englishPatch = this.englishPatch;
|
||||
this.writeSettingsToStorage();
|
||||
},
|
||||
fontIndex: function() {
|
||||
for (let i = 0; i < this.roms.length; i++) { this.roms[i].updateBitmap(this.fontIndex); }
|
||||
this.writeSettingsToStorage();
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
|
|
@ -169,6 +185,23 @@ let app = new Vue({
|
|||
e.target.classList.remove('over')
|
||||
e.preventDefault();
|
||||
},
|
||||
writeSettingsToStorage: function () {
|
||||
window.localStorage.setItem('fontIndex', this.fontIndex);
|
||||
window.localStorage.setItem('forceDMG', this.forceDMG);
|
||||
window.localStorage.setItem('englishPatch', this.englishPatch);
|
||||
window.localStorage.setItem('cartType', this.cartType);
|
||||
},
|
||||
loadSettingsFromStorage: function() {
|
||||
const fontIndex = window.localStorage.getItem('fontIndex');
|
||||
const forceDMG = window.localStorage.getItem('forceDMG');
|
||||
const englishPatch = window.localStorage.getItem('englishPatch');
|
||||
const cartType = window.localStorage.getItem('cartType');
|
||||
|
||||
if (fontIndex) { this.fontIndex = parseInt(fontIndex); }
|
||||
if (forceDMG) { this.forceDMG = parseBool(forceDMG); }
|
||||
if (englishPatch) { this.englishPatch = parseBool(englishPatch); }
|
||||
if (cartType) { this.cartType = parseInt(cartType); }
|
||||
},
|
||||
triggerAddMenuLabel: function(e) { this.$refs.addMenuLabel.click(); },
|
||||
triggerAddRomLabel: function(e) { this.$refs.addRomLabel.click(); },
|
||||
stopPropagation: function(e) { e.stopImmediatePropagation(); },
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user