From 6e7918b6ccb69876d339a320091fdee811445395 Mon Sep 17 00:00:00 2001 From: Ruben Rodriguez Date: Mon, 20 Oct 2014 02:24:51 +0200 Subject: Generalize data directory --- .../spyblock@gnu.org/chrome/content/errors.html | 111 -- .../spyblock@gnu.org/chrome/content/objtabs.css | 82 - .../spyblock@gnu.org/chrome/content/ui/composer.js | 412 ----- .../chrome/content/ui/composer.xul | 118 -- .../chrome/content/ui/fennecSettings.xul | 38 - .../chrome/content/ui/filters-backup.js | 348 ----- .../chrome/content/ui/filters-filteractions.js | 561 ------- .../chrome/content/ui/filters-filterview.js | 849 ----------- .../chrome/content/ui/filters-search.js | 269 ---- .../content/ui/filters-subscriptionactions.js | 606 -------- .../chrome/content/ui/filters-subscriptionview.js | 330 ---- .../spyblock@gnu.org/chrome/content/ui/filters.js | 226 --- .../spyblock@gnu.org/chrome/content/ui/filters.xul | 400 ----- .../chrome/content/ui/firstRun.html | 141 -- .../spyblock@gnu.org/chrome/content/ui/firstRun.js | 253 ---- .../spyblock@gnu.org/chrome/content/ui/flasher.js | 108 -- .../spyblock@gnu.org/chrome/content/ui/i18n.js | 150 -- .../spyblock@gnu.org/chrome/content/ui/overlay.xul | 134 -- .../chrome/content/ui/progressBar.js | 158 -- .../chrome/content/ui/progressBar.xul | 29 - .../chrome/content/ui/sendReport.js | 1571 -------------------- .../chrome/content/ui/sendReport.xul | 259 ---- .../chrome/content/ui/settings.xul | 38 - .../spyblock@gnu.org/chrome/content/ui/sidebar.js | 1246 ---------------- .../spyblock@gnu.org/chrome/content/ui/sidebar.xul | 139 -- .../chrome/content/ui/sidebarDetached.xul | 50 - .../chrome/content/ui/subscriptionSelection.js | 308 ---- .../chrome/content/ui/subscriptionSelection.xul | 75 - .../chrome/content/ui/subscriptions.xml | 117 -- .../spyblock@gnu.org/chrome/content/ui/utils.js | 66 - 30 files changed, 9192 deletions(-) delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/errors.html delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/objtabs.css delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/fennecSettings.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters-backup.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters-filteractions.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters-filterview.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters-search.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters-subscriptionactions.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters-subscriptionview.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/filters.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/firstRun.html delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/firstRun.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/flasher.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/i18n.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/overlay.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/progressBar.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/progressBar.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/sendReport.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/sendReport.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/settings.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/sidebar.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/sidebar.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/sidebarDetached.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/subscriptionSelection.js delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/subscriptionSelection.xul delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/subscriptions.xml delete mode 100644 helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/utils.js (limited to 'helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content') diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/errors.html b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/errors.html deleted file mode 100644 index 5c18929..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/errors.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - Adblock Plus Errors - - - - - - - - - diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/objtabs.css b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/objtabs.css deleted file mode 100644 index ce3a830..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/objtabs.css +++ /dev/null @@ -1,82 +0,0 @@ -/* - * This file is part of Adblock Plus , - * Copyright (C) 2006-2014 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 . - */ - -@namespace url("http://www.w3.org/1999/xhtml"); - -.%%CLASSVISIBLETOP%%, .%%CLASSVISIBLEBOTTOM%%, .%%CLASSHIDDEN%% -{ - position: fixed !important; - display: block !important; - - width: auto !important; - height: auto !important; - right: auto !important; - bottom: auto !important; - z-index: 65535 !important; - float: left !important; - border-color: black !important; - border-style: solid !important; - background: white !important; - color: black !important; - cursor: pointer !important; - white-space: nowrap !important; - font-family: Arial,Helvetica,Sans-Serif !important; - font-size: 10px !important; - font-style: normal !important; - font-variant: normal !important; - font-weight: normal !important; - letter-spacing: normal !important; - line-height: normal !important; - text-align: center !important; - text-decoration: none !important; - text-indent: 0px !important; - text-transform: none !important; - direction: ltr !important; - padding: 0px 5px !important; - -moz-binding: none !important; - -moz-user-focus: none !important; - -moz-user-input: none !important; - -moz-user-select: none !important; -} - -.%%CLASSVISIBLETOP%%, .%%CLASSHIDDEN%% -{ - border-width: 1px 1px 0px 1px !important; - border-top-left-radius: 10px !important; - border-top-right-radius: 10px !important; - border-bottom-left-radius: 0px !important; - border-bottom-right-radius: 0px !important; -} - -.%%CLASSVISIBLEBOTTOM%% -{ - border-width: 0px 1px 1px 1px !important; - border-top-left-radius: 0px !important; - border-top-right-radius: 0px !important; - border-bottom-left-radius: 10px !important; - border-bottom-right-radius: 10px !important; -} - -.%%CLASSVISIBLETOP%%, .%%CLASSVISIBLEBOTTOM%% -{ - visibility: visible !important; -} - -.%%CLASSHIDDEN%% -{ - visibility: hidden !important; -} diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.js b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.js deleted file mode 100644 index f7b8087..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.js +++ /dev/null @@ -1,412 +0,0 @@ -/* - * This file is part of Adblock Plus , - * Copyright (C) 2006-2014 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 . - */ - -let nodes = null; -let item = null; -let advancedMode = false; - -function init() -{ - [nodes, item] = window.arguments; - - E("filterType").value = (!item.filter || item.filter.disabled || item.filter instanceof WhitelistFilter ? "filterlist" : "whitelist"); - E("customPattern").value = item.location; - - let insertionPoint = E("customPatternBox"); - let addSuggestion = function(address) - { - // Always drop protocol and www. from the suggestion - address = address.replace(/^[\w\-]+:\/+(?:www\.)?/, ""); - - let suggestion = document.createElement("radio"); - suggestion.setAttribute("value", address); - suggestion.setAttribute("label", address); - suggestion.setAttribute("crop", "center"); - suggestion.setAttribute("class", "suggestion"); - insertionPoint.parentNode.insertBefore(suggestion, insertionPoint); - - return address; - } - - let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); - try - { - let suggestions = [""]; - - let url = ioService.newURI(item.location, null, null) - .QueryInterface(Ci.nsIURL); - let suffix = (url.query ? "?*" : ""); - url.query = ""; - url.ref = ""; - suggestions[1] = addSuggestion(url.spec + suffix); - - let parentURL = ioService.newURI(url.fileName == "" ? ".." : ".", null, url); - if (!parentURL.equals(url)) - suggestions[2] = addSuggestion(parentURL.spec + "*"); - else - suggestions[2] = suggestions[1]; - - let rootURL = ioService.newURI("/", null, url); - if (!rootURL.equals(parentURL) && !rootURL.equals(url)) - suggestions[3] = addSuggestion(rootURL.spec + "*"); - else - suggestions[3] = suggestions[2]; - - try - { - suggestions[4] = addSuggestion(url.host.replace(/^www\./, "") + "^"); - - // Prefer example.com^ to example.com/* - let undesired = suggestions[4].replace(/\^$/, "/*"); - for (let i = 0; i < suggestions.length - 1; i++) - if (suggestions[i] == undesired) - suggestions[i] = suggestions[4]; - - for (let child = insertionPoint.parentNode.firstChild; child; child = child.nextSibling) - { - if (child.localName == "radio" && child.getAttribute("value") == undesired) - { - child.parentNode.removeChild(child); - break; - } - } - } - catch (e) - { - suggestions[4] = suggestions[3]; - } - - try - { - let effectiveTLD = Cc["@mozilla.org/network/effective-tld-service;1"].getService(Ci.nsIEffectiveTLDService); - let host = url.host; - let baseDomain = effectiveTLD.getBaseDomainFromHost(host); - if (baseDomain != host.replace(/^www\./, "")) - suggestions[5] = addSuggestion(baseDomain + "^"); - else - suggestions[5] = suggestions[4]; - } - catch (e) - { - suggestions[5] = suggestions[4]; - } - - E("patternGroup").value = (Prefs.composer_default in suggestions ? suggestions[Prefs.composer_default] : suggestions[1]); - } - catch (e) - { - // IOService returned nsIURI - not much we can do with it - addSuggestion(item.location); - E("patternGroup").value = ""; - } - if (Prefs.composer_default == 0) - E("customPattern").focus(); - 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 docDomain = item.docDomain; - let thirdParty = item.thirdParty; - - if (docDomain) - docDomain = docDomain.replace(/^www\./i, "").replace(/\.+$/, ""); - if (docDomain) - E("domainRestriction").value = docDomain; - - E("thirdParty").hidden = !thirdParty; - E("firstParty").hidden = thirdParty; - - let typeGroup = E("typeGroup"); - let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMap.DOCUMENT; - let isDefaultType = (RegExpFilter.typeMap[item.typeDescr] & defaultTypes) != 0; - for each (let type in types) - { - if (type == Policy.type.ELEMHIDE) - continue; - - let typeNode = document.createElement("checkbox"); - typeNode.setAttribute("value", Policy.typeDescr[type].toLowerCase().replace(/\_/g, "-")); - typeNode.setAttribute("label", Policy.localizedDescr[type].toLowerCase()); - - let typeMask = RegExpFilter.typeMap[Policy.typeDescr[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); - typeGroup.appendChild(typeNode); - } - - let collapseDefault = E("collapseDefault"); - collapseDefault.label = collapseDefault.getAttribute(Prefs.fastcollapse ? "label_no" : "label_yes"); - E("collapse").value = ""; - E("collapse").setAttribute("label", collapseDefault.label); - - let warning = E("disabledWarning"); - generateLinkText(warning); - warning.hidden = Prefs.enabled; - - updatePatternSelection(); -} - -function checkboxUpdated(checkbox) -{ - checkbox._lastChange = Date.now(); - updateFilter(); -} - -function updateFilter() -{ - let filter = ""; - - let type = E("filterType").value - if (type == "whitelist") - filter += "@@"; - - let pattern = E("patternGroup").value; - if (pattern == "") - pattern = E("customPattern").value; - - if (E("anchorStart").checked) - filter += E("anchorStart").flexibleAnchor ? "||" : "|"; - - filter += pattern; - - if (E("anchorEnd").checked) - filter += "|"; - - if (advancedMode) - { - let options = []; - - if (E("domainRestrictionEnabled").checked) - { - let domainRestriction = E("domainRestriction").value.replace(/[,\s]/g, "").replace(/\.+$/, ""); - if (domainRestriction) - options.push([E("domainRestrictionEnabled")._lastChange || 0, "domain=" + domainRestriction]); - } - - if (E("firstParty").checked) - options.push([E("firstParty")._lastChange || 0, "~third-party"]); - if (E("thirdParty").checked) - options.push([E("thirdParty")._lastChange || 0, "third-party"]); - - if (E("matchCase").checked) - options.push([E("matchCase")._lastChange || 0, "match-case"]); - - let collapse = E("collapse"); - disableElement(collapse, type == "whitelist", "value", ""); - if (collapse.value != "") - options.push([collapse._lastChange, collapse.value]); - - let enabledTypes = []; - let disabledTypes = []; - let forceEnabledTypes = []; - for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.nextSibling) - { - let value = typeNode.getAttribute("value"); - if (value == "document") - disableElement(typeNode, type != "whitelist", "checked", false); - - if (!typeNode._defaultType) - { - if (typeNode.getAttribute("checked") == "true") - forceEnabledTypes.push([typeNode._lastChange || 0, value]); - } - else if (typeNode.getAttribute("checked") == "true") - enabledTypes.push([typeNode._lastChange || 0, value]); - else - disabledTypes.push([typeNode._lastChange || 0, "~" + value]); - } - if (!forceEnabledTypes.length && disabledTypes.length < enabledTypes.length) - options.push.apply(options, disabledTypes); - else - options.push.apply(options, enabledTypes); - options.push.apply(options, forceEnabledTypes); - - if (options.length) - { - options.sort(function(a, b) a[0] - b[0]); - filter += "$" + options.map(function(o) o[1]).join(","); - } - } - else - { - let defaultTypes = RegExpFilter.prototype.contentType & ~RegExpFilter.typeMap.DOCUMENT; - let isDefaultType = (RegExpFilter.typeMap[item.typeDescr] & defaultTypes) != 0; - if (!isDefaultType) - filter += "$" + item.typeDescr.toLowerCase().replace(/\_/g, "-"); - } - - filter = Filter.normalize(filter); - E("regexpWarning").hidden = !Filter.regexpRegExp.test(filter); - - let isSlow = false; - let compiledFilter = Filter.fromText(filter); - if (E("regexpWarning").hidden) - { - if (compiledFilter instanceof RegExpFilter && defaultMatcher.isSlowFilter(compiledFilter)) - isSlow = true; - } - E("shortpatternWarning").hidden = !isSlow; - - E("matchWarning").hidden = compiledFilter instanceof RegExpFilter && compiledFilter.matches(item.location, item.typeDescr, item.docDomain, item.thirdParty); - - E("filter").value = filter; -} - -function generateLinkText(element, replacement) -{ - let template = element.getAttribute("textTemplate"); - if (typeof replacement != "undefined") - template = template.replace(/\?1\?/g, replacement) - - let [, beforeLink, linkText, afterLink] = /(.*)\[link\](.*)\[\/link\](.*)/.exec(template) || [null, "", template, ""]; - while (element.firstChild && element.firstChild.nodeType != Node.ELEMENT_NODE) - element.removeChild(element.firstChild); - while (element.lastChild && element.lastChild.nodeType != Node.ELEMENT_NODE) - element.removeChild(element.lastChild); - if (!element.firstChild) - return; - - element.firstChild.textContent = linkText; - element.insertBefore(document.createTextNode(beforeLink), element.firstChild); - element.appendChild(document.createTextNode(afterLink)); -} - -function updatePatternSelection() -{ - let pattern = E("patternGroup").value; - if (pattern == "") - { - pattern = E("customPattern").value; - } - else - { - E("anchorStart").checked = true; - E("anchorEnd").checked = false; - } - - function testFilter(/**String*/ filter) /**Boolean*/ - { - return RegExpFilter.fromText(filter + "$" + item.typeDescr).matches(item.location, item.typeDescr, item.docDomain, item.thirdParty); - } - - let anchorStartCheckbox = E("anchorStart"); - if (!/^\*/.test(pattern) && testFilter("||" + pattern)) - { - disableElement(anchorStartCheckbox, false, "checked", false); - [anchorStartCheckbox.label, anchorStartCheckbox.accessKey] = Utils.splitLabel(anchorStartCheckbox.getAttribute("labelFlexible")); - anchorStartCheckbox.flexibleAnchor = true; - } - else - { - disableElement(anchorStartCheckbox, /^\*/.test(pattern) || !testFilter("|" + pattern), "checked", false); - [anchorStartCheckbox.label, anchorStartCheckbox.accessKey] = Utils.splitLabel(anchorStartCheckbox.getAttribute("labelRegular")); - anchorStartCheckbox.flexibleAnchor = false; - } - disableElement(E("anchorEnd"), /[\*\^]$/.test(pattern) || !testFilter(pattern + "|"), "checked", false); - - updateFilter(); - setAdvancedMode(document.documentElement.getAttribute("advancedMode") == "true"); -} - -function updateCustomPattern() -{ - E("patternGroup").value = ""; - updatePatternSelection(); -} - -function addFilter() { - let filter = Filter.fromText(document.getElementById("filter").value); - filter.disabled = false; - - FilterStorage.addFilter(filter); - - if (nodes) - Policy.refilterNodes(nodes, item); - - return true; -} - -function setAdvancedMode(mode) { - advancedMode = mode; - - var dialog = document.documentElement; - dialog.setAttribute("advancedMode", advancedMode); - - var button = dialog.getButton("disclosure"); - button.setAttribute("label", dialog.getAttribute(advancedMode ? "buttonlabeldisclosure_off" : "buttonlabeldisclosure_on")); - - updateFilter(); -} - -function disableElement(element, disable, valueProperty, disabledValue) { - if ((element.getAttribute("disabled") == "true") == disable) - return; - - if (disable) - { - element.setAttribute("disabled", "true"); - element._abpStoredValue = element[valueProperty]; - element[valueProperty] = disabledValue; - } - else - { - element.removeAttribute("disabled"); - if ("_abpStoredValue" in element) - element[valueProperty] = element._abpStoredValue; - delete element._abpStoredValue; - } -} - -function openPreferences() -{ - UI.openFiltersDialog(Filter.fromText(E("filter").value)); -} - -function doEnable() { - Prefs.enabled = true; - E("disabledWarning").hidden = true; -} - -/** - * Selects or unselects all type checkboxes except those - * that are disabled. - */ -function selectAllTypes(/**Boolean*/ select) -{ - for (let typeNode = E("typeGroup").firstChild; typeNode; typeNode = typeNode.nextSibling) - if (typeNode.getAttribute("disabled") != "true") - typeNode.checked = select; - updateFilter(); -} diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul deleted file mode 100644 index 8931e16..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/composer.xul +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - -
- -

-
- - - - - -
-

-

-
- - -
-

- - - -
- - - - - -
-
- - -
-

- -
-
    -
  • -
    -
    -
    -

    - -
    -
    -
    -
    -
    -
    -
    - -
  • -
  • -
    -
    -
    -

    - -
    -
    -
    -
    -
    -
    -
    -
  • - -
  • -
    -
    -
    -

    - -
    -
    -
    -
    -
    -
    -
    -
  • - -
- -
-
- - -
- -
- - -
- -
- - \ No newline at end of file diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/firstRun.js b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/firstRun.js deleted file mode 100644 index be2caa6..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/firstRun.js +++ /dev/null @@ -1,253 +0,0 @@ -/* - * This file is part of Adblock Plus , - * Copyright (C) 2006-2014 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 . - */ - -"use strict"; - -(function() -{ - // Load subscriptions for features - var featureSubscriptions = [ - { - feature: "malware", - homepage: "http://malwaredomains.com/", - title: "Malware Domains", - url: "https://easylist-downloads.adblockplus.org/malwaredomains_full.txt" - }, - { - feature: "social", - homepage: "https://www.fanboy.co.nz/", - title: "Fanboy's Social Blocking List", - url: "https://easylist-downloads.adblockplus.org/fanboy-social.txt" - }, - { - feature: "tracking", - homepage: "https://easylist.adblockplus.org/", - title: "EasyPrivacy", - url: "https://easylist-downloads.adblockplus.org/easyprivacy.txt" - } - ]; - - function onDOMLoaded() - { - var locale = require("utils").Utils.appLocale; - document.documentElement.setAttribute("lang", locale); - - // Set up URLs - var donateLink = E("donate"); - donateLink.href = Utils.getDocLink("donate"); - - var contributors = E("contributors"); - contributors.href = Utils.getDocLink("contributors"); - - setLinks("acceptableAdsExplanation", Utils.getDocLink("acceptable_ads_criteria"), openFilters); - setLinks("share-headline", Utils.getDocLink("contribute")); - - if (typeof backgroundPage != "undefined") - { - // Show warning if data corruption was detected - if (backgroundPage.seenDataCorruption) - { - E("dataCorruptionWarning").removeAttribute("hidden"); - setLinks("dataCorruptionWarning", Utils.getDocLink("knownIssuesChrome_filterstorage")); - } - - // Show warning if filterlists settings were reinitialized - if (backgroundPage.filterlistsReinitialized) - { - E("filterlistsReinitializedWarning").removeAttribute("hidden"); - setLinks("filterlistsReinitializedWarning", openFilters); - } - } - - // Show warning if Safari version isn't supported - var info = require("info"); - if (info.platform == "safari" && ( - Services.vc.compare(info.platformVersion, "6.0") < 0 || // beforeload breaks websites in Safari 5 - Services.vc.compare(info.platformVersion, "6.1") == 0 || // extensions are broken in 6.1 and 7.0 - Services.vc.compare(info.platformVersion, "7.0") == 0 - )) - E("legacySafariWarning").removeAttribute("hidden"); - - // Set up feature buttons linked to subscriptions - featureSubscriptions.forEach(setToggleSubscriptionButton); - var filterListener = function(action) - { - if (/^subscription\.(added|removed|disabled)$/.test(action)) - { - for (var i = 0; i < featureSubscriptions.length; i++) - { - var featureSubscription = featureSubscriptions[i]; - updateToggleButton(featureSubscription.feature, isSubscriptionEnabled(featureSubscription)); - } - } - } - FilterNotifier.addListener(filterListener); - window.addEventListener("unload", function(event) - { - FilterNotifier.removeListener(filterListener); - }, false); - - initSocialLinks(); - } - - function isSubscriptionEnabled(featureSubscription) - { - return featureSubscription.url in FilterStorage.knownSubscriptions - && !Subscription.fromURL(featureSubscription.url).disabled; - } - - function setToggleSubscriptionButton(featureSubscription) - { - var feature = featureSubscription.feature; - - var element = E("toggle-" + feature); - updateToggleButton(feature, isSubscriptionEnabled(featureSubscription)); - element.addEventListener("click", function(event) - { - var subscription = Subscription.fromURL(featureSubscription.url); - if (isSubscriptionEnabled(featureSubscription)) - FilterStorage.removeSubscription(subscription); - else - { - subscription.disabled = false; - subscription.title = featureSubscription.title; - subscription.homepage = featureSubscription.homepage; - FilterStorage.addSubscription(subscription); - if (!subscription.lastDownload) - Synchronizer.execute(subscription); - } - }, false); - } - - function openSharePopup(url) - { - var iframe = E("share-popup"); - var glassPane = E("glass-pane"); - var popupMessageReceived = false; - - var popupMessageListener = function(event) - { - var originFilter = Filter.fromText("||adblockplus.org^"); - if (!originFilter.matches(event.origin, "OTHER", null, null)) - return; - - var width = event.data.width; - var height = event.data.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); - }; - // Firefox requires last parameter to be true to be triggered by unprivileged pages - window.addEventListener("message", popupMessageListener, false, true); - - var popupLoadListener = function() - { - if (popupMessageReceived) - { - iframe.className = "visible"; - - var 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"; - } - - function initSocialLinks() - { - var networks = ["twitter", "facebook", "gplus"]; - networks.forEach(function(network) - { - var link = E("share-" + network); - link.addEventListener("click", onSocialLinkClick, false); - }); - } - - function onSocialLinkClick(event) - { - // Don't open the share page if the sharing script would be blocked - var filter = defaultMatcher.matchesAny(event.target.getAttribute("data-script"), "SCRIPT", "adblockplus.org", true); - if (!(filter instanceof BlockingFilter)) - { - event.preventDefault(); - openSharePopup(Utils.getDocLink(event.target.id)); - } - } - - function setLinks(id) - { - var element = E(id); - if (!element) - { - return; - } - - var links = element.getElementsByTagName("a"); - - for (var i = 0; i < links.length; i++) - { - if (typeof arguments[i + 1] == "string") - { - links[i].href = arguments[i + 1]; - links[i].setAttribute("target", "_blank"); - } - else if (typeof arguments[i + 1] == "function") - { - links[i].href = "javascript:void(0);"; - links[i].addEventListener("click", arguments[i + 1], false); - } - } - } - - function openFilters() - { - if (typeof UI != "undefined") - UI.openFiltersDialog(); - else - { - backgroundPage.openOptions(); - } - } - - function updateToggleButton(feature, isEnabled) - { - var button = E("toggle-" + feature); - if (isEnabled) - button.classList.remove("off"); - else - button.classList.add("off"); - } - - document.addEventListener("DOMContentLoaded", onDOMLoaded, false); -})(); diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/flasher.js b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/flasher.js deleted file mode 100644 index ddb4131..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/flasher.js +++ /dev/null @@ -1,108 +0,0 @@ -/* - * This file is part of Adblock Plus , - * Copyright (C) 2006-2014 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 . - */ - -/** - * Draws a blinking border for a list of matching nodes. - */ - -var flasher = { - nodes: null, - count: 0, - timer: null, - - flash: function(nodes) - { - this.stop(); - if (nodes) - nodes = nodes.filter(function(node) node.nodeType == Node.ELEMENT_NODE); - if (!nodes || !nodes.length) - return; - - if (Prefs.flash_scrolltoitem && nodes[0].ownerDocument) - { - // Ensure that at least one node is visible when flashing - let wnd = nodes[0].ownerDocument.defaultView; - try - { - let topWnd = Utils.getChromeWindow(wnd); - let {getBrowser} = require("appSupport"); - let browser = (getBrowser ? getBrowser(topWnd) : null); - if (browser) - browser.markupDocumentViewer.scrollToNode(nodes[0]); - } - catch(e) - { - Cu.reportError(e); - } - } - - this.nodes = nodes; - this.count = 0; - - this.doFlash(); - }, - - doFlash: function() { - if (this.count >= 12) { - this.stop(); - return; - } - - if (this.count % 2) - this.switchOff(); - else - this.switchOn(); - - this.count++; - - this.timer = window.setTimeout(function() {flasher.doFlash()}, 300); - }, - - stop: function() { - if (this.timer) { - window.clearTimeout(this.timer); - this.timer = null; - } - - if (this.nodes) { - this.switchOff(); - this.nodes = null; - } - }, - - setOutline: function(outline, offset) - { - for (var i = 0; i < this.nodes.length; i++) - { - if ("style" in this.nodes[i]) - { - this.nodes[i].style.outline = outline; - this.nodes[i].style.outlineOffset = offset; - } - } - }, - - switchOn: function() - { - this.setOutline("#CC0000 dotted 2px", "-2px"); - }, - - switchOff: function() - { - this.setOutline("", ""); - } -}; diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/i18n.js b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/i18n.js deleted file mode 100644 index 8366268..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/i18n.js +++ /dev/null @@ -1,150 +0,0 @@ -/* - * This file is part of Adblock Plus , - * Copyright (C) 2006-2014 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 . - */ - -var i18n; - -if (typeof ext != "undefined") - i18n = ext.i18n; -else if (typeof chrome != "undefined") - // TODO: This check only exist for backwards compatibility, while the Safari - // port isn't merged into the adblockpluschrome repo. So this branch should - // be removed when the Safari port was merged. - i18n = chrome.i18n; -else -{ - // Using Firefox' approach on i18n instead - - // Randomize URI to work around bug 719376 - var pageName = location.pathname.replace(/.*\//, '').replace(/\..*?$/, ''); - var stringBundle = Services.strings.createBundle("chrome://adblockplus/locale/" + pageName + - ".properties?" + Math.random()); - - function getI18nMessage(key) - { - return { - "message": stringBundle.GetStringFromName(key) - }; - } - - i18n = (function() - { - function getText(message, args) - { - var text = message.message; - var placeholders = message.placeholders; - - if (!args || !placeholders) - return text; - - for (var key in placeholders) - { - var content = placeholders[key].content; - if (!content) - continue; - - var index = parseInt(content.slice(1), 10); - if (isNaN(index)) - continue; - - var replacement = args[index - 1]; - if (typeof replacement === "undefined") - continue; - - text = text.split("$" + key + "$").join(replacement); - } - return text; - } - - return { - getMessage: function(key, args) - { - try{ - var message = getI18nMessage(key); - return getText(message, args); - } - catch(e) - { - Cu.reportError(e); - return "Missing translation: " + key; - } - } - }; - })(); -} - -// Inserts i18n strings into matching elements. Any inner HTML already in the element is -// parsed as JSON and used as parameters to substitute into placeholders in the i18n -// message. -i18n.setElementText = function(element, stringName, arguments) -{ - function processString(str, element) - { - var match = /^(.*?)<(a|strong)>(.*?)<\/\2>(.*)$/.exec(str); - if (match) - { - processString(match[1], element); - - var e = document.createElement(match[2]); - processString(match[3], e); - element.appendChild(e); - - processString(match[4], element); - } - else - element.appendChild(document.createTextNode(str)); - } - - while (element.lastChild) - element.removeChild(element.lastChild); - processString(i18n.getMessage(stringName, arguments), element); -} - -// Loads i18n strings -function loadI18nStrings() -{ - var nodes = document.querySelectorAll("[class^='i18n_']"); - for(var i = 0; i < nodes.length; i++) - { - var node = nodes[i]; - var arguments = JSON.parse("[" + node.textContent + "]"); - if (arguments.length == 0) - arguments = null; - - var className = node.className; - if (className instanceof SVGAnimatedString) - className = className.animVal; - var stringName = className.split(/\s/)[0].substring(5); - - i18n.setElementText(node, stringName, arguments); - } -} - -// Provides a more readable string of the current date and time -function i18n_timeDateStrings(when) -{ - var d = new Date(when); - var timeString = d.toLocaleTimeString(); - - var now = new Date(); - if (d.toDateString() == now.toDateString()) - return [timeString]; - else - return [timeString, d.toLocaleDateString()]; -} - -// Fill in the strings as soon as possible -window.addEventListener("DOMContentLoaded", loadI18nStrings, true); diff --git a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/overlay.xul b/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/overlay.xul deleted file mode 100644 index 90b5b9f..0000000 --- a/helpers/DATA/firefox/gnu/extensions/spyblock@gnu.org/chrome/content/ui/overlay.xul +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - %overlayDTD; - - %subscriptionsDTD; -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -