[Pkg-mozext-commits] [adblock-plus-element-hiding-helper] 01/483: Element Hiding Helper: initial release

David Prévot taffit at moszumanska.debian.org
Thu Jan 22 21:41:21 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 cec18844241fa5f4a84fb756daffb7c6b1238e03
Author: Wladimir Palant <trev at gtchat.de>
Date:   Sun Jan 7 23:06:36 2007 +0000

    Element Hiding Helper: initial release
    
    --HG--
    extra : convert_revision : svn%3Ad8bf93c1-8190-44a8-bb31-1ea94378a4df/trunk%40598
---
 chrome.manifest                        |   8 +
 chrome/content/aardvark.js             | 597 +++++++++++++++++++++++++++++++++
 chrome/content/composer.js             | 239 +++++++++++++
 chrome/content/composer.xul            |  66 ++++
 chrome/content/contents.rdf            |  35 ++
 chrome/content/overlay.js              |  68 ++++
 chrome/content/overlay.xul             |  60 ++++
 chrome/locale/en-US/composer.dtd       |  31 ++
 chrome/locale/en-US/contents.rdf       |  19 ++
 chrome/locale/en-US/global.properties  |  14 +
 chrome/locale/en-US/overlay.dtd        |  29 ++
 chrome/skin/classic/composer.css       |  29 ++
 chrome/skin/classic/contents.rdf       |  18 +
 chrome/skin/classic/overlay.css        |  44 +++
 create_xpi.pl                          |  28 ++
 defaults/preferences/elemhidehelper.js |   2 +
 install.js                             |  56 ++++
 install.rdf                            | 100 ++++++
 make_devbuild.pl                       |  15 +
 version                                |   1 +
 20 files changed, 1459 insertions(+)

diff --git a/chrome.manifest b/chrome.manifest
new file mode 100644
index 0000000..91a2849
--- /dev/null
+++ b/chrome.manifest
@@ -0,0 +1,8 @@
+overlay   chrome://browser/content/browser.xul chrome://elemhidehelper/content/overlay.xul
+overlay   chrome://navigator/content/navigator.xul chrome://elemhidehelper/content/overlay.xul
+overlay   chrome://messenger/content/mailWindowOverlay.xul chrome://elemhidehelper/content/overlay.xul
+overlay   chrome://rubberducky/content/xul/mainwin.xul chrome://elemhidehelper/content/overlay.xul
+content   elemhidehelper jar:chrome/elemhidehelper.jar!/content/
+skin      elemhidehelper classic/1.0 jar:chrome/elemhidehelper.jar!/skin/classic/
+locale    elemhidehelper {{LOCALE}} jar:chrome/elemhidehelper.jar!/locale/{{LOCALE}}/
+
diff --git a/chrome/content/aardvark.js b/chrome/content/aardvark.js
new file mode 100644
index 0000000..71b5fa3
--- /dev/null
+++ b/chrome/content/aardvark.js
@@ -0,0 +1,597 @@
+/* ***** 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 Aardvark Firefox extension.
+ *
+ * The Initial Developer of the Original Code is
+ * Rob Brown.
+ * Portions created by the Initial Developer are Copyright (C) 2006
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Wladimir Palant
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+/**********************************
+ * General element selection code *
+ **********************************/
+
+var ehhAardvark = {
+  wnd: null,
+  selectedElem: null,
+  mouseX: -1,
+  mouseY: -1,
+  commandLabelTimeout: 0
+};
+
+ehhAardvark.start = function(wnd) {
+  wnd.addEventListener("click", this.mouseClick, false);
+  wnd.addEventListener("mouseover", this.mouseOver, false);
+  wnd.addEventListener("keypress", this.keyPress, false);
+  wnd.addEventListener("pagehide", this.pageHide, false);
+  getBrowser().selectedBrowser.addEventListener("mousemove", this.mouseMove, false);
+
+  this.wnd = wnd;
+
+  this.makeElems();
+  this.showMenu();
+}
+
+ehhAardvark.doCommand = function(command, event) {
+  if (this[command](this.selectedElem)) {
+    this.showCommandLabel(this.commands[command + "_key"], this.commands[command + "_label"]);
+    if (event) {
+      event.stopPropagation();
+      event.preventDefault();
+    }
+  }
+}
+
+ehhAardvark.showCommandLabel = function(key, label) {
+  if (this.commandLabelTimeout)
+    clearTimeout(this.commandLabelTimeout);
+
+  document.getElementById("ehh-commandlabel-key").setAttribute("value", key);
+  document.getElementById("ehh-commandlabel-label").setAttribute("value", label);
+
+  var commandLabel = document.getElementById("ehh-commandlabel");
+  commandLabel.showPopup(getBrowser(), this.mouseX, this.mouseY, "tooltip", "topleft", "topleft");
+
+  this.commandLabelTimeout = setTimeout(function() {
+    commandLabel.hidePopup();
+    ehhAardvark.commandLabelTimeout = 0;
+  }, 400);
+}
+
+ehhAardvark.onMouseClick = function(event) {
+  if (event.button != 0 || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)
+    return;
+
+  this.doCommand("select", event);
+}
+
+ehhAardvark.onMouseOver = function(event) {
+  var elem = event.target;
+  if (elem.ehhAardvarkLabel)
+    return;
+
+  if (elem == null)
+  {
+    this.clearBox ();
+    return;
+  }
+
+  if (elem == this.selectedElem)
+    return;
+  
+  this.showBoxAndLabel (elem, this.makeElementLabelString (elem));
+}
+
+ehhAardvark.onKeyPress = function(event) {
+  if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey)
+    return;
+
+  var command = null;
+  if (event.keyCode == event.DOM_VK_ESCAPE)
+    command = "quit";
+  else if (event.keyCode == event.DOM_VK_RETURN)
+    command = "select";
+  else if (event.charCode) {
+    var key = String.fromCharCode(event.charCode).toLowerCase();
+    var commands = this.commands;
+    for (var i = 0; i < commands.length; i++)
+      if (commands[commands[i] + "_key"] == key)
+        command = commands[i];
+  }
+
+  if (command)
+    this.doCommand(command, event);
+}
+
+ehhAardvark.onPageHide = function(event) {
+  this.doCommand("quit", null);
+}
+
+ehhAardvark.onMouseMove = function(event) {
+  this.mouseX = event.screenX;
+  this.mouseY = event.screenY;
+}
+
+// Makes sure event handlers like ehhAardvark.keyPress redirect
+// to the real handlers (ehhAardvark.onKeyPress in this case) with
+// correct this pointer.
+ehhAardvark.generateEventHandlers = function(handlers) {
+  var generator = function(handler) {
+    return function(event) {ehhAardvark[handler](event)};
+  };
+
+  for (var i = 0; i < handlers.length; i++) {
+    var handler = "on" + handlers[i][0].toUpperCase() + handlers[i].substr(1);
+    this[handlers[i]] = generator(handler);
+  }
+}
+ehhAardvark.generateEventHandlers(["mouseClick", "mouseOver", "keyPress", "pageHide", "mouseMove"]);
+
+/***************************
+ * Highlight frame display *
+ ***************************/
+
+//-------------------------------------------------
+// create the box and tag etc (done once and saved)
+ehhAardvark.makeElems = function ()
+{
+  this.borderElems = [];
+  var d, i;
+
+  for (i=0; i<4; i++)
+  {
+    d = this.wnd.document.createElement ("div");
+    d.style.display = "none";
+    d.style.overflow = "hidden";
+    d.style.position = "absolute";
+    d.style.height = "0px";
+    d.style.width = "0px";
+    d.style.zIndex = "65534";
+    if (i < 2)
+      d.style.borderTop = "2px solid #f00";
+    else
+      d.style.borderLeft = "2px solid #f00";
+    d.ehhAardvarkLabel = true; // mark as ours
+    this.borderElems[i] = d;
+    this.wnd.document.body.appendChild (d);
+  }
+
+  d = this.wnd.document.createElement ("div");
+  this.setElementStyleDefault (d, "#fff0cc");
+  d.ehhAardvarkLabel = true; // mark as ours
+  d.style.borderTopWidth = "0";
+  d.style.MozBorderRadiusBottomleft = "6px";
+  d.style.MozBorderRadiusBottomright = "6px";
+  d.style.zIndex = "65535";
+  d.style.visibility = "hidden";
+  this.wnd.document.body.appendChild (d);
+  this.labelElem = d;
+}
+
+ehhAardvark.makeElementLabelString = function(elem) {
+  var s = "<b style='color:#000'>" + elem.tagName.toLowerCase() + "</b>";
+  if (elem.id != '')
+    s += ", id: " + elem.id;
+  if (elem.className != '')
+    s += ", class: " + elem.className;
+  /*for (var i in elem.style)
+    if (elem.style[i] != '')
+      s += "<br> " + i + ": " + elem.style[i]; */
+  if (elem.style.cssText != '')
+    s += ", style: " + elem.style.cssText;
+    
+  return s;
+}
+
+ehhAardvark.showBoxAndLabel = function(elem, string) {
+  this.selectedElem = elem;
+
+  var pos = this.getPos(elem)
+  var dims = this.getWindowDimensions ();
+  var y = pos.y;
+
+  this.borderElems[0].style.left
+    = this.borderElems[1].style.left
+    = this.borderElems[2].style.left
+    = (pos.x - 1) + "px";
+  this.borderElems[3].style.left = (pos.x + elem.offsetWidth - 1) + "px";
+
+  this.borderElems[0].style.width
+    = this.borderElems[1].style.width
+    = (elem.offsetWidth + 2) + "px";
+
+  this.borderElems[2].style.height
+    = this.borderElems[3].style.height
+    = (elem.offsetHeight + 2) + "px";
+
+  this.borderElems[0].style.top
+    = this.borderElems[2].style.top
+    = this.borderElems[3].style.top
+    = (pos.y - 1) + "px";
+  this.borderElems[1].style.top = (pos.y + elem.offsetHeight - 1) + "px";
+  
+  this.borderElems[0].style.display
+    = this.borderElems[1].style.display
+    = this.borderElems[2].style.display
+    = this.borderElems[3].style.display
+    = "";
+  
+  var y = pos.y + elem.offsetHeight + 1;
+  
+  this.labelElem.innerHTML = string;
+  this.labelElem.style.display = "";
+
+  // adjust the label as necessary to make sure it is within screen and
+  // the border is pretty
+  if ((y + this.labelElem.offsetHeight) >= dims.scrollY + dims.height)
+  {
+    this.labelElem.style.borderTopWidth = "1px";
+    this.labelElem.style.MozBorderRadiusTopleft = "6px";
+    this.labelElem.style.MozBorderRadiusTopright = "6px";
+    this.labelDrawnHigh = true;
+    y = (dims.scrollY + dims.height) - this.labelElem.offsetHeight;
+  }
+  else if (this.labelElem.offsetWidth > elem.offsetWidth)
+  {
+    this.labelElem.style.borderTopWidth = "1px";
+    this.labelElem.style.MozBorderRadiusTopright = "6px";
+    this.labelDrawnHigh = true;
+  }
+  else if (this.labelDrawnHigh)
+  {
+    this.labelElem.style.borderTopWidth = "0";
+    this.labelElem.style.MozBorderRadiusTopleft = "";
+    this.labelElem.style.MozBorderRadiusTopright = "";
+    delete (this.labelDrawnHigh); 
+  }
+  this.moveElem (this.labelElem, pos.x+2, y);
+  this.labelElem.style.visibility = "visible";
+}
+
+ehhAardvark.clearBox = function() {
+  this.selectedElem = null;
+  if ("borderElems" in this)
+  {
+    for (var i = 0; i < this.borderElems.length; i++)
+      this.borderElems[i].style.display = "none";
+    this.labelElem.style.display = "none";
+    this.labelElem.style.visibility = "hidden";
+  }
+}
+
+ehhAardvark.getPos = function (elem)
+{
+  var pos = {x: 0, y: 0};
+
+  while (elem)
+  {
+    pos.x += elem.offsetLeft;
+    pos.y += elem.offsetTop;
+    elem = elem.offsetParent;
+  }
+  return pos;
+}
+
+ehhAardvark.getWindowDimensions = function ()
+{
+  var out = {};
+
+  var doc = this.wnd.document;
+  out.scrollX = doc.body.scrollLeft + doc.documentElement.scrollLeft; 
+  out.scrollY = doc.body.scrollTop + doc.documentElement.scrollTop;
+
+  if (doc.compatMode == "BackCompat")
+  {
+    out.width = doc.body.clientWidth;
+    out.height = doc.body.clientHeight;
+  }
+  else
+  {
+    out.width = doc.documentElement.clientWidth;
+    out.height = doc.documentElement.clientHeight;
+  }
+  return out;
+}
+
+// move a div (or whatever) to an x y location
+ehhAardvark.moveElem = function (elem, x, y)
+{
+  elem = elem.style;
+  
+  elem.left = x + "px";
+  elem.top = y + "px";     
+}
+
+ehhAardvark.setElementStyleDefault = function (elem, bgColor)
+{
+  var s = elem.style;
+  s.display = "none";
+  s.backgroundColor = bgColor;
+  s.borderColor = "black";
+  s.borderWidth = "1px 2px 2px 1px";
+  s.borderStyle = "solid";
+  s.fontFamily = "arial";
+  s.textAlign = "left";
+  s.color = "#000";
+  s.fontSize = "12px";
+  s.position = "absolute";
+  s.paddingTop = "2px";
+  s.paddingBottom = "2px";
+  s.paddingLeft = "5px";
+  s.paddingRight = "5px";
+}
+
+/*********************************
+ * Code from aardvarkCommands.js *
+ *********************************/
+
+//------------------------------------------------------------
+// 0: name, 1: needs element
+ehhAardvark.commands = [
+  "select",
+  "wider",
+  "narrower",
+  "quit",
+  "blinkElement",
+  //"viewSource",
+  "showMenu"
+];
+
+//------------------------------------------------------------
+ehhAardvark.wider = function (elem)
+{
+  if (elem && elem.parentNode)
+  {
+    var newElem = elem.parentNode;
+    if (!newElem)
+      return false;
+    
+    if (this.widerStack && this.widerStack.length>0 && 
+      this.widerStack[this.widerStack.length-1] == elem)
+    {
+      this.widerStack.push (newElem);
+    }
+    else
+    {
+      this.widerStack = [elem, newElem];
+    }
+    this.showBoxAndLabel (newElem, 
+        this.makeElementLabelString (newElem));
+    return true;
+  }
+  return false;
+} 
+
+//------------------------------------------------------------
+ehhAardvark.narrower = function (elem)
+{
+  if (elem)
+  {
+    if (this.widerStack && this.widerStack.length>1 && 
+      this.widerStack[this.widerStack.length-1] == elem)
+    {
+      this.widerStack.pop();
+      newElem = this.widerStack[this.widerStack.length-1];
+      this.showBoxAndLabel (newElem, 
+          this.makeElementLabelString (newElem));
+      return true;
+    }
+  }
+  return false;
+}
+  
+//------------------------------------------------------------
+ehhAardvark.quit = function ()
+{
+  if (!this.wnd)
+    return false;
+
+  this.clearBox();
+  document.getElementById("ehh-helpbox").hidePopup();
+  
+  this.wnd.removeEventListener("click", this.mouseClick, false);
+  this.wnd.removeEventListener("mouseover", this.mouseOver, false);
+  this.wnd.removeEventListener("keypress", this.keyPress, false);
+  this.wnd.removeEventListener("pagehide", this.pageHide, false);
+  getBrowser().selectedBrowser.removeEventListener("mousemove", this.mouseMove, false);
+
+  this.selectedElem = null;
+  this.wnd = null;
+  delete this.widerStack;
+  delete this.borderElems;
+  delete this.labelElem;
+  return true;
+}
+
+//------------------------------------------------------------
+ehhAardvark.select = function (elem)
+{
+  if (!elem || !this.quit())
+    return false;
+
+  window.openDialog("chrome://elemhidehelper/content/composer.xul", "_blank",
+                    "chrome,centerscreen,resizable,dialog=no", elem);
+  return true;
+}
+
+//------------------------------------------------------------
+ehhAardvark.blinkElement = function (elem)
+{
+  if (!elem)
+    return false;
+
+  if ("blinkInterval" in this)
+    this.stopBlinking();
+
+  var counter = 0;
+  this.blinkElem = elem;
+  this.blinkOrigValue = elem.style.visibility;
+  this.blinkInterval = setInterval(function() {
+    counter++;
+    elem.style.visibility = (counter % 2 == 0 ? "visible" : "hidden");
+    if (counter == 6)
+      ehhAardvark.stopBlinking();
+  }, 250);
+
+  return true;
+}
+ehhAardvark.stopBlinking = function() {
+  clearInterval(this.blinkInterval);
+  this.blinkElem.style.visibility = this.blinkOrigValue;
+
+  delete this.blinkElem;
+  delete this.blinkOrigValue;
+  delete this.blinkInterval;
+}
+
+//------------------------------------------------------------
+ehhAardvark.viewSource = function (elem)
+{
+  if (!elem)
+    return false;
+
+  var dbox = new DBox ("#fff", true);
+  dbox.innerContainer.innerHTML = this.getOuterHtmlFormatted(elem);
+  dbox.show ();
+  return true;
+}
+
+//--------------------------------------------------------
+ehhAardvark.getOuterHtmlFormatted = function (node)
+{
+  var str = "";
+  
+  if (document.all)
+  {
+    return "<textarea style='width:100%; height:100%'>" + node.outerHTML + "</textarea>"; 
+  }
+
+  switch (node.nodeType)
+  {
+    case 1: // ELEMENT_NODE
+    {
+      if (node.style.display == 'none')
+        break;
+      var isLeaf = (node.childNodes.length == 0 && leafElems[node.nodeName]);
+      var isTbody = (node.nodeName == "TBODY" && node.attributes.length == 0);
+      
+      if (isTbody)
+      {
+        for (var i=0; i<node.childNodes.length; i++)
+          str += this.getOuterHtmlFormatted(node.childNodes.item(i));
+      }
+      else
+      {
+        if (!isLeaf)
+          str += "<div style='border: 1px solid #cccccc; border-right: 0;" +
+            "margin-left: 10px; margin-right: 0; overflow: hidden'>";
+        str += "<<span style='color:red;font-weight:bold'>" +
+              node.nodeName.toLowerCase() + "</span>";
+        for (var i=0; i<node.attributes.length; i++) 
+        {
+          if (node.attributes.item(i).nodeValue != null &&
+            node.attributes.item(i).nodeValue != '')
+          {
+            str += " <span style='color:green;'>"
+            str += node.attributes.item(i).nodeName;
+            str += "</span>='<span style='color:blue;'>";
+            str += node.attributes.item(i).nodeValue;
+            str += "</span>'";
+          }
+        }
+        if (isLeaf)
+          str += " /><br>";
+        else 
+        {
+          str += "><br>";
+          
+          for (var i=0; i<node.childNodes.length; i++)
+            str += this.getOuterHtmlFormatted(node.childNodes.item(i));
+          
+          str += "</<span style='color:red;font-weight:bold'>" +
+            node.nodeName.toLowerCase() + "</span>></div>"
+        }
+      }
+    }
+    break;
+        
+    case 3: //TEXT_NODE
+      if (node.nodeValue != '' && node.nodeValue != '\n' 
+          && node.nodeValue != '\r\n' && node.nodeValue != ' ')
+        str += node.nodeValue + "<br>";
+      break;
+      
+    case 4: // CDATA_SECTION_NODE
+      str += "<![CDATA[" + node.nodeValue + "]]><br>";
+      break;
+          
+    case 5: // ENTITY_REFERENCE_NODE
+      str += "&" + node.nodeName + ";<br>"
+      break;
+  
+    case 8: // COMMENT_NODE
+      str += "<!--" + node.nodeValue + "--><br>"
+      break;
+  }
+  
+  return str;
+}
+
+//-------------------------------------------------
+ehhAardvark.showMenu = function ()
+{
+  var helpBox = document.getElementById("ehh-helpbox");
+  if (helpBox.getAttribute("_moz-menuactive") == "true") {
+    helpBox.hidePopup();
+    return true;
+  }
+
+  var helpBoxRows = document.getElementById("ehh-helpbox-rows");
+  if (!helpBoxRows.firstChild) {
+    // Help box hasn't been filled yet, need to do it now
+    var stringService = Components.classes["@mozilla.org/intl/stringbundle;1"]
+                                  .getService(Components.interfaces.nsIStringBundleService);
+    var strings = stringService.createBundle("chrome://elemhidehelper/locale/global.properties");
+
+    for (var i = 0; i < this.commands.length; i++) {
+      var command = this.commands[i];
+      var key = strings.GetStringFromName("command." + command + ".key");
+      var label = strings.GetStringFromName("command." + command + ".label");
+      this.commands[command + "_key"] = key.toLowerCase();
+      this.commands[command + "_label"] = label;
+
+      var row = document.createElement("row");
+      helpBoxRows.appendChild(row);
+
+      var element = document.createElement("description");
+      element.setAttribute("value", key);
+      element.className = "key";
+      row.appendChild(element);
+
+      element = document.createElement("description");
+      element.setAttribute("value", label);
+      element.className = "label";
+      row.appendChild(element);
+    }
+  }
+
+  // Show help box
+  helpBox.showPopup(getBrowser().selectedBrowser, -1, -1, "tooltip", "topright", "topright");
+  return true;
+}
diff --git a/chrome/content/composer.js b/chrome/content/composer.js
new file mode 100644
index 0000000..12fb34e
--- /dev/null
+++ b/chrome/content/composer.js
@@ -0,0 +1,239 @@
+/* ***** 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
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+var domainData;
+var nodeData;
+var selectedNode = null;
+
+function NodeData(node, parentNode) {
+  this.tagName = {value: node.tagName, checked: false};
+
+  if (typeof parentNode == "undefined")
+    parentNode = (node.parentNode && node.parentNode.nodeType == node.ELEMENT_NODE ? new NodeData(node.parentNode) : null);
+  this.parentNode = parentNode;
+
+  var prevSibling = node.prevSibling;
+  while (prevSibling && prevSibling.nodeType != node.ELEMENT_NODE)
+    prevSibling = prevSibling.prevSibling;
+  this.prevSibling = (prevSibling ? new NodeData(prevSibling, this.parentNode) : null);
+
+  this.attributes = [];
+  for (var i = 0; i < node.attributes.length; i++) {
+    var attribute = node.attributes[i];
+    var data = {name: attribute.name, value: attribute.value, selected: attribute.value, checked: false};
+    if (data.name == "id" || data.name == "class")
+      this.attributes.unshift(data);
+    else
+      this.attributes.push(data);
+  }
+
+  if (this.attributes.length >= 2 && this.attributes[1].name == "id") {
+    // Make sure ID attribute comes first
+    var tmp = this.attributes[1];
+    this.attributes[1] = this.attributes[0];
+    this.attributes[0] = tmp;
+  }
+
+  this.customCSS = {selected: "", checked: false};
+}
+
+function init() {
+  var element = window.arguments[0];
+  var wnd = element.ownerDocument.defaultView;
+
+  nodeData = new NodeData(element);
+  nodeData.tagName.checked = true;
+  if (nodeData.attributes.length > 0) {
+    if (nodeData.attributes[0].name == "id" || nodeData.attributes[0].name == "class") {
+      nodeData.attributes[0].selected = nodeData.attributes[0].value;
+      nodeData.attributes[0].checked = true;
+    }
+    else {
+      var maxLen = 0;
+      var bestAttr = null;
+      for (var i = 0; i < nodeData.attributes.length; i++) {
+        if (nodeData.attributes[i].value.length > maxLen) {
+          maxLen = nodeData.attributes[i].value.length;
+          bestAttr = nodeData.attributes[i];
+        }
+      }
+      if (bestAttr) {
+        bestAttr.selected = bestAttr.value;
+        bestAttr.checked = true;
+      }
+    }
+  }
+
+  var domain = wnd.location.host;
+  var selectedDomain = domain.replace(/^www\./, "");
+  domainData = {value: domain, selected: selectedDomain};
+
+  updateExpression();
+
+  setTimeout(function() {
+    fillAttributes(nodeData);
+    fillDomains(domainData);
+    document.getElementById("domainGroup").selectedItem.focus();
+  }, 0);
+}
+
+function updateExpression() {
+  var curNode = nodeData;
+  var simpleMode = true;
+  while (curNode) {
+    var expressionSimple = (curNode.tagName.checked ? curNode.tagName.value : "*");
+    var expressionRaw = expressionSimple;
+
+    for (var i = 0; i < curNode.attributes.length; i++) {
+      var attr = curNode.attributes[i];
+
+      if (attr.checked && attr.selected != "") {
+        var op = "*=";
+        if (attr.selected == attr.value)
+          op = "=";
+        else if (attr.value.substr(0, attr.selected.length) == attr.selected)
+          op = "^=";
+        else if (attr.value.substr(attr.value.length - attr.selected.length) == attr.selected)
+          op = "$=";
+
+        if (/[()"]/.test(attr.value))
+          expressionSimple = null;
+
+        if (expressionSimple != null)
+          expressionSimple += "(" + attr.name + op + attr.value + ")";
+        expressionRaw += "[" + attr.name + op + '"' + attr.value.replace(/"/g, '\\"') + '"' + "]";
+      }
+    }
+
+    if (curNode.customCSS.checked && curNode.customCSS.selected != "") {
+      expressionSimple = null;
+      expressionRaw += curNode.customCSS.selected;
+    }
+
+    curNode.expressionSimple = expressionSimple;
+    curNode.expressionRaw = expressionRaw;
+
+    if (expressionSimple == null || (expressionRaw != "*" && curNode != nodeData))
+      simpleMode = false;
+
+    if (curNode.prevSibling)
+      curNode = curNode.prevSibling;
+    else
+      curNode = curNode.parentNode;
+  }
+
+  var expression;
+  if (simpleMode)
+    expression = domainData.selected + "#" + nodeData.expressionSimple;
+  else {
+    expression = domainData.selected + "##" + nodeData.expressionRaw;
+    // TBD
+  }
+
+  document.getElementById("expression").value = expression;
+}
+
+function fillDomains(domainData) {
+  var template = document.getElementById("domain-template");
+  if (domainData.selected == "")
+    template.setAttribute("selected", "true");
+
+  var parts = domainData.value.split(".");
+  if (parts[0] == "")
+    parts.splice(0, 1);
+
+  for (var i = 1; i <= parts.length; i++) {
+    var curDomain = parts.slice(parts.length - i).join(".");
+
+    var node = template.cloneNode(true);
+    node.removeAttribute("id");
+    node.setAttribute("label", curDomain);
+    node.setAttribute("value", curDomain);
+
+    if (domainData.selected == curDomain)
+      node.setAttribute("selected", "true");
+
+    template.parentNode.appendChild(node);
+  }
+}
+
+function fillAttributes(nodeData) {
+  var template = document.getElementById("attribute-template");
+  selectedNode = nodeData;
+
+  // Remove everything but our template
+  var child = template.parentNode.firstChild;
+  while (child) {
+    var nextChild = child.nextSibling;
+    if (child != template)
+      template.parentNode.removeChild(child);
+    child = nextChild;
+  }
+
+  // Add tag name checkbox
+  var node = template.cloneNode(true);
+  node.hidden = false;
+  node.setAttribute("label", node.getAttribute("label") + " " + nodeData.tagName.value);
+  node.setAttribute("checked", nodeData.tagName.checked);
+  template.parentNode.appendChild(node);
+
+  // Add attribute checkboxes
+  for (var i = 0; i < nodeData.attributes.length; i++) {
+    var attr = nodeData.attributes[i];
+
+    node = template.cloneNode(true);
+    node.hidden = false;
+    node.setAttribute("label", attr.name + ": " + attr.value);
+    node.setAttribute("checked", attr.checked);
+    node.setAttribute("value", attr.name);
+    template.parentNode.appendChild(node);
+  }
+}
+
+function changeDomain(node) {
+  domainData.selected = node.getAttribute("value");
+  updateExpression();
+}
+
+function toggleAttr(node) {
+  if (selectedNode == null)
+    return;
+
+  if (node.hasAttribute("value")) {
+    var attrName = node.getAttribute("value");
+    for (var i = 0; i < selectedNode.attributes.length; i++)
+      if (selectedNode.attributes[i].name == attrName)
+        selectedNode.attributes[i].checked = node.checked;
+  }
+  else
+    selectedNode.tagName.checked = node.checked;
+
+  updateExpression();
+}
+
+function addExpression() {
+  var abp = Components.classes["@mozilla.org/adblockplus;1"]
+                      .createInstance(Components.interfaces.nsIAdblockPlus);
+  abp.addPatterns([document.getElementById("expression").value], 1);
+}
diff --git a/chrome/content/composer.xul b/chrome/content/composer.xul
new file mode 100644
index 0000000..cf426f5
--- /dev/null
+++ b/chrome/content/composer.xul
@@ -0,0 +1,66 @@
+<?xml version="1.0"?>
+
+<!-- ***** 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
+   - the Initial Developer. All Rights Reserved.
+   -
+   - Contributor(s):
+   -
+   - ***** END LICENSE BLOCK ***** -->
+
+<!DOCTYPE overlay SYSTEM "chrome://elemhidehelper/locale/composer.dtd">
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://elemhidehelper/skin/composer.css" type="text/css"?>
+
+<dialog id="ehh-composer"
+    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+    title="&dialog.title;"
+    onload="init()"
+    ondialogaccept="addExpression()"
+    buttons="accept,cancel"
+    width="600px"
+    height="400px"
+    persist="screenX screenY width height sizemode"
+    buttonlabelaccept="&accept.label;"
+    windowtype="ehh:composer">
+  <script type="application/x-javascript" src="composer.js"/>  
+  
+  <vbox id="expressionBox">
+    <label control="expression" value="&expression.label;"/>
+    <textbox id="expression" readonly="true"/>
+  </vbox>
+
+  <hbox id="choices" flex="1">
+    <groupbox id="domain" flex="1">
+      <caption label="&domain.label;"/>
+      <scrollbox flex="1" orient="vertical">
+        <radiogroup id="domainGroup">
+          <radio id="domain-template" label="&domain.none.label;" value="" oncommand="changeDomain(this)"/>
+        </radiogroup>
+      </scrollbox>
+    </groupbox>
+    <groupbox id="attributes" flex="1">
+      <caption label="&attributes.label;"/>
+      <scrollbox flex="1" orient="vertical">
+        <checkbox id="attribute-template" label="&attributes.tagname.label;" hidden="true" oncommand="toggleAttr(this)"/>
+      </scrollbox>
+    </groupbox>
+  </hbox>
+</dialog>
diff --git a/chrome/content/contents.rdf b/chrome/content/contents.rdf
new file mode 100644
index 0000000..b9251b3
--- /dev/null
+++ b/chrome/content/contents.rdf
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+
+  <!-- list all the packages being supplied -->
+  <RDF:Seq about="urn:mozilla:package:root">
+    <RDF:li resource="urn:mozilla:package:elemhidehelper"/>
+  </RDF:Seq>
+
+  <!-- package description -->
+  <RDF:Description about="urn:mozilla:package:elemhidehelper"
+    chrome:displayName="Adblock Plus: Element Hiding Helper"
+    chrome:author="Wladimir Palant"
+    chrome:name="elemhidehelper"
+    chrome:authorURL="http://adblockplus.org/"
+    chrome:extension="true"
+    chrome:description="Helps you create element hiding rules for Adblock Plus to fight the text ads."
+    chrome:xpcNativeWrappers="true">
+  </RDF:Description>
+
+  <!-- overlay parentnodes -->
+  <RDF:Seq about="urn:mozilla:overlays">
+    <RDF:li resource="chrome://navigator/content/navigator.xul"/>
+    <RDF:li resource="chrome://messenger/content/mailWindowOverlay.xul"/>
+  </RDF:Seq>
+  
+  <!-- overlay children -->
+  <RDF:Seq about="chrome://navigator/content/navigator.xul">
+    <RDF:li>chrome://elemhidehelper/content/overlay.xul</RDF:li>
+  </RDF:Seq>
+  <RDF:Seq about="chrome://messenger/content/mailWindowOverlay.xul">
+    <RDF:li>chrome://elemhidehelper/content/overlay.xul</RDF:li>
+  </RDF:Seq>
+</RDF:RDF>
diff --git a/chrome/content/overlay.js b/chrome/content/overlay.js
new file mode 100644
index 0000000..bf5bc92
--- /dev/null
+++ b/chrome/content/overlay.js
@@ -0,0 +1,68 @@
+/* ***** 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
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+window.addEventListener("load", ehhInit, false);
+
+function ehhInit() {
+  document.getElementById("abp-status-popup").addEventListener("popupshowing", ehhFillPopup, false);
+  document.getElementById("abp-toolbar-popup").addEventListener("popupshowing", ehhFillPopup, false);
+  window.addEventListener("blur", ehhHideTooltips, true);
+  getBrowser().addEventListener("select", ehhStop, false);
+}
+
+function ehhHideTooltips() {
+  document.getElementById("ehh-helpbox").hidePopup();
+  document.getElementById("ehh-commandlabel").hidePopup();
+}
+
+function ehhFillPopup() {
+  var enabled = (window.content && content.document instanceof HTMLDocument && content.location.href != "about:blank");
+  var running = (enabled && window.content == ehhAardvark.wnd);
+
+  document.getElementById("abp-status-ehh-selectelement").setAttribute("disabled", !enabled);
+  document.getElementById("abp-toolbar-ehh-selectelement").setAttribute("disabled", !enabled);
+
+  document.getElementById("abp-status-ehh-selectelement").hidden = running;
+  document.getElementById("abp-toolbar-ehh-selectelement").hidden = running;
+
+  document.getElementById("abp-status-ehh-stopselection").hidden = !running;
+  document.getElementById("abp-toolbar-ehh-stopselection").hidden = !running;
+}
+
+function ehhSelectElement() {
+  var wnd = window.content;
+  if (!content || !content.document)
+    return;
+
+  if (wnd == ehhAardvark.wnd) {
+    ehhStop();
+    return;
+  }
+
+  ehhAardvark.start(wnd);
+}
+
+function ehhStop() {
+  ehhAardvark.quit();
+}
diff --git a/chrome/content/overlay.xul b/chrome/content/overlay.xul
new file mode 100644
index 0000000..bf9e2fe
--- /dev/null
+++ b/chrome/content/overlay.xul
@@ -0,0 +1,60 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://elemhidehelper/skin/overlay.css" type="text/css"?>
+
+<!-- ***** 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
+   - the Initial Developer. All Rights Reserved.
+   -
+   - Contributor(s):
+   -
+   - ***** END LICENSE BLOCK ***** -->
+
+<!DOCTYPE overlay SYSTEM "chrome://elemhidehelper/locale/overlay.dtd">
+
+<overlay id="ehh-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <script type="application/x-javascript" src="overlay.js"/>  
+  <script type="application/x-javascript" src="aardvark.js"/>
+  
+  <popupset id="abp-popupset">
+    <tooltip id="ehh-helpbox" noautohide="true" orient="vertical">
+      <description id="ehh-helpbox-title" value="&helpbox.title;"/>
+
+      <grid flex="1">
+        <columns>
+          <column/>
+          <column flex="1"/>
+        </columns>
+        <rows id="ehh-helpbox-rows"/>
+      </grid>
+    </tooltip>
+    <tooltip id="ehh-commandlabel" noautohide="true"  orient="horizontal">
+      <description id="ehh-commandlabel-key"/>
+      <description id="ehh-commandlabel-label"/>
+    </tooltip>
+  </popupset>
+
+  <popup id="abp-status-popup">
+    <menuitem id="abp-status-ehh-selectelement" insertbefore="abp-status-options" label="&selectelement.label;" accesskey="&selectelement.accesskey;" key="abp-key-ehh-selectelement" oncommand="ehhSelectElement()"/>
+    <menuitem id="abp-status-ehh-stopselection" insertbefore="abp-status-options" label="&stopselection.label;" accesskey="&selectelement.accesskey;" key="abp-key-ehh-selectelement" oncommand="ehhSelectElement()"/>
+  </popup>
+
+  <commandset id="abp-commandset">
+    <command id="abp-command-ehh-selectelement" oncommand="ehhSelectElement()"/>
+  </commandset>
+</overlay>
diff --git a/chrome/locale/en-US/composer.dtd b/chrome/locale/en-US/composer.dtd
new file mode 100644
index 0000000..0cc8e2e
--- /dev/null
+++ b/chrome/locale/en-US/composer.dtd
@@ -0,0 +1,31 @@
+<!-- ***** 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
+   - the Initial Developer. All Rights Reserved.
+   -
+   - Contributor(s):
+   -
+   - ***** END LICENSE BLOCK ***** -->
+
+<!ENTITY dialog.title             "Compose element hiding rule">
+<!ENTITY accept.label             "Add filter rule">
+<!ENTITY expression.label         "Filter rule">
+<!ENTITY domain.label             "Bind to domain">
+<!ENTITY domain.none.label        "Any domain (not recommended)">
+<!ENTITY attributes.label         "Require attributes">
+<!ENTITY attributes.tagname.label "Tag name:">
diff --git a/chrome/locale/en-US/contents.rdf b/chrome/locale/en-US/contents.rdf
new file mode 100644
index 0000000..7c2c6e0
--- /dev/null
+++ b/chrome/locale/en-US/contents.rdf
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+
+  <RDF:Seq about="urn:mozilla:locale:root">
+    <RDF:li resource="urn:mozilla:locale:en-US"/>
+  </RDF:Seq>
+
+  <RDF:Description about="urn:mozilla:locale:en-US"
+      chrome:displayName="English(US)"
+      chrome:author="Wladimir Palant"
+      chrome:name="en-US">
+    <chrome:packages>
+      <RDF:Seq about="urn:mozilla:locale:en-US:packages">
+        <RDF:li resource="urn:mozilla:locale:en-US:elemhidehelper"/>
+      </RDF:Seq>
+    </chrome:packages>
+  </RDF:Description>
+</RDF:RDF>
diff --git a/chrome/locale/en-US/global.properties b/chrome/locale/en-US/global.properties
new file mode 100644
index 0000000..220a063
--- /dev/null
+++ b/chrome/locale/en-US/global.properties
@@ -0,0 +1,14 @@
+command.select.key=s
+command.select.label=select element
+command.wider.key=w
+command.wider.label=wider
+command.narrower.key=n
+command.narrower.label=narrower
+command.quit.key=q
+command.quit.label=quit selection
+command.blinkElement.key=b
+command.blinkElement.label=blink element
+command.viewSource.key=v
+command.viewSource.label=view source
+command.showMenu.key=h
+command.showMenu.label=show/hide help
diff --git a/chrome/locale/en-US/overlay.dtd b/chrome/locale/en-US/overlay.dtd
new file mode 100644
index 0000000..7d94382
--- /dev/null
+++ b/chrome/locale/en-US/overlay.dtd
@@ -0,0 +1,29 @@
+<!-- ***** 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
+   - the Initial Developer. All Rights Reserved.
+   -
+   - Contributor(s):
+   -
+   - ***** END LICENSE BLOCK ***** -->
+
+<!ENTITY selectelement.label      "Select element to hide">
+<!ENTITY selectelement.accesskey  "S">
+<!ENTITY stopselection.label      "Abort element selection">
+<!ENTITY stopselection.accesskey  "S">
+<!ENTITY helpbox.title            "Element selection - Hotkeys">
diff --git a/chrome/skin/classic/composer.css b/chrome/skin/classic/composer.css
new file mode 100644
index 0000000..503a4b4
--- /dev/null
+++ b/chrome/skin/classic/composer.css
@@ -0,0 +1,29 @@
+/* ***** 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
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+ at namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+scrollbox {
+  overflow: auto;
+}
diff --git a/chrome/skin/classic/contents.rdf b/chrome/skin/classic/contents.rdf
new file mode 100644
index 0000000..de6d761
--- /dev/null
+++ b/chrome/skin/classic/contents.rdf
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+
+<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+     xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
+  
+  <RDF:Seq about="urn:mozilla:skin:root">
+    <RDF:li resource="urn:mozilla:skin:classic/1.0"/>
+  </RDF:Seq>
+  
+  <!-- skin package information -->
+  <RDF:Description about="urn:mozilla:skin:classic/1.0" chrome:name="classic/1.0">
+  <chrome:packages>
+    <RDF:Seq about="urn:mozilla:skin:classic/1.0:packages">
+      <RDF:li resource="urn:mozilla:skin:classic/1.0:elemhidehelper"/>
+    </RDF:Seq>
+  </chrome:packages>
+  </RDF:Description>
+</RDF:RDF>
diff --git a/chrome/skin/classic/overlay.css b/chrome/skin/classic/overlay.css
new file mode 100644
index 0000000..6809835
--- /dev/null
+++ b/chrome/skin/classic/overlay.css
@@ -0,0 +1,44 @@
+/* ***** 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
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+ at namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+#ehh-helpbox, #ehh-commandlabel {
+  margin: 10px;
+  padding: 5px;
+}
+
+#ehh-helpbox .key {
+  font-weight: bold;
+  margin-right: 10px;
+}
+
+#ehh-helpbox-title {
+  font-size: 130%;
+  margin-bottom: 10px;
+}
+
+#ehh-commandlabel-key {
+  font-weight: bold;
+}
diff --git a/create_xpi.pl b/create_xpi.pl
new file mode 100644
index 0000000..15f29f9
--- /dev/null
+++ b/create_xpi.pl
@@ -0,0 +1,28 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use lib qw(..);
+use Packager;
+
+my %params = ();
+
+my $xpiFile = shift @ARGV || "elemhidehelper.xpi";
+if (@ARGV && $ARGV[0] =~ /^\+/)
+{
+  $params{devbuild} = $ARGV[0];
+  shift @ARGV;
+}
+
+$params{locales} = \@ARGV if @ARGV;
+
+my $pkg = Packager->new(\%params);
+$pkg->readVersion('version');
+$pkg->readLocales('chrome/locale') unless exists $params{locales};
+
+chdir('chrome');
+$pkg->makeJAR('elemhidehelper.jar', 'content', 'skin', 'locale');
+chdir('..');
+
+$pkg->makeXPI($xpiFile, 'chrome/elemhidehelper.jar', 'defaults', 'install.js', 'install.rdf', 'chrome.manifest');
+unlink('chrome/elemhidehelper.jar');
diff --git a/defaults/preferences/elemhidehelper.js b/defaults/preferences/elemhidehelper.js
new file mode 100644
index 0000000..e7ac493
--- /dev/null
+++ b/defaults/preferences/elemhidehelper.js
@@ -0,0 +1,2 @@
+pref("extensions.adblockplus.ehh-selectelement_key", "Accel Shift H");
+pref("extensions.adblockplus.protectchrome.ehh", "elemhidehelper");
diff --git a/install.js b/install.js
new file mode 100644
index 0000000..e8eedce
--- /dev/null
+++ b/install.js
@@ -0,0 +1,56 @@
+// constants
+const APP_DISPLAY_NAME = "Adblock Plus: Element Hiding Helper";
+const APP_NAME = "elemhidehelper";
+const APP_PACKAGE = "/elemhidehelper.adblockplus.org";
+const APP_VERSION = "{{VERSION}}";
+const VERSION_ERROR = "This extension can only be installed in a browser based on Gecko 1.8 or higher, please upgrade your browser. Compatible browsers include Firefox 1.5, SeaMonkey 1.0 and Flock 0.5.";
+const locales = [
+  "{{LOCALE}}",
+  null
+];
+
+// Gecko 1.7 doesn't support custom button labels
+var incompatible = (typeof Install.BUTTON_POS_0 == "undefined");
+if (incompatible)
+  alert(VERSION_ERROR);
+
+if (!incompatible) {
+  // initialize our install
+  initInstall(APP_NAME, APP_PACKAGE, APP_VERSION);
+  
+  // Install jar
+  var jarFolder = getFolder("Profile", "chrome");
+  addFile(APP_NAME, APP_VERSION, "chrome/elemhidehelper.jar", jarFolder, null);
+
+  var jar = getFolder(jarFolder, "elemhidehelper.jar");
+  try {
+    var err = registerChrome(CONTENT | PROFILE_CHROME, jar, "content/");
+    if (err != SUCCESS)
+      throw "Chrome registration for content failed (error code " + err + ").";
+
+    err = registerChrome(SKIN | PROFILE_CHROME, jar, "skin/classic/");
+    if (err != SUCCESS)
+      throw "Chrome registration for skin failed (error code " + err + ").";
+
+    for (i = 0; i < locales.length; i++) {
+      if (!locales[i])
+        continue;
+
+      err = registerChrome(LOCALE | PROFILE_CHROME, jar, "locale/" + locales[i] + "/");
+      if (err != SUCCESS)
+        throw "Chrome registration for " + locales[i] + " locale failed (error code " + err + ").";
+    }
+
+    var err = performInstall();
+    if (err != SUCCESS && err != 999)
+      throw "Committing installation failed (error code " + err + ").";
+
+    alert("Element Hiding Helper " + APP_VERSION + " is now installed.\n" +
+          "It will become active after you restart your browser.");
+  }
+  catch (ex) {
+    alert("Installation failed: " + ex + "\n" +
+          "You probably don't have the necessary permissions (log in as system administrator).");
+    cancelInstall(err);
+  } 
+}
diff --git a/install.rdf b/install.rdf
new file mode 100644
index 0000000..300d2dc
--- /dev/null
+++ b/install.rdf
@@ -0,0 +1,100 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+  <Description about="urn:mozilla:install-manifest">
+  
+  <em:id>{1eba6e43-b925-6509-d417-2e1aaf83ec87}</em:id>
+  <em:version>{{VERSION}}</em:version>
+  
+  <!-- Target Application this extension can install into, 
+    with minimum and maximum supported versions. --> 
+  
+  <!-- FireFox -->
+  <em:targetApplication>
+    <Description>
+    <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+    <em:minVersion>1.5</em:minVersion>
+    <em:maxVersion>3.0a2</em:maxVersion>
+    </Description>
+  </em:targetApplication>
+  
+  <!-- SeaMonkey -->
+  <em:targetApplication>
+    <Description>
+    <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
+    <em:minVersion>1.0</em:minVersion>
+    <em:maxVersion>1.0</em:maxVersion>
+    </Description>
+  </em:targetApplication>
+  
+  <!-- Thunderbird -->
+  <em:targetApplication>
+    <Description>
+    <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
+    <em:minVersion>1.5</em:minVersion>
+    <em:maxVersion>3.0a1</em:maxVersion>
+    </Description>
+  </em:targetApplication>
+
+  <!-- Netscape -->
+<!--
+  Netscape not supported until there is a version based on Gecko 1.8
+  <em:targetApplication>
+    <Description>
+    <em:id>{3db10fab-e461-4c80-8b97-957ad5f8ea47}</em:id>
+    <em:minVersion>8.0</em:minVersion>
+    <em:maxVersion>8.1</em:maxVersion>
+    </Description>
+  </em:targetApplication>
+-->
+  
+  <!-- Flock -->
+  <em:targetApplication>
+    <Description>
+    <em:id>{a463f10c-3994-11da-9945-000d60ca027b}</em:id>
+    <em:minVersion>0.5</em:minVersion>
+    <em:maxVersion>1.0+</em:maxVersion>
+    </Description>
+  </em:targetApplication>
+  
+  <!-- Songbird -->
+  <em:targetApplication>
+    <Description>
+    <em:id>{758DAD28-FDE9-4ab8-A301-3FFFAB3A697A}</em:id>
+    <em:minVersion>0.1</em:minVersion>
+    <em:maxVersion>0.3</em:maxVersion>
+    </Description>
+  </em:targetApplication>
+  <em:targetApplication>
+    <Description>
+    <em:id>songbird at songbirdnest.com</em:id>
+    <em:minVersion>0.1</em:minVersion>
+    <em:maxVersion>0.3</em:maxVersion>
+    </Description>
+  </em:targetApplication>
+
+  <!-- Dependency on Adblock Plus -->
+  <em:requires>
+    <Description>
+      <em:id>{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}</em:id>
+      <em:name>Adblock Plus</em:name>
+      <em:homepageURL>http://adblockplus.org/</em:homepageURL>
+      <em:minVersion>0.7.2.3</em:minVersion>
+      <em:maxVersion>*</em:maxVersion>
+    </Description>
+  </em:requires>
+
+  <!-- Front End MetaData -->
+  <em:name>Adblock Plus: Element Hiding Helper</em:name>
+  <em:description>Helps you create element hiding rules for Adblock Plus to fight the text ads.</em:description>
+  <em:creator>Wladimir Palant</em:creator>
+  <em:homepageURL>http://adblockplus.org/</em:homepageURL>
+
+  <!-- Front End Integration Hooks (used by Extension Manager)-->
+  <em:iconURL>chrome://adblockplus/skin/adblockplus.png</em:iconURL>
+  <em:aboutURL>chrome://adblockplus/content/about.xul</em:aboutURL>
+
+  </Description>  
+</RDF>
diff --git a/make_devbuild.pl b/make_devbuild.pl
new file mode 100644
index 0000000..17efef1
--- /dev/null
+++ b/make_devbuild.pl
@@ -0,0 +1,15 @@
+#!/usr/bin/perl
+
+use strict;
+
+open(VERSION, "version");
+my $version = <VERSION>;
+$version =~ s/[^\w\.]//gs;
+close(VERSION);
+
+my ($sec, $min, $hour, $day, $mon, $year) = localtime;
+my $build = sprintf("%04i%02i%02i%02i", $year+1900, $mon+1, $day, $hour);
+
+my $locale = (@ARGV ? "-" . join("-", @ARGV) : "");
+ at ARGV = ("elemhidehelper-$version+.$build$locale.xpi", "+.$build", @ARGV);
+do 'create_xpi.pl';
diff --git a/version b/version
new file mode 100644
index 0000000..b63ba69
--- /dev/null
+++ b/version
@@ -0,0 +1 @@
+0.9

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