From 59df28029f19abb9b1e9dcb5fdd19d45b6a51fac Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Tue, 3 Sep 2019 23:01:23 +0200 Subject: [PATCH] logger import reordering --- src/ext/lib/ActionHandler.js | 2 +- src/ext/lib/Settings.js | 2 +- src/ext/lib/comms/CommsClient.js | 2 +- src/ext/lib/video-data/PageInfo.js | 2 +- src/ext/lib/video-data/PlayerData.js | 2 +- src/ext/lib/video-data/VideoData.js | 2 +- src/ext/lib/video-transform/Resizer.js | 2 +- src/ext/lib/video-transform/Stretcher.js | 2 +- src/ext/lib/video-transform/Zoom.js | 5 +++-- src/ext/uw.js | 2 +- 10 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ext/lib/ActionHandler.js b/src/ext/lib/ActionHandler.js index aeccbbc..791e72b 100644 --- a/src/ext/lib/ActionHandler.js +++ b/src/ext/lib/ActionHandler.js @@ -5,12 +5,12 @@ import ExtensionMode from '../../common/enums/extension-mode.enum'; class ActionHandler { constructor(pageInfo) { + this.logger = pageInfo.logger; this.pageInfo = pageInfo; this.settings = pageInfo.settings; this.inputs = ['input', 'select', 'button', 'textarea']; this.keyboardLocalDisabled = false; - this.logger = pageInfo.logger; } init() { diff --git a/src/ext/lib/Settings.js b/src/ext/lib/Settings.js index e257f02..822c009 100644 --- a/src/ext/lib/Settings.js +++ b/src/ext/lib/Settings.js @@ -13,6 +13,7 @@ class Settings { constructor(options) { // Options: activeSettings, updateCallback, logger + this.logger = options.logger; const activeSettings = options.activeSettings; const updateCallback = options.updateCallback; @@ -22,7 +23,6 @@ class Settings { this.useSync = false; this.version = undefined; this.updateCallback = updateCallback; - this.logger = options.logger; const ths = this; diff --git a/src/ext/lib/comms/CommsClient.js b/src/ext/lib/comms/CommsClient.js index d8d5b82..8c2d4c0 100644 --- a/src/ext/lib/comms/CommsClient.js +++ b/src/ext/lib/comms/CommsClient.js @@ -3,6 +3,7 @@ import BrowserDetect from '../../conf/BrowserDetect'; class CommsClient { constructor(name, settings, logger) { + this.logger = logger; if (BrowserDetect.firefox) { this.port = browser.runtime.connect({name: name}); } else if (BrowserDetect.chrome) { @@ -18,7 +19,6 @@ class CommsClient { this.settings = settings; this.pageInfo = undefined; this.commsId = (Math.random() * 20).toFixed(0); - this.logger = logger; } destroy() { diff --git a/src/ext/lib/video-data/PageInfo.js b/src/ext/lib/video-data/PageInfo.js index e530fa9..516140d 100644 --- a/src/ext/lib/video-data/PageInfo.js +++ b/src/ext/lib/video-data/PageInfo.js @@ -10,6 +10,7 @@ if(Debug.debug) class PageInfo { constructor(comms, settings, logger, extensionMode, readOnly = false){ + this.logger = logger; this.hasVideos = false; this.siteDisabled = false; this.videos = []; @@ -20,7 +21,6 @@ class PageInfo { this.extensionMode = extensionMode; this.readOnly = readOnly; - this.logger = logger; if (comms){ this.comms = comms; diff --git a/src/ext/lib/video-data/PlayerData.js b/src/ext/lib/video-data/PlayerData.js index 660278f..729d315 100644 --- a/src/ext/lib/video-data/PlayerData.js +++ b/src/ext/lib/video-data/PlayerData.js @@ -34,6 +34,7 @@ if(Debug.debug) class PlayerData { constructor(videoData) { + this.logger = videoData.logger; this.videoData = videoData; this.video = videoData.video; this.settings = videoData.settings; @@ -41,7 +42,6 @@ class PlayerData { this.element = undefined; this.dimensions = undefined; this.overlayNode = undefined; - this.logger = videoData.logger; this.observer = new MutationObserver(this.onPlayerDimensionsChanged); diff --git a/src/ext/lib/video-data/VideoData.js b/src/ext/lib/video-data/VideoData.js index ca76cd2..4a1c579 100644 --- a/src/ext/lib/video-data/VideoData.js +++ b/src/ext/lib/video-data/VideoData.js @@ -6,13 +6,13 @@ import ArDetector from '../ar-detect/ArDetector'; class VideoData { constructor(video, settings, pageInfo){ + this.logger = pageInfo.logger; this.arSetupComplete = false; this.video = video; this.destroyed = false; this.settings = settings; this.pageInfo = pageInfo; this.extensionMode = pageInfo.extensionMode; - this.logger = pageInfo.logger; this.vdid = (Math.random()*100).toFixed(); this.userCssClassName = `uw-fuck-you-and-do-what-i-tell-you_${this.vdid}`; diff --git a/src/ext/lib/video-transform/Resizer.js b/src/ext/lib/video-transform/Resizer.js index 3b8d747..5bfbd85 100644 --- a/src/ext/lib/video-transform/Resizer.js +++ b/src/ext/lib/video-transform/Resizer.js @@ -16,11 +16,11 @@ class Resizer { constructor(videoData) { this.conf = videoData; + this.logger = videoData.logger; this.video = videoData.video; this.settings = videoData.settings; this.extensionMode = videoData.extensionMode; - this.logger = videoData.logger; this.scaler = new Scaler(this.conf); this.stretcher = new Stretcher(this.conf); diff --git a/src/ext/lib/video-transform/Stretcher.js b/src/ext/lib/video-transform/Stretcher.js index b916c4e..8894df9 100644 --- a/src/ext/lib/video-transform/Stretcher.js +++ b/src/ext/lib/video-transform/Stretcher.js @@ -12,9 +12,9 @@ class Stretcher { // functions constructor(videoData) { this.conf = videoData; + this.logger = videoData.logger; this.settings = videoData.settings; this.mode = this.settings.getDefaultStretchMode(window.location.hostname); - this.logger = videoData.logger; } setStretchMode(stretchMode) { diff --git a/src/ext/lib/video-transform/Zoom.js b/src/ext/lib/video-transform/Zoom.js index bf1baec..b14c30b 100644 --- a/src/ext/lib/video-transform/Zoom.js +++ b/src/ext/lib/video-transform/Zoom.js @@ -6,13 +6,14 @@ import Debug from '../../conf/Debug'; class Zoom { // functions constructor(videoData) { + this.conf = videoData; + this.logger = videoData.logger; + this.scale = 1; this.logScale = 0; this.scaleStep = 0.1; this.minScale = -1; // 50% (log2(0.5) = -1) this.maxScale = 3; // 800% (log2(8) = 3) - this.conf = videoData; - this.logger = videoData.logger; } reset(){ diff --git a/src/ext/uw.js b/src/ext/uw.js index 764b7aa..1dec571 100644 --- a/src/ext/uw.js +++ b/src/ext/uw.js @@ -65,8 +65,8 @@ class UW { 'arDetect_verbose': false, } }; - // this.logger = new Logger(this.settings.getLoggingOptions); this.logger = new Logger(loggingOptions); + // await this.logger.init(); // not needed if logging options are provided at creation } } catch (e) { console.error("logger init failed!", e)