diff --git a/src/ext/lib/Settings.js b/src/ext/lib/Settings.js index 1e76a29..508fca3 100644 --- a/src/ext/lib/Settings.js +++ b/src/ext/lib/Settings.js @@ -28,9 +28,9 @@ class Settings { const ths = this; if (currentBrowser.firefox) { - browser.storage.onChanged.addListener(this.storageChangeListener); + browser.storage.onChanged.addListener((changes, area) => {this.storageChangeListener(changes, area)}); } else if (currentBrowser.chrome) { - chrome.storage.onChanged.addListener(this.storageChangeListener); + chrome.storage.onChanged.addListener((changes, area) => {this.storageChangeListener(changes, area)}); } } @@ -159,22 +159,22 @@ class Settings { // | needed. In this case, we assume we're on the current version const oldVersion = (settings && settings.version) || this.version; - if(Debug.debug) { + if (settings) { this.logger.log('info', 'settings', "[Settings::init] Configuration fetched from storage:", settings, "\nlast saved with:", settings.version, "\ncurrent version:", this.version ); - - // if (Debug.flushStoredSettings) { - // this.logger.log('info', 'settings', "%c[Settings::init] Debug.flushStoredSettings is true. Using default settings", "background: #d00; color: #ffd"); - // Debug.flushStoredSettings = false; // don't do it again this session - // this.active = this.getDefaultSettings(); - // this.active.version = this.version; - // this.set(this.active); - // return this.active; - // } } + // if (Debug.flushStoredSettings) { + // this.logger.log('info', 'settings', "%c[Settings::init] Debug.flushStoredSettings is true. Using default settings", "background: #d00; color: #ffd"); + // Debug.flushStoredSettings = false; // don't do it again this session + // this.active = this.getDefaultSettings(); + // this.active.version = this.version; + // this.set(this.active); + // return this.active; + // } + // if there's no settings saved, return default settings. if(! settings || (Object.keys(settings).length === 0 && settings.constructor === Object)) { this.logger.log( diff --git a/src/ext/lib/video-data/PageInfo.js b/src/ext/lib/video-data/PageInfo.js index 72c3955..f4a8a0c 100644 --- a/src/ext/lib/video-data/PageInfo.js +++ b/src/ext/lib/video-data/PageInfo.js @@ -40,17 +40,17 @@ class PageInfo { } // try getting default crop immediately. - const cropModePersistence = this.settings.active.getDefaultCropPersistenceMode(window.location.host); + const cropModePersistence = this.settings.getDefaultCropPersistenceMode(window.location.host); - try { - if (cropModePersistence === CropModePersistence.Forever) { - this.defaultCrop = this.settings.active.sites[window.location.host].defaultCrop; - } else if (cropModePersistence === CropModePersistence.CurrentSession) { - this.defaultCrop = JSON.parse(sessionStorage.getItem('uw-crop-mode-session-persistence')); - } - } catch (e) { - // do nothing. It's ok if there's no special settings for the player element or crop persistence - } + // try { + // if (cropModePersistence === CropModePersistence.Forever) { + // this.defaultCrop = this.settings.active.sites[window.location.host].defaultCrop; + // } else if (cropModePersistence === CropModePersistence.CurrentSession) { + // this.defaultCrop = JSON.parse(sessionStorage.getItem('uw-crop-mode-session-persistence')); + // } + // } catch (e) { + // // do nothing. It's ok if there's no special settings for the player element or crop persistence + // } this.currentCrop = this.defaultCrop; this.rescan(RescanReason.PERIODIC); @@ -598,7 +598,7 @@ class PageInfo { // This means crop persistance is disabled. If crop persistance is enabled, then settings for current // site MUST exist (crop persistence mode is disabled by default) - const cropModePersistence = this.settings.active.getDefaultCropPersistenceMode(window.location.host); + const cropModePersistence = this.settings.getDefaultCropPersistenceMode(window.location.host); if (cropModePersistence === CropModePersistence.Disabled) { return; diff --git a/src/options/App.vue b/src/options/App.vue index 7408a80..e75b582 100644 --- a/src/options/App.vue +++ b/src/options/App.vue @@ -109,8 +109,6 @@