summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhackademix2019-05-06 12:11:31 +0200
committerhackademix2019-05-06 12:11:31 +0200
commitc2be460915714a1696a9c5c4f98e40f2dbb3be8e (patch)
tree2c69f48fe0cf64a923f17790cda24da9882aa04a
parent7b35acdab069fcfa4573b5094fb766b57d19fe04 (diff)
downloadnoscript-c2be460915714a1696a9c5c4f98e40f2dbb3be8e.tar.gz
noscript-c2be460915714a1696a9c5c4f98e40f2dbb3be8e.tar.xz
noscript-c2be460915714a1696a9c5c4f98e40f2dbb3be8e.zip
Fix mozwebext class added to content pages (Issue #80).
-rw-r--r--src/lib/UA.js30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/lib/UA.js b/src/lib/UA.js
index 438eaf6..d87efbb 100644
--- a/src/lib/UA.js
+++ b/src/lib/UA.js
@@ -1,12 +1,22 @@
-var UA = {
- isMozilla: document.URL.startsWith("moz-") || typeof window.wrappedJSObject === "object",
-}
-
-if (!UA.isMozilla) {
- if (typeof chrome === "object" && !chrome.tabs && typeof exportFunction === "undefined") {
- // content script shims
- window.exportFunction = () => {};
+{
+ let mozWebExtUrl = document.URL.startsWith("moz-");
+ let isMozilla = mozWebExtUrl || window.wrappedJSObject === "object";
+ if (isMozilla) {
+ if (mozWebExtUrl) {
+ // help browser-specific UI styling
+ document.documentElement.classList.add("mozwebext");
+ }
+ } else {
+ // shims for non-Mozilla browsers
+ if (typeof chrome === "object" && !chrome.tabs) {
+ // content script shims
+ if (typeof exportFunction === "undefined") {
+ window.exportFunction = () => {};
+ }
+ }
}
-} else {
- document.documentElement.classList.add("mozwebext");
+
+ var UA = {
+ isMozilla
+ };
}