Fix minor issues

This commit is contained in:
Tamius Han 2019-10-27 00:10:49 +02:00
parent 854bc05d14
commit f05a0813d2
3 changed files with 23 additions and 25 deletions

View File

@ -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(

View File

@ -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;

View File

@ -109,8 +109,6 @@
</template>
<script>
import ControlsSettings from './controls-settings/ControlsSettings';
import GeneralSettings from './GeneralSettings';
import Donate from '../common/misc/Donate.vue';
import SuperAdvancedSettings from './SuperAdvancedSettings.vue';
import Debug from '../ext/conf/Debug.js';