diff --git a/src/ext/lib/ActionHandler.js b/src/ext/lib/ActionHandler.js index e3b870e..c0d2bf0 100644 --- a/src/ext/lib/ActionHandler.js +++ b/src/ext/lib/ActionHandler.js @@ -32,8 +32,8 @@ class ActionHandler { var actions; try { - if (this.settings.active.sites[window.location.host].actions) { - actions = this.settings.active.sites[window.location.host].actions; + if (this.settings.active.sites[window.location.hostname].actions) { + actions = this.settings.active.sites[window.location.hostname].actions; } else { actions = this.settings.active.actions; } @@ -247,7 +247,7 @@ class ActionHandler { this.setKeyboardLocal(cmd.arg); } } else { - let site = action.scope === 'site' ? window.location.host : '@global'; + let site = action.scope === 'site' ? window.location.hostname : '@global'; if (cmd.action === "set-stretch") { this.settings.active.sites[site].stretch = cmd.arg; diff --git a/src/ext/lib/PlayerPickerHelper.js b/src/ext/lib/PlayerPickerHelper.js index e03eed2..5aac89b 100644 --- a/src/ext/lib/PlayerPickerHelper.js +++ b/src/ext/lib/PlayerPickerHelper.js @@ -36,7 +36,7 @@ class PlayerPickerHelper { } findPlayerForVideo(settings, video) { - const host = window.location.host; + const host = window.location.hostname; let element = video.parentNode; if (this.settings.active.sites[host] diff --git a/src/ext/lib/Settings.js b/src/ext/lib/Settings.js index f3ccdde..6597cc1 100644 --- a/src/ext/lib/Settings.js +++ b/src/ext/lib/Settings.js @@ -495,10 +495,10 @@ class Settings { canStartAutoAr(site) { // 'site' argument is only ever used when calling this function recursively for debugging if (!site) { - site = window.location.host; + site = window.location.hostname; if (!site) { - this.logger.log('warn', ['settings', 'init', 'debug'], `[Settings::canStartAutoAr] No site — even window.location.host returned nothing!: ${window.location.host}`); + this.logger.log('warn', ['settings', 'init', 'debug'], `[Settings::canStartAutoAr] No site — even window.location.hostname returned nothing!: ${window.location.hostname}`); return false; } } diff --git a/src/ext/lib/comms/CommsClient.js b/src/ext/lib/comms/CommsClient.js index 97965e3..7c26658 100644 --- a/src/ext/lib/comms/CommsClient.js +++ b/src/ext/lib/comms/CommsClient.js @@ -19,7 +19,7 @@ class CommsClient { (history) => { this.logger.log('info', 'comms', 'Sending logging-stop-and-save to background script ...'); try { - this.port.postMessage({cmd: 'logging-stop-and-save', host: window.location.host, history}) + this.port.postMessage({cmd: 'logging-stop-and-save', host: window.location.hostname, history}) } catch (e) { this.logger.log('error', 'comms', 'Failed to send message to background script. Error:', e); } diff --git a/src/ext/lib/video-data/PageInfo.js b/src/ext/lib/video-data/PageInfo.js index 9a9b60f..f34306b 100644 --- a/src/ext/lib/video-data/PageInfo.js +++ b/src/ext/lib/video-data/PageInfo.js @@ -29,7 +29,7 @@ class PageInfo { try { // request inject css immediately - const playerStyleString = this.settings.active.sites[window.location.host].css.replace('\\n', ''); + const playerStyleString = this.settings.active.sites[window.location.hostname].css.replace('\\n', ''); this.comms.sendMessage({ cmd: 'inject-css', cssString: playerStyleString @@ -39,11 +39,11 @@ class PageInfo { } // try getting default crop immediately. - // const cropModePersistence = this.settings.getDefaultCropPersistenceMode(window.location.host); + // const cropModePersistence = this.settings.getDefaultCropPersistenceMode(window.location.hostname); // try { // if (cropModePersistence === CropModePersistence.Forever) { - // this.defaultCrop = this.settings.active.sites[window.location.host].defaultCrop; + // this.defaultCrop = this.settings.active.sites[window.location.hostname].defaultCrop; // } else if (cropModePersistence === CropModePersistence.CurrentSession) { // this.defaultCrop = JSON.parse(sessionStorage.getItem('uw-crop-mode-session-persistence')); // } @@ -95,7 +95,7 @@ class PageInfo { } try { - playerStyleString = this.settings.active.sites[window.location.host].css; + playerStyleString = this.settings.active.sites[window.location.hostname].css; if (playerStyleString) { this.comms.sendMessage({ cmd: 'eject-css', @@ -150,7 +150,7 @@ class PageInfo { const oldVideoCount = this.videos.length; try{ - var vids = this.getVideos(window.location.host); + var vids = this.getVideos(window.location.hostname); if(!vids || vids.length == 0){ this.hasVideos = false; @@ -245,9 +245,9 @@ class PageInfo { // } if (this.videos.length > 0) { - this.comms.registerVideo({host: window.location.host, location: window.location}); + this.comms.registerVideo({host: window.location.hostname, location: window.location}); } else { - this.comms.unregisterVideo({host: window.location.host, location: window.location}); + this.comms.unregisterVideo({host: window.location.hostname, location: window.location}); } } @@ -582,12 +582,12 @@ class PageInfo { if (persistenceMode === CropModePersistence.CurrentSession) { sessionStorage.setItem('uw-crop-mode-session-persistence', JSON.stringify(this.currentCrop)); } else if (persistenceMode === CropModePersistence.Forever) { - if (this.settings.active.sites[window.location.host]) { + if (this.settings.active.sites[window.location.hostname]) { // | key may be missing, so we do this - this.settings.active.sites[window.location.host]['defaultAr'] = this.currentCrop; + this.settings.active.sites[window.location.hostname]['defaultAr'] = this.currentCrop; } else { - this.settings.active.sites[window.location.host] = this.settings.getDefaultOption(); - this.settings.active.sites[window.location.host]['defaultAr'] = this.currentCrop; + this.settings.active.sites[window.location.hostname] = this.settings.getDefaultOption(); + this.settings.active.sites[window.location.hostname]['defaultAr'] = this.currentCrop; } this.settings.saveWithoutReload(); @@ -599,7 +599,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.getDefaultCropPersistenceMode(window.location.host); + const cropModePersistence = this.settings.getDefaultCropPersistenceMode(window.location.hostname); if (cropModePersistence === CropModePersistence.Disabled) { return; @@ -610,12 +610,12 @@ class PageInfo { if (cropModePersistence === CropModePersistence.CurrentSession) { sessionStorage.setItem('uw-crop-mode-session-persistence', JSON.stringify(ar)); } else if (cropModePersistence === CropModePersistence.Forever) { - if (this.settings.active.sites[window.location.host]) { + if (this.settings.active.sites[window.location.hostname]) { // | key may be missing, so we do this - this.settings.active.sites[window.location.host]['defaultAr'] = ar; + this.settings.active.sites[window.location.hostname]['defaultAr'] = ar; } else { - this.settings.active.sites[window.location.host] = this.settings.getDefaultOption(); - this.settings.active.sites[window.location.host]['defaultAr'] = ar; + this.settings.active.sites[window.location.hostname] = this.settings.getDefaultOption(); + this.settings.active.sites[window.location.hostname]['defaultAr'] = ar; } this.settings.saveWithoutReload(); diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index e7da5de..cc5239f 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -47,7 +47,7 @@ class PlayerData { this.periodicallyRefreshPlayerElement = false; try { - this.periodicallyRefreshPlayerElement = this.settings.active.sites[window.location.host].DOM.player.periodicallyRefreshPlayerElement; + this.periodicallyRefreshPlayerElement = this.settings.active.sites[window.location.hostname].DOM.player.periodicallyRefreshPlayerElement; } catch (e) { // no biggie — that means we don't have any special settings for this site. } @@ -226,7 +226,7 @@ class PlayerData { } getPlayer() { - const host = window.location.host; + const host = window.location.hostname; let element = this.video.parentNode; const videoWidth = this.video.offsetWidth; const videoHeight = this.video.offsetHeight; diff --git a/src/ext/lib/video-transform/Resizer.js b/src/ext/lib/video-transform/Resizer.js index 7a5a6c6..f8c5223 100644 --- a/src/ext/lib/video-transform/Resizer.js +++ b/src/ext/lib/video-transform/Resizer.js @@ -151,7 +151,7 @@ class Resizer { return; } - const siteSettings = this.settings.active.sites[window.location.host]; + const siteSettings = this.settings.active.sites[window.location.hostname]; // reset zoom, but only on aspect ratio switch. We also know that aspect ratio gets converted to // AspectRatio.Fixed when zooming, so let's keep that in mind @@ -354,7 +354,7 @@ class Resizer { resetPan() { this.pan = {}; - this.videoAlignment = this.settings.getDefaultVideoAlignment(window.location.host); + this.videoAlignment = this.settings.getDefaultVideoAlignment(window.location.hostname); } setPan(relativeMousePosX, relativeMousePosY){ @@ -585,7 +585,7 @@ class Resizer { let extraStyleString; try { - extraStyleString = this.settings.active.sites[window.location.host].DOM.video.additionalCss; + extraStyleString = this.settings.active.sites[window.location.hostname].DOM.video.additionalCss; } catch (e) { // do nothing. It's ok if no special settings are defined for this site, we'll just do defaults } diff --git a/src/popup/js/ExecAction.js b/src/popup/js/ExecAction.js index 46a60f4..a5a0afa 100644 --- a/src/popup/js/ExecAction.js +++ b/src/popup/js/ExecAction.js @@ -48,7 +48,7 @@ class ExecAction { if (scope === 'global') { site = '@global'; } else if (!this.site) { - site = window.location.host; + site = window.location.hostname; } if (scope === 'site' && !this.settings.active.sites[site]) {