[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 383/483: Removed default JavaScript files, these are added by build tools now
David Prévot
taffit at moszumanska.debian.org
Thu Jan 22 21:41:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus-element-hiding-helper.
commit 8218d879faf803555d21bad38b030ff55f4c49b8
Author: Wladimir Palant <trev at adblockplus.org>
Date: Sat Jan 21 22:00:41 2012 +0100
Removed default JavaScript files, these are added by build tools now
---
bootstrap.js | 95 ------------------------------
keySelector.js | 182 ---------------------------------------------------------
prefs.js | 170 -----------------------------------------------------
3 files changed, 447 deletions(-)
diff --git a/bootstrap.js b/bootstrap.js
deleted file mode 100644
index e77801e..0000000
--- a/bootstrap.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * This Source Code is subject to the terms of the Mozilla Public License
- * version 2.0 (the "License"). You can obtain a copy of the License at
- * http://mozilla.org/MPL/2.0/.
- */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-let addonData = null;
-
-function install(params, reason) {}
-function uninstall(params, reason) {}
-
-function startup(params, reason)
-{
- if (Services.vc.compare(Services.appinfo.platformVersion, "10.0") < 0)
- Components.manager.addBootstrappedManifestLocation(params.installPath);
-
- addonData = params;
- Services.obs.addObserver(RequireObserver, "elemhidehelper-require", true);
-
- require("appIntegration").AppIntegration.init();
-}
-
-function shutdown(params, reason)
-{
- require("appIntegration").AppIntegration.shutdown();
-
- let aboutWnd = Services.wm.getMostRecentWindow("ehh:about");
- if (aboutWnd)
- aboutWnd.close();
-
- while (true)
- {
- let helperWnd = Services.wm.getMostRecentWindow("ehh:composer");
- if (!helperWnd)
- break;
- helperWnd.close();
- }
-
- Services.obs.removeObserver(RequireObserver, "elemhidehelper-require");
- addonData = null;
- require.scopes = {__proto__: null};
-
- if (Services.vc.compare(Services.appinfo.platformVersion, "10.0") < 0)
- Components.manager.removeBootstrappedManifestLocation(params.installPath);
-}
-
-function require(module)
-{
- let scopes = require.scopes;
- if (!(module in scopes))
- {
- if (module == "info")
- {
- scopes[module] = {};
- scopes[module].exports =
- {
- addonID: addonData.id,
- addonVersion: addonData.version,
- addonRoot: addonData.resourceURI.spec,
- };
- }
- else
- {
- scopes[module] = {require: require, unrequire: unrequire, exports: {}};
- Services.scriptloader.loadSubScript(addonData.resourceURI.spec + module + ".js", scopes[module]);
- }
- }
- return scopes[module].exports;
-}
-require.scopes = {__proto__: null};
-
-function unrequire(module)
-{
- delete require.scopes[module];
-}
-
-let RequireObserver =
-{
- observe: function(subject, topic, data)
- {
- if (topic == "elemhidehelper-require")
- {
- subject.wrappedJSObject.exports = require(data);
- }
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObserver])
-};
diff --git a/keySelector.js b/keySelector.js
deleted file mode 100644
index 3d57cb8..0000000
--- a/keySelector.js
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * This Source Code is subject to the terms of the Mozilla Public License
- * version 2.0 (the "License"). You can obtain a copy of the License at
- * http://mozilla.org/MPL/2.0/.
- */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-/**
- * Translation table for key modifier names.
- */
-let validModifiers =
-{
- ACCEL: "control",
- CTRL: "control",
- CONTROL: "control",
- SHIFT: "shift",
- ALT: "alt",
- META: "meta",
- __proto__: null
-};
-
-let existingShortcuts = null;
-
-/**
- * Sets the correct value of validModifiers.ACCEL.
- */
-function initAccelKey()
-{
- try
- {
- let accelKey = Services.prefs.getIntPref("ui.key.accelKey");
- if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_CONTROL)
- validModifiers.ACCEL = "control";
- else if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_ALT)
- validModifiers.ACCEL = "alt";
- else if (accelKey == Ci.nsIDOMKeyEvent.DOM_VK_META)
- validModifiers.ACCEL = "meta";
- }
- catch(e)
- {
- Cu.reportError(e);
- }
-}
-
-/**
- * Finds out which keyboard shortcuts are already taken in an application window,
- * converts them to canonical form in the existingShortcuts variable.
- */
-function initExistingShortcuts(/**ChromeWindow*/ window)
-{
- existingShortcuts = {__proto__: null};
-
- let keys = window.document.getElementsByTagName("key");
- for (let i = 0; i < keys.length; i++)
- {
- let key = keys[i];
- let keyData =
- {
- shift: false,
- meta: false,
- alt: false,
- control: false,
- char: null,
- code: null
- };
-
- let keyChar = key.getAttribute("key");
- if (keyChar && keyChar.length == 1)
- keyData.char = keyChar.toUpperCase();
-
- let keyCode = key.getAttribute("keycode");
- if (keyCode && "DOM_" + keyCode.toUpperCase() in Ci.nsIDOMKeyEvent)
- keyData.code = Ci.nsIDOMKeyEvent["DOM_" + keyCode.toUpperCase()];
-
- if (!keyData.char && !keyData.code)
- continue;
-
- let keyModifiers = key.getAttribute("modifiers");
- if (keyModifiers)
- for each (let modifier in keyModifiers.toUpperCase().match(/\w+/g))
- if (modifier in validModifiers)
- keyData[validModifiers[modifier]] = true;
-
- let canonical = [keyData.shift, keyData.meta, keyData.alt, keyData.control, keyData.char || keyData.code].join(" ");
- existingShortcuts[canonical] = true;
- }
-}
-
-/**
- * Creates the text representation for a key.
- */
-function getTextForKey(/**Object*/ keyData) /**String*/
-{
- try
- {
- let stringBundle = Services.strings.createBundle("chrome://global-platform/locale/platformKeys.properties");
- let parts = [];
- if (keyData.control)
- parts.push(stringBundle.GetStringFromName("VK_CONTROL"));
- if (keyData.alt)
- parts.push(stringBundle.GetStringFromName("VK_ALT"));
- if (keyData.meta)
- parts.push(stringBundle.GetStringFromName("VK_META"));
- if (keyData.shift)
- parts.push(stringBundle.GetStringFromName("VK_SHIFT"));
- if (keyData.char)
- parts.push(keyData.char.toUpperCase());
- else
- {
- let stringBundle2 = Services.strings.createBundle("chrome://global/locale/keys.properties");
- parts.push(stringBundle2.GetStringFromName(keyData.codeName));
- }
- return parts.join(stringBundle.GetStringFromName("MODIFIER_SEPARATOR"));
- }
- catch (e)
- {
- Cu.reportError(e);
- return null;
- }
-}
-
-exports.selectKey = selectKey;
-
-/**
- * Selects a keyboard shortcut variant that isn't already taken in the window,
- * parses it into an object.
- */
-function selectKey(/**ChromeWindow*/ window, /**String*/ variants) /**Object*/
-{
- if (!existingShortcuts)
- {
- initAccelKey();
- initExistingShortcuts(window);
- }
-
- for each (let variant in variants.split(/\s*,\s*/))
- {
- if (!variant)
- continue;
-
- let keyData =
- {
- shift: false,
- meta: false,
- alt: false,
- control: false,
- char: null,
- code: null,
- codeName: null,
- text: null
- };
- for each (let part in variant.toUpperCase().split(/\s+/))
- {
- if (part in validModifiers)
- keyData[validModifiers[part]] = true;
- else if (part.length == 1)
- keyData.char = part;
- else if ("DOM_VK_" + part in Ci.nsIDOMKeyEvent)
- {
- keyData.code = Ci.nsIDOMKeyEvent["DOM_VK_" + part];
- keyData.codeName = "VK_" + part;
- }
- }
-
- if (!keyData.char && !keyData.code)
- continue;
-
- let canonical = [keyData.shift, keyData.meta, keyData.alt, keyData.control, keyData.char || keyData.code].join(" ");
- if (canonical in existingShortcuts)
- continue;
-
- keyData.text = getTextForKey(keyData);
- return keyData;
- }
-
- return null;
-}
diff --git a/prefs.js b/prefs.js
deleted file mode 100644
index 06761b9..0000000
--- a/prefs.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * This Source Code is subject to the terms of the Mozilla Public License
- * version 2.0 (the "License"). You can obtain a copy of the License at
- * http://mozilla.org/MPL/2.0/.
- */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-let {addonRoot} = require("info");
-
-let Prefs = exports.Prefs =
-{
- branch: null,
- ignorePrefChanges: false,
-
- init: function(branchName, migrate)
- {
- if (this.branch)
- return;
- this.branch = Services.prefs.getBranch(branchName);
-
- /**
- * Sets up getter/setter on Prefs object for preference.
- */
- function defineProperty(/**String*/ name, defaultValue, /**Function*/ readFunc, /**Function*/ writeFunc)
- {
- let value = defaultValue;
- this["_update_" + name] = function()
- {
- try
- {
- value = readFunc(this.branch, name);
- }
- catch(e)
- {
- Cu.reportError(e);
- }
- };
- Prefs.__defineGetter__(name, function() value);
- Prefs.__defineSetter__(name, function(newValue)
- {
- if (value == newValue)
- return value;
-
- try
- {
- this.ignorePrefChanges = true;
- writeFunc(this.branch, name, newValue);
- value = newValue;
- }
- catch(e)
- {
- Cu.reportError(e);
- }
- finally
- {
- this.ignorePrefChanges = false;
- }
- return value;
- });
- this["_update_" + name]();
- }
-
- // Load default preferences and set up properties for them
- let defaultBranch = Services.prefs.getDefaultBranch(branchName);
- let typeMap =
- {
- boolean: [getBoolPref, setBoolPref],
- number: [getIntPref, setIntPref],
- string: [getCharPref, setCharPref],
- object: [getJSONPref, setJSONPref]
- };
- let scope =
- {
- pref: function(pref, value)
- {
- if (pref.substr(0, branchName.length) != branchName)
- {
- Cu.reportError(new Error("Ignoring default preference " + pref + ", wrong branch."));
- return;
- }
- pref = pref.substr(branchName.length);
-
- let [getter, setter] = typeMap[typeof value];
- setter(defaultBranch, pref, value);
- defineProperty.call(Prefs, pref, false, getter, setter);
- }
- };
- Services.scriptloader.loadSubScript(addonRoot + "defaults/preferences/prefs.js", scope);
-
- // Add preference change observer
- try
- {
- this.branch.QueryInterface(Ci.nsIPrefBranch2)
- .addObserver("", this, true);
- }
- catch (e)
- {
- Cu.reportError(e);
- }
-
- // Migrate preferences stored under outdated names
- if (migrate)
- {
- for (let oldName in migrate)
- {
- let newName = migrate[oldName];
- if (newName in this && Services.prefs.prefHasUserValue(oldName))
- {
- let [getter, setter] = typeMap[typeof this[newName]];
- try
- {
- this[newName] = getter(Services.prefs, oldName);
- } catch(e) {}
- Services.prefs.clearUserPref(oldName);
- }
- }
- }
- },
-
- shutdown: function()
- {
- if (!this.branch)
- return;
-
- try
- {
- this.branch.QueryInterface(Ci.nsIPrefBranch2)
- .removeObserver("", this);
- }
- catch (e)
- {
- Cu.reportError(e);
- }
- this.branch = null;
- },
-
- observe: function(subject, topic, data)
- {
- if (this.ignorePrefChanges || topic != "nsPref:changed")
- return;
-
- if ("_update_" + data in this)
- this["_update_" + data]();
- },
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference, Ci.nsIObserver])
-};
-
-function getIntPref(branch, pref) branch.getIntPref(pref)
-function setIntPref(branch, pref, newValue) branch.setIntPref(pref, newValue)
-
-function getBoolPref(branch, pref) branch.getBoolPref(pref)
-function setBoolPref(branch, pref, newValue) branch.setBoolPref(pref, newValue)
-
-function getCharPref(branch, pref) branch.getComplexValue(pref, Ci.nsISupportsString).data
-function setCharPref(branch, pref, newValue)
-{
- let str = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
- str.data = newValue;
- branch.setComplexValue(pref, Ci.nsISupportsString, str);
-}
-
-function getJSONPref(branch, pref) JSON.parse(getCharPref(branch, pref))
-function setJSONPref(branch, pref, newValue) setCharPref(branch, pref, JSON.stringify(newValue))
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus-element-hiding-helper.git
More information about the Pkg-mozext-commits
mailing list