Minor adjustments for Firefox Preview (Fenix) compatibility.
This commit is contained in:
parent
9a664f7b3b
commit
e6af4b07c1
|
@ -114,7 +114,7 @@ var RequestGuard = (() => {
|
||||||
: (numAllowed ? "sub" : "no");
|
: (numAllowed ? "sub" : "no");
|
||||||
let showBadge = ns.local.showCountBadge && numBlocked > 0;
|
let showBadge = ns.local.showCountBadge && numBlocked > 0;
|
||||||
let browserAction = browser.browserAction;
|
let browserAction = browser.browserAction;
|
||||||
if (!browserAction.setIcon) { // mobile
|
if (!browserAction.setIcon) { // Fennec
|
||||||
browserAction.setTitle({tabId, title: `NoScript (${numBlocked})`});
|
browserAction.setTitle({tabId, title: `NoScript (${numBlocked})`});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ var RequestGuard = (() => {
|
||||||
browserAction.setBadgeText({tabId, text: showBadge ? numBlocked.toString() : ""});
|
browserAction.setBadgeText({tabId, text: showBadge ? numBlocked.toString() : ""});
|
||||||
browserAction.setBadgeBackgroundColor({tabId, color: [128, 0, 0, 160]});
|
browserAction.setBadgeBackgroundColor({tabId, color: [128, 0, 0, 160]});
|
||||||
browserAction.setTitle({tabId,
|
browserAction.setTitle({tabId,
|
||||||
title: `${VERSION_LABEL} \n${enforced ?
|
title: UA.mobile ? "NoScript" : `${VERSION_LABEL} \n${enforced ?
|
||||||
_("BlockedItems", [numBlocked, numAllowed + numBlocked]) + ` \n${report}`
|
_("BlockedItems", [numBlocked, numAllowed + numBlocked]) + ` \n${report}`
|
||||||
: _("NotEnforced")}`
|
: _("NotEnforced")}`
|
||||||
});
|
});
|
||||||
|
|
|
@ -109,12 +109,12 @@
|
||||||
// wiring main UI
|
// wiring main UI
|
||||||
let ba = browser.browserAction;
|
let ba = browser.browserAction;
|
||||||
if ("setIcon" in ba) {
|
if ("setIcon" in ba) {
|
||||||
//desktop
|
//desktop or Fenix
|
||||||
ba.setPopup({
|
ba.setPopup({
|
||||||
popup: popupURL
|
popup: popupURL
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// mobile
|
// Fennec
|
||||||
ba.onClicked.addListener(async tab => {
|
ba.onClicked.addListener(async tab => {
|
||||||
try {
|
try {
|
||||||
await browser.tabs.remove(await browser.tabs.query({
|
await browser.tabs.remove(await browser.tabs.query({
|
||||||
|
@ -250,9 +250,10 @@
|
||||||
deferWebTraffic(this.initializing = init(),
|
deferWebTraffic(this.initializing = init(),
|
||||||
async () => {
|
async () => {
|
||||||
Commands.install();
|
Commands.install();
|
||||||
|
try {
|
||||||
this.devMode = (await browser.management.getSelf()).installType === "development";
|
this.devMode = (await browser.management.getSelf()).installType === "development";
|
||||||
if (!this.local.debug) {
|
} catch(e) {}
|
||||||
|
if (!(this.local.debug || this.devMode)) {
|
||||||
debug = () => {}; // suppress verbosity
|
debug = () => {}; // suppress verbosity
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
{
|
{
|
||||||
let mozWebExtUrl = document.URL.startsWith("moz-");
|
let mozWebExtUrl = document.URL.startsWith("moz-");
|
||||||
let isMozilla = mozWebExtUrl || typeof window.wrappedJSObject === "object";
|
let isMozilla = mozWebExtUrl || typeof window.wrappedJSObject === "object";
|
||||||
|
let mobile = false;
|
||||||
if (isMozilla) {
|
if (isMozilla) {
|
||||||
if (mozWebExtUrl) {
|
if (mozWebExtUrl) {
|
||||||
// help browser-specific UI styling
|
// help browser-specific UI styling
|
||||||
document.documentElement.classList.add("mozwebext");
|
document.documentElement.classList.add("mozwebext");
|
||||||
|
mobile = !("windows" in browser);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// shims for non-Mozilla browsers
|
// shims for non-Mozilla browsers
|
||||||
|
@ -14,6 +16,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var UA = {
|
var UA = {
|
||||||
isMozilla
|
isMozilla,
|
||||||
|
mobile,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,7 @@ body {
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: right;
|
text-align: right;
|
||||||
|
margin: 0 0 2px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sect-general {
|
#sect-general {
|
||||||
|
|
|
@ -65,7 +65,11 @@ addEventListener("unload", e => {
|
||||||
{
|
{
|
||||||
let clickHandlers = {
|
let clickHandlers = {
|
||||||
"options": e => {
|
"options": e => {
|
||||||
|
if (UA.mobile) { // Fenix fails on openOptionsPage
|
||||||
|
browser.tabs.create({url: browser.extension.getURL("/ui/options.html")});
|
||||||
|
} else {
|
||||||
browser.runtime.openOptionsPage();
|
browser.runtime.openOptionsPage();
|
||||||
|
}
|
||||||
close();
|
close();
|
||||||
},
|
},
|
||||||
"close": close,
|
"close": close,
|
||||||
|
|
|
@ -410,15 +410,13 @@ fieldset {
|
||||||
|
|
||||||
legend {
|
legend {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
display: inline;
|
display: block;
|
||||||
|
}
|
||||||
|
.customizer legend {
|
||||||
|
font-size: 0.75em;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0.25em;
|
top: 0.25em;
|
||||||
left: 1em;
|
left: 1em;
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.customizer legend {
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 0.75em;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#presets .https-only {
|
#presets .https-only {
|
||||||
|
|
|
@ -21,7 +21,7 @@ var UI = (() => {
|
||||||
"/lib/tld.js",
|
"/lib/tld.js",
|
||||||
"/common/Policy.js",
|
"/common/Policy.js",
|
||||||
];
|
];
|
||||||
this.mobile = !("windows" in browser);
|
this.mobile = UA.mobile;
|
||||||
if (this.mobile) {
|
if (this.mobile) {
|
||||||
document.documentElement.classList.toggle("mobile", true);
|
document.documentElement.classList.toggle("mobile", true);
|
||||||
scripts.push("/lib/fastclick.js");
|
scripts.push("/lib/fastclick.js");
|
||||||
|
|
Loading…
Reference in New Issue