-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
25 lines (20 loc) · 848 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
const getExtensionLink = document.getElementById("extension_link");
const getExtensionImage = document.getElementById("extension_image");
const browserLinks = {
firefox: "https://addons.mozilla.org/en-US/firefox/addon/youtube-simplified/",
chrome: "https://chromewebstore.google.com/detail/youtube-simplified/ofdlnilnphocpoekbagdkemgidmbfmjl?hl=en-GB&authuser=1"
}
const browserImages = {
firefox: "images/firefox.svg",
chrome: "images/chrome.svg"
}
const browser = (function () {
const test = regexp => regexp.test(window.navigator.userAgent);
switch (true) {
case test(/firefox|fxios/i): return "firefox";
case test(/chrome|chromium|crios/i): return "chrome";
default: return "chrome";
}
})();
getExtensionLink.href = browserLinks[browser];
getExtensionImage.src = browserImages[browser];