Skip to content

Commit

Permalink
NoScript addons.mozilla.org release 10.1.5.8rc2
Browse files Browse the repository at this point in the history
v 10.1.5.8rc2
=============================================================
+ First "Quantum" release candidate with Android support
  • Loading branch information
avian2 committed Dec 15, 2017
1 parent 3aa4b0a commit ef0e4bb
Show file tree
Hide file tree
Showing 13 changed files with 664 additions and 107 deletions.
6 changes: 5 additions & 1 deletion xpi/bg/RequestGuard.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ var RequestGuard = (() => {
: ns.policy.enforced ? "yes" : "global")
: (numAllowed ? "sub" : "no");
let browserAction = browser.browserAction;

browserAction.setIcon({tabId, path: {64: `/img/ui-${icon}64.png`}});
browserAction.setBadgeText({tabId, text: numBlocked > 0 ? numBlocked.toString() : ""});
browserAction.setBadgeBackgroundColor({tabId, color: [255, 0, 0, 128]});
Expand All @@ -144,7 +145,6 @@ var RequestGuard = (() => {
`NoScript (${numBlocked}/${numAllowed + numBlocked})\n${report}`
: _("GloballyEnabled")
});
browserAction.enable(tabId);
},

totalize(sum, value) {
Expand Down Expand Up @@ -191,6 +191,10 @@ var RequestGuard = (() => {
browser.tabs.onActivated.addListener(TabStatus.onActivatedTab);
browser.tabs.onRemoved.addListener(TabStatus.onRemovedTab);

if (!("setIcon" in browser.browserAction)) { // unsupported on Android
TabStatus._updateTabNow = TabStatus.updateTab = () => {};
}

const Content = {


Expand Down
8 changes: 6 additions & 2 deletions xpi/bg/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,17 @@ var Settings = {
}, null, 2);
},

exportToFile() {
async exportToFile() {
if (!await browser.permissions.request({permissions: ["downloads"]})) {
return false;
}
browser.downloads.download({
url: URL.createObjectURL(new Blob([this.export()], {
type: "application/json"
})),
saveAs: true,
filename: "noscript.json"
})
});
return true;
},
}
44 changes: 34 additions & 10 deletions xpi/bg/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
var ns = (() => {
'use strict';

const popupURL = browser.extension.getURL("/ui/popup.html");
let popupFor = tabId => `${popupURL}#tab${tabId}`;

async function init() {
let policyData = (await SafeSync.get("policy")).policy;
if (policyData && policyData.DEFAULT) {
Expand Down Expand Up @@ -38,7 +41,7 @@
return;
}
browser.windows.create({
url: await browser.browserAction.getPopup({}),
url: popupURL,
width: 800,
height: 600,
type: "panel"
Expand All @@ -47,11 +50,32 @@

togglePermissions() {},
install() {
browser.commands.onCommand.addListener(cmd => {
if (cmd in Commands) {
Commands[cmd]();
}
});


if ("command" in browser) {
// keyboard shortcuts
browser.commands.onCommand.addListener(cmd => {
if (cmd in Commands) {
Commands[cmd]();
}
});
}

// wiring main UI
let ba = browser.browserAction;
if ("setIcon" in ba) {
//desktop
ba.setPopup({popup: popupURL});
} else {
// mobile
ba.onClicked.addListener(async tab => {
try {
await browser.tabs.remove(await browser.tabs.query({url: popupURL}));
} catch (e) {
}
await browser.tabs.create({url: popupFor(tab.id)});
});
}
}
}

Expand Down Expand Up @@ -89,17 +113,17 @@
let win = await browser.windows.getLastFocused({
windowTypes: ["normal"]
});
let tab = (await browser.tabs.query({
windowId: win.id,
let [tab] = (await browser.tabs.query({
lastFocusedWindow: true,
active: true
}))[0];
}));

if (!tab || tab.id === -1) {
log("No tab found to open the UI for");
return;
}
browser.windows.create({
url: await browser.browserAction.getPopup({}) + "?tabId=" + tab.id,
url: popupFor(tab.id),
width: 800,
height: 600,
top: win.top + 48,
Expand Down
7 changes: 3 additions & 4 deletions xpi/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"strict_min_version": "57.0"
}
},
"version": "10.1.5.8rc1",
"version": "10.1.5.8rc2",
"description": "__MSG_Description__",

"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'none'; default-src 'self'",
Expand All @@ -20,8 +20,8 @@
},

"permissions": [
"downloads",
"contextMenus",
"downloads",
"privacy",
"storage",
"tabs",
Expand Down Expand Up @@ -80,8 +80,7 @@
"default_title": "NoScript",
"default_icon": {
"64": "img/ui-maybe64.png"
},
"default_popup": "/ui/popup.html"
}
},

"commands": {
Expand Down
34 changes: 20 additions & 14 deletions xpi/ui/options.css
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
@import url("chrome://browser/content/extension.css");

/* @import url("chrome://browser/content/extension.css"); */
body {
background: url("/img/noscript-options.png") no-repeat fixed top right;
background-size: 128px;
padding: 0 64px 0 0;
margin: 8px 8px 8px 8px;
background-size: 8em;
padding: 0 4em 0 0;
margin: 0.5em 0.5em 0.5em 0.5em;
}
#header {
padding: 0 64px 0 0;
padding: 0 4em 0 0;
margin: 0;
text-align: right;
}
#header h1 {
color: #048;
text-shadow: 1px 1px 1px rgba(0,0,0,.5);
font-size: 32px;
text-shadow: 0.06em 0.06em 0.06em rgba(0,0,0,.5);
font-size: 2em;
padding: 0;
margin: 0;
text-align: right;
}
#version {
color: #048;
font-size: 12px;
font-size: 0.75em;
padding: 0;
margin: 0 0 8px;
margin: 0 0 0.5em;
display: block;
text-align: right;
}

#sect-general {
margin-right: 64px;
margin-right: 4em;
display: flex;
flex-direction: column;
justify-content: space-around;
font-size: 1em;
}
.opt-group {
display: flex;
Expand Down Expand Up @@ -69,8 +71,12 @@ body.debug div.debug {


input#newsite {
margin: 8px;
min-width: 300px;
margin: 0.5em;
min-width: 18.75em;
}

input, button {
font-size: 1em;
}

button.add {
Expand All @@ -82,10 +88,10 @@ input[type="file"] {
}

.opt-group {
padding: 8px 0;
padding: 0.5em 0;
}
#xssFaq {
padding: 8px 1em;
padding: 0.5em 1em;
}
#clearclick-options {
display: none;
Expand Down
104 changes: 104 additions & 0 deletions xpi/ui/options.css.px
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
@import url("chrome://browser/content/extension.css");
body {
background: url("/img/noscript-options.png") no-repeat fixed top right;
background-size: 128px;
padding: 0 64px 0 0;
margin: 8px 8px 8px 8px;
}
#header {
padding: 0 64px 0 0;
margin: 0;
text-align: right;
}
#header h1 {
color: #048;
text-shadow: 1px 1px 1px rgba(0,0,0,.5);
font-size: 32px;
padding: 0;
margin: 0;
text-align: right;
}
#version {
color: #048;
font-size: 12px;
padding: 0;
margin: 0 0 8px;
display: block;
text-align: right;
}

#sect-general {
margin-right: 64px;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.opt-group {
display: flex;
flex-direction: row;
justify-content: space-between;
}

#policy {
display: block;
margin-top: .5em;
min-height: 20em;
width: 90%;
}
.hide, div.debug {
display: none;
}

body.debug div.debug {
display: initial;
}

.error {
background: #ff8;
color: red;
}

#policy-error {
background: red;
color: #ff8;
padding: 0;
margin: 0;
font-weight: bold;
}



input#newsite {
margin: 8px;
min-width: 300px;
}

button.add {
font-weight: bold;
}

input[type="file"] {
display: none;
}

.opt-group {
padding: 8px 0;
}
#xssFaq {
padding: 8px 1em;
}
#clearclick-options {
display: none;
}

.buttons {
display: flex;
align-items: flex-end;
}
/*
#sites {
max-height: 500px;
overflow-y: auto;
border: 1px solid #ddd;
}
*/
6 changes: 3 additions & 3 deletions xpi/ui/options.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ <h1 >
<input type="checkbox" id="opt-auto"><label for="opt-auto" id="lbl-auto">__MSG_AutoAllowTopLevel__</label>
</span>
<div class="buttons">
<span><input id="file-import" type="file" style="display: none !important" /></span>
<span><input id="file-import" type="file"/></span>
<button id="btn-import" accesskey="__MSG_Import.accesskey__">__MSG_Import__</button>
<button id="btn-export" accesskey="__MSG_Export.accesskey__">__MSG_Export__</button>
<button id="btn-reset" accesskey="__MSG_ResetDef.accesskey__">__MSG_ResetDef__</button>
<button id="btn-reset" accesskey="__MSG_Reset.accesskey__">__MSG_Reset__</button>
</div>
</div>
<div class="opt-group">
Expand All @@ -50,7 +50,7 @@ <h1 >
<input name="newsite" id="newsite" type="text" placeholder="[https://]noscript.net">
<button class="add">+</button>
</form>
<div id="sites" >
<div id="sites">
</div>
</section>

Expand Down
5 changes: 4 additions & 1 deletion xpi/ui/options.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
'use strict';
(async () => {
await UI.init();
browser.browserAction.disable((await browser.tabs.getCurrent()).id);

if ("disable" in browser.browserAction) {
browser.browserAction.disable((await browser.tabs.getCurrent()).id);
}

let policy = UI.policy;

let version = browser.runtime.getManifest().version;
Expand Down
Loading

0 comments on commit ef0e4bb

Please sign in to comment.