From 954967e701bfbf85a25d4b94be9e1fec9c15ef41 Mon Sep 17 00:00:00 2001 From: Leon Bubova Date: Sat, 18 Dec 2021 00:07:15 +0100 Subject: [PATCH] move getBrowser to utils.js --- Extensions/combined/ryd.content-script.js | 17 ++--------------- Extensions/combined/src/utils.js | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/Extensions/combined/ryd.content-script.js b/Extensions/combined/ryd.content-script.js index 8fa5399..594513f 100644 --- a/Extensions/combined/ryd.content-script.js +++ b/Extensions/combined/ryd.content-script.js @@ -4,6 +4,7 @@ import { getDislikeButton, checkForSignInButton, } from "./src/buttons"; + import { isMobile, isVideoDisliked, @@ -17,7 +18,7 @@ import { NEUTRAL_STATE, } from "./src/state"; -import { numberFormat } from "./src/utils"; +import { numberFormat, getBrowser } from "./src/utils"; let storedData = { likes: 0, @@ -253,17 +254,3 @@ document.addEventListener("yt-navigate-finish", function (event) { }); setTimeout(() => sendVideoIds(), 2500); - -function getBrowser() { - if (typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined") { - return chrome; - } else if ( - typeof browser !== "undefined" && - typeof browser.runtime !== "undefined" - ) { - return browser; - } else { - console.log("browser is not supported"); - return false; - } -} diff --git a/Extensions/combined/src/utils.js b/Extensions/combined/src/utils.js index 8919251..ad28f4c 100644 --- a/Extensions/combined/src/utils.js +++ b/Extensions/combined/src/utils.js @@ -25,4 +25,18 @@ function numberFormat(numberState) { return formatter.format(roundDown(numberState)); } -export { numberFormat } \ No newline at end of file +function getBrowser() { + if (typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined") { + return chrome; + } else if ( + typeof browser !== "undefined" && + typeof browser.runtime !== "undefined" + ) { + return browser; + } else { + console.log("browser is not supported"); + return false; + } +} + +export { numberFormat, getBrowser } \ No newline at end of file