[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 204/483: Added own About dialog to be used instead of the dialog in Adblock Plus and made homepage localizable

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:41 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 61ed8fb02522a66ea0984085b192cc7f88f647c4
Author: Wladimir Palant <trev at adblockplus.org>
Date:   Thu May 20 12:13:36 2010 +0200

    Added own About dialog to be used instead of the dialog in Adblock Plus and made homepage localizable
---
 chrome/content/about.js             | 130 ++++++++++++++++++++++++++++++++++++
 chrome/content/about.xul            |  73 ++++++++++++++++++++
 chrome/locale/de/meta.properties    |   6 +-
 chrome/locale/en-US/about.dtd       |  15 +++++
 chrome/locale/en-US/meta.properties |   2 +
 chrome/locale/fr/meta.properties    |   1 +
 chrome/locale/ru/meta.properties    |   5 --
 chrome/skin/about.css               |  58 ++++++++++++++++
 install.rdf                         |   4 +-
 9 files changed, 282 insertions(+), 12 deletions(-)

diff --git a/chrome/content/about.js b/chrome/content/about.js
new file mode 100644
index 0000000..ff42075
--- /dev/null
+++ b/chrome/content/about.js
@@ -0,0 +1,130 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Adblock Plus Element Hiding Helper.
+ *
+ * The Initial Developer of the Original Code is
+ * Wladimir Palant.
+ * Portions created by the Initial Developer are Copyright (C) 2006-2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cr = Components.results;
+const Cu = Components.utils;
+
+try
+{
+  Cu.import("resource://gre/modules/AddonManager.jsm");
+}
+catch (e) {}
+
+let addonID = "elemhidehelper at adblockplus.org";
+
+function E(id) document.getElementById(id);
+
+function init()
+{
+  let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
+  if (typeof AddonManager != "undefined")
+  {
+    let addon = AddonManager.getAddonByID(addonID, function(addon)
+    {
+      loadInstallManifest(ioService.newURI(addon.getResourceURL("install.rdf"), null, null));
+    });
+  }
+  else
+  {
+    let extensionManager = Cc["@mozilla.org/extensions/manager;1"].getService(Ci.nsIExtensionManager);
+    let installLocation = extensionManager.getInstallLocation(Utils.addonID);
+    let installManifestFile = installLocation.getItemFile(Utils.addonID, "install.rdf");
+    loadInstallManifest(ioService.newFileURI(installManifestFile));
+  }
+}
+
+function loadInstallManifest(installManifestURI)
+{
+  let rdf = Cc["@mozilla.org/rdf/rdf-service;1"].getService(Ci.nsIRDFService);
+  let ds = rdf.GetDataSource(installManifestURI.spec);
+  let root = rdf.GetResource("urn:mozilla:install-manifest");
+
+  function emResource(prop)
+  {
+    return rdf.GetResource("http://www.mozilla.org/2004/em-rdf#" + prop);
+  }
+
+  function getTargets(prop)
+  {
+    let targets = ds.GetTargets(root, emResource(prop), true);
+    let result = [];
+    while (targets.hasMoreElements())
+      result.push(targets.getNext().QueryInterface(Ci.nsIRDFLiteral).Value);
+    return result;
+  }
+
+  function dataSourceLoaded()
+  {
+    setExtensionData(getTargets("name")[0], getTargets("version")[0],
+                     getTargets("homepageURL")[0], getTargets("creator"),
+                     getTargets("contributor"), getTargets("translator"));
+  }
+
+  if (ds instanceof Ci.nsIRDFRemoteDataSource && ds.loaded)
+    dataSourceLoaded();
+  else
+  {
+    let sink = ds.QueryInterface(Ci.nsIRDFXMLSink);
+    sink.addXMLSinkObserver({
+      onBeginLoad: function() {},
+      onInterrupt: function() {},
+      onResume: function() {},
+      onEndLoad: function() {
+        sink.removeXMLSinkObserver(this);
+        dataSourceLoaded();
+      },
+      onError: function() {},
+    });
+  }
+}
+
+function cmpNoCase(a, b)
+{
+  let aLC = a.toLowerCase();
+  let bLC = b.toLowerCase();
+  if (aLC < bLC)
+    return -1;
+  else if (aLC > bLC)
+    return 1;
+  else
+    return 0;
+}
+
+function setExtensionData(name, version, homepage, authors, contributors, translators)
+{
+  authors.sort(cmpNoCase);
+  contributors.sort(cmpNoCase);
+  translators.sort(cmpNoCase);
+
+  E("title").value = name;
+  E("version").value = version;
+  E("homepage").value = homepage;
+  E("authors").textContent = authors.join(", ");
+  E("contributors").textContent = contributors.join(", ");
+  E("translators").textContent = translators.join(", ");
+
+  E("mainBox").setAttribute("loaded", "true");
+}
diff --git a/chrome/content/about.xul b/chrome/content/about.xul
new file mode 100644
index 0000000..de8c591
--- /dev/null
+++ b/chrome/content/about.xul
@@ -0,0 +1,73 @@
+<!-- ***** BEGIN LICENSE BLOCK *****
+   - Version: MPL 1.1
+   -
+   - The contents of this file are subject to the Mozilla Public License Version
+   - 1.1 (the "License"); you may not use this file except in compliance with
+   - the License. You may obtain a copy of the License at
+   - http://www.mozilla.org/MPL/
+   -
+   - Software distributed under the License is distributed on an "AS IS" basis,
+   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+   - for the specific language governing rights and limitations under the
+   - License.
+   -
+   - The Original Code is Adblock Plus Element Hiding Helper.
+   -
+   - The Initial Developer of the Original Code is
+   - Wladimir Palant.
+   - Portions created by the Initial Developer are Copyright (C) 2006-2010
+   - the Initial Developer. All Rights Reserved.
+   -
+   - Contributor(s):
+   -
+   - ***** END LICENSE BLOCK ***** -->
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://elemhidehelper/skin/about.css" type="text/css"?>
+
+<!DOCTYPE dialog SYSTEM "chrome://elemhidehelper/locale/about.dtd">
+
+<dialog
+  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+  title="&dialog.title;"
+  id="ehhAboutWindow"
+  windowtype="ehh:about"
+  onload="init()"
+  buttons="accept">
+
+<script type="application/x-javascript;version=1.7" src="utils.js"/>
+<script type="application/x-javascript;version=1.7" src="about.js"/>
+
+<vbox id="mainBox">
+  <description id="title" value=" "/>
+  <hbox align="baseline">
+    <label control="version" value="&version.title;"/>
+    <textbox id="version" flex="1" class="plain" readonly="true" tabindex="-1"/>
+  </hbox>
+  
+  <groupbox id="mainGroup" flex="1">
+    <description id="description">
+      &description;
+    </description>
+  
+    <description id="homepageTitle" value="&homepage.label;"/>
+    <description id="homepage" class="text-link" onclick="Utils.loadInBrowser(this.getAttribute('value'))"/>
+  
+    <vbox id="authorsBox" align="top">
+      <label id="authorsTitle" control="authors" value="&author.label;"/>
+      <description id="authors"/>
+    </vbox>
+  
+    <vbox id="contributorsBox" align="top">
+      <label id="contributorsTitle" control="contributors" value="&contributors.label;"/>
+      <description id="contributors"/>
+    </vbox>
+  
+    <vbox id="translatorsBox">
+      <label id="translatorsTitle" control="translators" value="&translators.label;"/>
+      <description id="translators"/>
+    </vbox>
+  </groupbox>
+</vbox>
+
+</dialog>
diff --git a/chrome/locale/de/meta.properties b/chrome/locale/de/meta.properties
index 53cb6a9..40d1dde 100644
--- a/chrome/locale/de/meta.properties
+++ b/chrome/locale/de/meta.properties
@@ -1,10 +1,6 @@
-# Translator of this locale, separate by commas if multiple
 translator=Wladimir Palant
-# Extension title, usually it shouldn't be translated
 name=Element Hiding Helper für Adblock Plus
-# Extension description, to be displayed in the add-on manager
 description=Hilft beim Erstellen von Regeln zum Verstecken von Elementen, um mit Adblock Plus Textwerbung zu bekämpfen.
-# Short description for addons.mozilla.org (250 characters limit!). Leave out the link to English-language video if it isn't useful for users speaking your language.
+homepage=http://adblockplus.org/de/elemhidehelper
 description.short=Weg mit der Textwerbung! Element Hiding Helper ist eine Erweiterung für Adblock Plus, die das Erstellen von Regeln zum Verstecken von Elementen einfacher gestalten soll.
-# Long description for addons.mozilla.org
 description.long=Man wählt einfach das Element aus, das versteckt werden soll, und kreuzt anschließend die Attribute an, anhand derer das Element in Zukunft wiedererkannt und versteckt werden soll. Die Regel für das Verstecken wird automatisch erstellt und in die Filterliste von Adblock Plus eingefügt.
diff --git a/chrome/locale/en-US/about.dtd b/chrome/locale/en-US/about.dtd
new file mode 100644
index 0000000..c04054c
--- /dev/null
+++ b/chrome/locale/en-US/about.dtd
@@ -0,0 +1,15 @@
+<!ENTITY dialog.title       "About Element Hiding Helper">
+
+<!ENTITY version.title      "Version">
+<!ENTITY description        "
+  Element Hiding Helper is a companion extension for Adblock Plus meant to make
+  creating element hiding rules easier. You simply select the element you want
+  to be hidden and then choose which attributes of this element should be taken
+  into account when hiding it in future. The element hiding rule is generated
+  and added automatically.
+">
+
+<!ENTITY homepage.label     "Element Hiding Helper homepage:">
+<!ENTITY author.label       "Author:">
+<!ENTITY contributors.label "Contributors:">
+<!ENTITY translators.label  "Translators:">
diff --git a/chrome/locale/en-US/meta.properties b/chrome/locale/en-US/meta.properties
index 1d8ac59..c2cd8d8 100644
--- a/chrome/locale/en-US/meta.properties
+++ b/chrome/locale/en-US/meta.properties
@@ -4,6 +4,8 @@ translator=Wladimir Palant
 name=Element Hiding Helper for Adblock Plus
 # Extension description, to be displayed in the add-on manager
 description=Helps you create element hiding rules for Adblock Plus to fight the text ads.
+# Homepage URL for About dialog (don't translate if a page for your language doesn't exist on adblockplus.org)
+homepage=http://adblockplus.org/en/elemhidehelper
 # Short description for addons.mozilla.org (250 characters limit!). Leave out the link to English-language video if it isn't useful for users speaking your language.
 description.short=Fight the text ads! Element Hiding Helper is a companion extension for Adblock Plus meant to make creating element hiding rules easier.
 # Long description for addons.mozilla.org
diff --git a/chrome/locale/fr/meta.properties b/chrome/locale/fr/meta.properties
new file mode 100644
index 0000000..eba99ba
--- /dev/null
+++ b/chrome/locale/fr/meta.properties
@@ -0,0 +1 @@
+homepage=http://adblockplus.org/fr/elemhidehelper
diff --git a/chrome/locale/ru/meta.properties b/chrome/locale/ru/meta.properties
index 8ce3a8a..d6cec20 100644
--- a/chrome/locale/ru/meta.properties
+++ b/chrome/locale/ru/meta.properties
@@ -1,10 +1,5 @@
-# Translator of this locale, separate by commas if multiple
 translator=Wladimir Palant
-# Extension title, usually it shouldn't be translated
 name=Element Hiding Helper для Adblock Plus
-# Extension description, to be displayed in the add-on manager
 description=Помогает при создании правил скрытия для Adblock Plus, эффективное средство борьбы с текстовой рекламой.
-# Short description for addons.mozilla.org (250 characters limit!). Leave out the link to English-language video if it isn't useful for users speaking your language.
 description.short=Избавься от текстовой рекламы! Element Hiding Helper расширяет возможности Adblock Plus, упрощая создание правил для скрытия элементов.
-# Long description for addons.mozilla.org
 description.long=Нужно просто выбрать элемент, который надо скрыть, и указать, по каким атрибутам этот элемент нужно в будущем узнавать. Правило для скрытия элемента будет автоматически создано и добавлено в список фильтров Adblock Plus.
diff --git a/chrome/skin/about.css b/chrome/skin/about.css
new file mode 100644
index 0000000..7d1db97
--- /dev/null
+++ b/chrome/skin/about.css
@@ -0,0 +1,58 @@
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is Adblock Plus Element Hiding Helper.
+ *
+ * The Initial Developer of the Original Code is
+ * Wladimir Palant.
+ * Portions created by the Initial Developer are Copyright (C) 2006-2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+ at namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+#mainBox
+{
+  visibility: hidden;
+}
+#mainBox[loaded]
+{
+  visibility: visible;
+}
+
+#title
+{
+  font-size: 200%;
+  font-weight: bold;
+}
+
+#mainGroup
+{
+  margin-top: 15px;
+  width: 550px;
+  height: 400px;
+  overflow: auto;
+}
+
+#homepageTitle, #authorsTitle, #contributorsTitle, #translatorsTitle
+{
+  font-weight: bold;
+}
+
+#description, #homepage, #authorsBox, #contributorsBox
+{
+  margin-bottom: 10px;
+}
diff --git a/install.rdf b/install.rdf
index c632f2f..d67be6b 100644
--- a/install.rdf
+++ b/install.rdf
@@ -10,7 +10,7 @@
   <em:name>{{NAME}}</em:name>
   <em:description>{{DESCRIPTION}}</em:description>
   <em:creator>Wladimir Palant</em:creator>
-  <em:homepageURL>http://adblockplus.org/</em:homepageURL>
+  <em:homepageURL>{{HOMEPAGE}}</em:homepageURL>
   <em:type>2</em:type>
 
   <em:contributor>Rob Brown</em:contributor>
@@ -19,7 +19,7 @@
 
   <!-- Front End Integration Hooks (used by Extension Manager)-->
   <em:iconURL>chrome://adblockplus/skin/adblockplus.png</em:iconURL>
-  <em:aboutURL>chrome://adblockplus/content/ui/about.xul</em:aboutURL>
+  <em:aboutURL>chrome://elemhidehelper/content/about.xul</em:aboutURL>
   
   <!-- Target Application this extension can install into, 
     with minimum and maximum supported versions. --> 

-- 
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