From e8730f68798f173bd4d1c2f9b7ce02985e3fd771 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Fri, 1 Sep 2017 16:35:50 -0400 Subject: SpyBlock updated to 2.9.1 --- .../spyblock@gnu.org/chrome/content/ui/common.js | 154 ++++++++ .../spyblock@gnu.org/chrome/content/ui/composer.js | 54 ++- .../chrome/content/ui/composer.xul | 2 +- .../chrome/content/ui/ext/common.js | 187 ++++------ .../chrome/content/ui/ext/content.js | 116 +++--- .../chrome/content/ui/fennecSettings.xul | 4 +- .../chrome/content/ui/filters-backup.js | 115 +++--- .../chrome/content/ui/filters-filteractions.js | 43 ++- .../chrome/content/ui/filters-filterview.js | 114 +++--- .../chrome/content/ui/filters-search.js | 226 +++++------- .../content/ui/filters-subscriptionactions.js | 12 +- .../chrome/content/ui/filters-subscriptionview.js | 42 ++- .../spyblock@gnu.org/chrome/content/ui/filters.js | 5 +- .../spyblock@gnu.org/chrome/content/ui/filters.xul | 31 +- .../chrome/content/ui/firstRun.html | 93 ++--- .../spyblock@gnu.org/chrome/content/ui/firstRun.js | 212 ++--------- .../spyblock@gnu.org/chrome/content/ui/flasher.js | 108 ------ .../spyblock@gnu.org/chrome/content/ui/i18n.js | 89 +++-- .../spyblock@gnu.org/chrome/content/ui/overlay.xul | 26 +- .../chrome/content/ui/progressBar.js | 2 +- .../chrome/content/ui/progressBar.xul | 2 +- .../chrome/content/ui/sendReport.js | 340 +++++++++--------- .../chrome/content/ui/sendReport.xul | 9 +- .../chrome/content/ui/settings.xul | 4 +- .../spyblock@gnu.org/chrome/content/ui/sidebar.js | 388 ++++++++++++--------- .../spyblock@gnu.org/chrome/content/ui/sidebar.xul | 7 +- .../chrome/content/ui/sidebarDetached.xul | 2 +- .../chrome/content/ui/skin/abb-logo.png | Bin 0 -> 1309 bytes .../chrome/content/ui/skin/abp-128.png | Bin 7303 -> 7768 bytes .../chrome/content/ui/skin/common.css | 59 ++++ .../chrome/content/ui/skin/features/malware.png | Bin 3335 -> 0 bytes .../chrome/content/ui/skin/features/social.png | Bin 4260 -> 0 bytes .../chrome/content/ui/skin/features/tracking.png | Bin 3562 -> 0 bytes .../chrome/content/ui/skin/firstRun.css | 350 +++++++------------ .../chrome/content/ui/subscriptionSelection.js | 6 +- .../chrome/content/ui/subscriptionSelection.xul | 2 +- .../chrome/content/ui/subscriptions.xml | 53 ++- .../spyblock@gnu.org/chrome/content/ui/utils.js | 28 +- 38 files changed, 1388 insertions(+), 1497 deletions(-) create mode 100644 data/extensions/spyblock@gnu.org/chrome/content/ui/common.js delete mode 100644 data/extensions/spyblock@gnu.org/chrome/content/ui/flasher.js create mode 100644 data/extensions/spyblock@gnu.org/chrome/content/ui/skin/abb-logo.png create mode 100644 data/extensions/spyblock@gnu.org/chrome/content/ui/skin/common.css delete mode 100644 data/extensions/spyblock@gnu.org/chrome/content/ui/skin/features/malware.png delete mode 100644 data/extensions/spyblock@gnu.org/chrome/content/ui/skin/features/social.png delete mode 100644 data/extensions/spyblock@gnu.org/chrome/content/ui/skin/features/tracking.png (limited to 'data/extensions/spyblock@gnu.org/chrome/content/ui') diff --git a/data/extensions/spyblock@gnu.org/chrome/content/ui/common.js b/data/extensions/spyblock@gnu.org/chrome/content/ui/common.js new file mode 100644 index 0000000..ec20ede --- /dev/null +++ b/data/extensions/spyblock@gnu.org/chrome/content/ui/common.js @@ -0,0 +1,154 @@ +/* + * This file is part of Adblock Plus , + * Copyright (C) 2006-2017 eyeo GmbH + * + * Adblock Plus is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * Adblock Plus is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Adblock Plus. If not, see . + */ + +/* globals Components */ + +"use strict"; + +function E(id) +{ + return document.getElementById(id); +} + +function getDocLink(link, callback) +{ + ext.backgroundPage.sendMessage({ + type: "app.get", + what: "doclink", + link + }, callback); +} + +function checkShareResource(url, callback) +{ + ext.backgroundPage.sendMessage({ + type: "filters.blocked", + url, + requestType: "SCRIPT", + docDomain: "adblockplus.org", + thirdParty: true + }, callback); +} + +function openSharePopup(url) +{ + let glassPane = E("glass-pane"); + if (!glassPane) + { + glassPane = document.createElement("div"); + glassPane.setAttribute("id", "glass-pane"); + document.body.appendChild(glassPane); + } + + let iframe = E("share-popup"); + if (!iframe) + { + iframe = document.createElement("iframe"); + iframe.setAttribute("id", "share-popup"); + iframe.setAttribute("scrolling", "no"); + glassPane.appendChild(iframe); + } + + // Firefox 38+ no longer allows messaging using postMessage so we need + // to have a fake top level frame to avoid problems with scripts that try to + // communicate with the first-run page + let isGecko = ("Components" in window); + if (isGecko) + { + try + { + let Ci = Components.interfaces; + let docShell = iframe.contentWindow + .QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDocShell); + + if (typeof docShell.frameType != "undefined") + { + // Gecko 47+ + docShell.frameType = docShell.FRAME_TYPE_BROWSER; + } + else + { + // Legacy branch + docShell.setIsBrowserInsideApp( + Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID + ); + } + } + catch (ex) + { + console.error(ex); + } + } + + let popupMessageReceived = false; + function resizePopup(width, height) + { + iframe.width = width; + iframe.height = height; + iframe.style.marginTop = -height / 2 + "px"; + iframe.style.marginLeft = -width / 2 + "px"; + popupMessageReceived = true; + window.removeEventListener("message", popupMessageListener); + } + + let popupMessageListener = function(event) + { + if (!/[./]adblockplus\.org$/.test(event.origin) || + !("width" in event.data) || !("height" in event.data)) + return; + + resizePopup(event.data.width, event.data.height); + }; + // Firefox requires last parameter to be true to be triggered by + // unprivileged pages + window.addEventListener("message", popupMessageListener, false, true); + + let popupLoadListener = function() + { + if (!popupMessageReceived && isGecko) + { + let rootElement = iframe.contentDocument.documentElement; + let {width, height} = rootElement.dataset; + if (width && height) + resizePopup(width, height); + } + + if (popupMessageReceived) + { + iframe.className = "visible"; + + let popupCloseListener = function() + { + iframe.className = glassPane.className = ""; + document.removeEventListener("click", popupCloseListener); + }; + document.addEventListener("click", popupCloseListener, false); + } + else + { + glassPane.className = ""; + window.removeEventListener("message", popupMessageListener); + } + + iframe.removeEventListener("load", popupLoadListener); + }; + iframe.addEventListener("load", popupLoadListener, false); + + iframe.src = url; + glassPane.className = "visible"; +} diff --git a/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.js b/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.js index 98a38aa..8170cee 100644 --- a/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.js +++ b/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.js @@ -1,6 +1,6 @@ /* * This file is part of Adblock Plus , - * Copyright (C) 2006-2015 Eyeo GmbH + * Copyright (C) 2006-2017 eyeo GmbH * * Adblock Plus is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as @@ -15,13 +15,14 @@ * along with Adblock Plus. If not, see . */ -let nodes = null; -let item = null; -let advancedMode = false; +var nodesID = null; +var item = null; +var advancedMode = false; function init() { - [nodes, item] = window.arguments; + [nodesID, item] = window.arguments; + window.addEventListener("unload", () => Policy.deleteNodes(nodesID)); E("filterType").value = (!item.filter || item.filter.disabled || item.filter instanceof WhitelistFilter ? "filterlist" : "whitelist"); E("customPattern").value = item.location; @@ -118,19 +119,8 @@ function init() else E("patternGroup").focus(); - let types = []; - for (let type in Policy.localizedDescr) - { - types.push(parseInt(type)); - } - types.sort(function(a, b) { - if (a < b) - return -1; - else if (a > b) - return 1; - else - return 0; - }); + let types = Array.from(new Set(Policy.contentTypes.values())); + types.sort(); let docDomain = item.docDomain; let thirdParty = item.thirdParty; @@ -145,24 +135,24 @@ function init() let typeGroup = E("typeGroup"); let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMap.DOCUMENT; - let isDefaultType = (RegExpFilter.typeMap[item.typeDescr] & defaultTypes) != 0; + let isDefaultType = (RegExpFilter.typeMap[item.type] & defaultTypes) != 0; for (let type of types) { - if (type == Policy.type.ELEMHIDE) + if (type == "ELEMHIDE" || type == "GENERICBLOCK" || type == "GENERICHIDE") continue; let typeNode = document.createElement("checkbox"); - typeNode.setAttribute("value", Policy.typeDescr[type].toLowerCase().replace(/\_/g, "-")); - typeNode.setAttribute("label", Policy.localizedDescr[type].toLowerCase()); + typeNode.setAttribute("value", type.toLowerCase().replace(/\_/g, "-")); + typeNode.setAttribute("label", Utils.getString("type_label_" + type.toLowerCase())); - let typeMask = RegExpFilter.typeMap[Policy.typeDescr[type]]; + let typeMask = RegExpFilter.typeMap[type]; typeNode._defaultType = (typeMask & defaultTypes) != 0; if ((isDefaultType && typeNode._defaultType) || (!isDefaultType && item.type == type)) typeNode.setAttribute("checked", "true"); if (item.type == type) typeNode.setAttribute("disabled", "true"); - typeNode.addEventListener("command", function() checkboxUpdated(this), false); + typeNode.addEventListener("command", () => checkboxUpdated(typeNode), false); typeGroup.appendChild(typeNode); } @@ -255,16 +245,16 @@ function updateFilter() if (options.length) { - options.sort(function(a, b) a[0] - b[0]); - filter += "$" + options.map(function(o) o[1]).join(","); + options.sort((a, b) => a[0] - b[0]); + filter += "$" + options.map(o => o[1]).join(","); } } else { let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMap.DOCUMENT; - let isDefaultType = (RegExpFilter.typeMap[item.typeDescr] & defaultTypes) != 0; + let isDefaultType = (RegExpFilter.typeMap[item.type] & defaultTypes) != 0; if (!isDefaultType) - filter += "$" + item.typeDescr.toLowerCase().replace(/\_/g, "-"); + filter += "$" + item.type.toLowerCase().replace(/\_/g, "-"); } filter = Filter.normalize(filter); @@ -279,7 +269,7 @@ function updateFilter() } E("shortpatternWarning").hidden = !isSlow; - E("matchWarning").hidden = compiledFilter instanceof RegExpFilter && compiledFilter.matches(item.location, item.typeDescr, item.docDomain, item.thirdParty); + E("matchWarning").hidden = compiledFilter instanceof RegExpFilter && compiledFilter.matches(item.location, RegExpFilter.typeMap[item.type], item.docDomain, item.thirdParty); E("filter").value = filter; } @@ -318,7 +308,7 @@ function updatePatternSelection() function testFilter(/**String*/ filter) /**Boolean*/ { - return RegExpFilter.fromText(filter + "$" + item.typeDescr).matches(item.location, item.typeDescr, item.docDomain, item.thirdParty); + return RegExpFilter.fromText(filter + "$" + item.type).matches(item.location, RegExpFilter.typeMap[item.type], item.docDomain, item.thirdParty); } let anchorStartCheckbox = E("anchorStart"); @@ -352,8 +342,8 @@ function addFilter() { FilterStorage.addFilter(filter); - if (nodes) - Policy.refilterNodes(nodes, item); + if (nodesID) + Policy.refilterNodes(nodesID, item); return true; } diff --git a/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul b/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul index 66e64ef..2cf1502 100644 --- a/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul +++ b/data/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul @@ -2,7 +2,7 @@ -