From 64169a85f4242da2f61bedb4572894103eaafc9a Mon Sep 17 00:00:00 2001 From: 4yman <170770027+4yman-0@users.noreply.github.com> Date: Sat, 2 Nov 2024 18:23:51 +0100 Subject: [PATCH] remove ESLint errors #2 --- js&css/extension/core.js | 6 +++--- .../www.youtube.com/appearance/header/header.css | 2 +- js&css/extension/www.youtube.com/general/general.js | 13 ++++++------- js&css/web-accessible/functions.js | 8 ++++---- menu/satus.js | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/js&css/extension/core.js b/js&css/extension/core.js index 1380b031a..bbb803d72 100644 --- a/js&css/extension/core.js +++ b/js&css/extension/core.js @@ -238,9 +238,9 @@ extension.storage.get = function (key) { return this.data[key]; } else { var target = this.data; - /*path = key.split('/').filter(function (value) { - return value != ''; - });*/ + /*path = key.split('/').filter(function (value) { + return value != ''; + });*/ for (var i = 0, l = key.length; i < l; i++) { var part = key[i]; diff --git a/js&css/extension/www.youtube.com/appearance/header/header.css b/js&css/extension/www.youtube.com/appearance/header/header.css index 5f606f2b9..a93eab514 100644 --- a/js&css/extension/www.youtube.com/appearance/header/header.css +++ b/js&css/extension/www.youtube.com/appearance/header/header.css @@ -10,7 +10,7 @@ html[it-header-transparent=true] ytd-masthead#masthead {background: transparent !important;} html[it-header-transparent=true] #background.ytd-masthead {background-color: rgba(230, 230, 230, 0.1) !important;} html[it-header-transparent=true] ytd-masthead[frosted-glass] #background.ytd-masthead {backdrop-filter: blur(1px) !important;} -html[it-header-transparent=true] { --ytd-searchbox-background: rgba(var(--ytd-searchbox-background), 0.5) !important;} +html[it-header-transparent=true] { --ytd-searchbox-background: rgba(var(--ytd-searchbox-background), 0.5) !important;} /* Header-transparent alternative by @joaolscosta */ /* Change opacity when scrolling down */ diff --git a/js&css/extension/www.youtube.com/general/general.js b/js&css/extension/www.youtube.com/general/general.js index 4f81ec10a..1a9ee15ca 100644 --- a/js&css/extension/www.youtube.com/general/general.js +++ b/js&css/extension/www.youtube.com/general/general.js @@ -255,7 +255,8 @@ extension.features.popupWindowButtons = function (event) { else { width = innerWidth * 0.4; height = innerHeight * 0.4; } if (!ytPlayer) { let shorts = /short/.test(this.parentElement.href); - if ( width / height < 1 ) { let vertical = true } else { let vertical = false } + let vertical = false; + if ( width / height < 1 ) { vertical = true } if ( !vertical && shorts ) { width = height * 0.6} if ( vertical && !shorts ) { height = width * 0.6} } @@ -289,10 +290,12 @@ extension.features.popupWindowButtons = function (event) { extension.features.font = function (changed) { var option = extension.storage.get('font'); + var link = this.font.link, + style = this.font.style; if (option && option !== 'Default') { - var link = this.font.link || document.createElement('link'), - style = this.font.style || document.createElement('style'); + link = link || document.createElement('link'), + style = style || document.createElement('style'); link.rel = 'stylesheet'; link.href = '//fonts.googleapis.com/css2?family=' + option; @@ -305,13 +308,9 @@ extension.features.font = function (changed) { this.font.link = link; this.font.style = style; } else if (changed) { - var link = this.font.link, - style = this.font.style; - if (link) { link.remove(); } - if (style) { style.remove(); } diff --git a/js&css/web-accessible/functions.js b/js&css/web-accessible/functions.js index 31ec61eaa..65ca24afb 100644 --- a/js&css/web-accessible/functions.js +++ b/js&css/web-accessible/functions.js @@ -144,7 +144,7 @@ ImprovedTube.ytElementsHandler = function (node) { } else if (id === 'movie_player') { if (!this.elements.player) { ImprovedTube.elements.player = node; - // if (this.storage.player_autoplay === false) { ImprovedTube.elements.player.stopVideo(); } + // if (this.storage.player_autoplay === false) { ImprovedTube.elements.player.stopVideo(); } ImprovedTube.elements.video = node.querySelector('video'); ImprovedTube.elements.player_left_controls = node.querySelector('.ytp-left-controls'); ImprovedTube.elements.player_right_controls = node.querySelector('.ytp-right-controls'); @@ -234,7 +234,7 @@ ImprovedTube.ytElementsHandler = function (node) { ImprovedTube.expandDescription(node); console.log("EXPAND DESCRIPTION, OLD WAY") }, 750); }} */ - } else if (id === 'panels') { + } else if (id === 'panels') { ImprovedTube.elements.panels = node; } }; @@ -405,8 +405,8 @@ ImprovedTube.playerOnPause = function (event) { }; if (document.documentElement.dataset.pageType === 'video' - && (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.transcript || ImprovedTube.storage.chapters )) { - ImprovedTube.forbidFocus = function (ms) { + && (ImprovedTube.storage.description === "expanded" || ImprovedTube.storage.transcript || ImprovedTube.storage.chapters )) { + ImprovedTube.forbidFocus = function (ms) { const originalFocus = HTMLElement.prototype.focus; // Backing up default method - other methods: Element.prototype.scrollIntoView window.scrollTo window.scrollBy // Override YouTube's scroll method: HTMLElement.prototype.focus = function() {console.log("Preventing YouTube's scripted scrolling, when expanding the video description for you"); } diff --git a/menu/satus.js b/menu/satus.js index 4ae6f694d..91e2c4611 100644 --- a/menu/satus.js +++ b/menu/satus.js @@ -1027,7 +1027,7 @@ satus.locale.get = function (string) { # IMPORT // old: satus.locale.import(url, onload, onsuccess); --------------------------------------------------------------*/ satus.locale.import = function (code, callback, path) { - // if (!path) { path = '_locales/'; } + // if (!path) { path = '_locales/'; } function importLocale (locale, successCallback) { var url = chrome.runtime.getURL(path + locale + '/messages.json'); fetch(url)