move getBrowser to utils.js

This commit is contained in:
Leon Bubova committed 2021-12-18 00:07:15 +01:00
1 parent 4d9f706904
commit 954967e701
2 files changed
+17 -16

No files matched your search

+2 -15
View File
@@ -4,6 +4,7 @@ import {
getDislikeButton, getDislikeButton,
checkForSignInButton, checkForSignInButton,
} from "./src/buttons"; } from "./src/buttons";
import { import {
isMobile, isMobile,
isVideoDisliked, isVideoDisliked,
@@ -17,7 +18,7 @@ import {
NEUTRAL_STATE, NEUTRAL_STATE,
} from "./src/state"; } from "./src/state";
import { numberFormat } from "./src/utils"; import { numberFormat, getBrowser } from "./src/utils";
let storedData = { let storedData = {
likes: 0, likes: 0,
@@ -253,17 +254,3 @@ document.addEventListener("yt-navigate-finish", function (event) {
}); });
setTimeout(() => sendVideoIds(), 2500); 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;
}
}
+15 -1
View File
@@ -25,4 +25,18 @@ function numberFormat(numberState) {
return formatter.format(roundDown(numberState)); return formatter.format(roundDown(numberState));
} }
export { numberFormat } 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 }