diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-09-03 21:13:51 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-09-03 21:13:51 -0400 |
commit | aa788251334e2dfd2b29aefd60b30a64256b79e2 (patch) | |
tree | 5e31737ec76208ad9d8e9ef7ba3ad8cd9fcd7493 | |
parent | 376417694040f9f6bbb8f8bb455e8a5b7e50cfcc (diff) | |
download | pentadactyl-aa788251334e2dfd2b29aefd60b30a64256b79e2.tar.gz |
Fix crappy add-on manager icons.
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/modules/dom.jsm | 30 | ||||
-rw-r--r-- | common/modules/io.jsm | 30 | ||||
-rw-r--r-- | common/modules/overlay.jsm | 6 | ||||
-rw-r--r-- | common/modules/protocol.jsm | 2 | ||||
-rw-r--r-- | common/modules/template.jsm | 5 | ||||
-rw-r--r-- | common/modules/util.jsm | 7 | ||||
-rw-r--r-- | pentadactyl/icon.png | bin | 0 -> 731 bytes | |||
-rw-r--r-- | pentadactyl/icon64.png | bin | 0 -> 1363 bytes | |||
-rw-r--r-- | pentadactyl/install.rdf | 1 |
10 files changed, 55 insertions, 28 deletions
diff --git a/common/Makefile b/common/Makefile index b9e80228..1c563678 100644 --- a/common/Makefile +++ b/common/Makefile @@ -40,7 +40,7 @@ CHROME = $(MANGLE)/ JAR = $(CHROME)$(NAME).jar XPI_BASES = $(JAR_BASES) $(TOP)/.. -XPI_FILES = bootstrap.js TODO AUTHORS Donors NEWS LICENSE.txt +XPI_FILES = icon.png icon64.png bootstrap.js TODO AUTHORS Donors NEWS LICENSE.txt XPI_DIRS = components $(MANGLE) defaults XPI_TEXTS = js jsm $(JAR_TEXTS) XPI_BINS = $(JAR_BINS) diff --git a/common/modules/dom.jsm b/common/modules/dom.jsm index 8c7c0bda..fb007282 100644 --- a/common/modules/dom.jsm +++ b/common/modules/dom.jsm @@ -16,6 +16,16 @@ var XUL = Namespace("xul", "http://www.mozilla.org/keymaster/gatekeeper/there.is var NS = Namespace("dactyl", "http://vimperator.org/namespaces/liberator"); default xml namespace = XHTML; +function BooleanAttribute(attr) ({ + get: function (elem) elem.getAttribute(attr) == "true", + set: function (elem, val) { + if (val === "false" || !val) + elem.removeAttribute(attr); + else + elem.setAttribute(attr, true); + } +}); + /** * @class * @@ -73,7 +83,11 @@ var DOM = Class("DOM", { attrHooks: array.toObject([ ["", { href: { get: function (elem) elem.href || elem.getAttribute("href") }, - src: { get: function (elem) elem.src || elem.getAttribute("src") } + src: { get: function (elem) elem.src || elem.getAttribute("src") }, + collapsed: BooleanAttribute("collapsed"), + disabled: BooleanAttribute("disabled"), + hidden: BooleanAttribute("hidden"), + readonly: BooleanAttribute("readonly") }] ]), @@ -140,6 +154,10 @@ var DOM = Class("DOM", { return this.map(function (elem) elem.querySelectorAll(val)); }, + findAnon: function findAnon(attr, val) { + return this.map(function (elem) elem.ownerDocument.getAnonymousElementByAttribute(elem, attr, val)); + }, + filter: function filter(val, self) { let res = this.Empty(); @@ -507,7 +525,7 @@ var DOM = Class("DOM", { return this.each(function (elem) { for (let [k, v] in Iterator(key)) if (Set.has(hooks, k) && hooks[k].set) - hooks[k].set.call(this, elem, v); + hooks[k].set.call(this, elem, v, k); else if (v == null) elem.removeAttributeNS(ns, k); else @@ -518,7 +536,7 @@ var DOM = Class("DOM", { return null; if (Set.has(hooks, key) && hooks[key].get) - return hooks[key].get.call(this, this[0]); + return hooks[key].get.call(this, this[0], key); if (!this[0].hasAttributeNS(ns, key)) return null; @@ -526,6 +544,7 @@ var DOM = Class("DOM", { return this[0].getAttributeNS(ns, key); }, + css: update(function css(key, val) { if (val !== undefined) key = array.toObject([[key, val]]); @@ -811,9 +830,10 @@ var DOM = Class("DOM", { types: Class.Memoize(function () iter( { - Mouse: "click mousedown mouseout mouseover mouseup", + Mouse: "click mousedown mouseout mouseover mouseup " + + "popupshowing popupshown popuphiding popuphidden", Key: "keydown keypress keyup", - "": "change dactyl-input input submit " + + "": "change command dactyl-input input submit " + "load unload pageshow pagehide DOMContentLoaded" } ).map(function ([k, v]) v.split(" ").map(function (v) [v, k])) diff --git a/common/modules/io.jsm b/common/modules/io.jsm index 948167d9..18029944 100644 --- a/common/modules/io.jsm +++ b/common/modules/io.jsm @@ -21,14 +21,14 @@ defineModule("io", { * @instance io */ var IO = Module("io", { - init: function () { + init: function init() { this._processDir = services.directory.get("CurWorkD", Ci.nsIFile); this._cwd = this._processDir.path; this._oldcwd = null; this.config = config; }, - Local: function (dactyl, modules, window) let ({ io, plugins } = modules) ({ + Local: function Local(dactyl, modules, window) let ({ io, plugins } = modules) ({ init: function init() { this.config = modules.config; @@ -292,7 +292,7 @@ var IO = Module("io", { * @default $HOME. * @returns {nsIFile} The RC file or null if none is found. */ - getRCFile: function (dir, always) { + getRCFile: function getRCFile(dir, always) { dir = this.File(dir || "~"); let rcFile1 = dir.child("." + config.name + "rc"); @@ -316,7 +316,7 @@ var IO = Module("io", { * * @returns {File} */ - createTempFile: function () { + createTempFile: function createTempFile() { let file = services.directory.get("TmpD", Ci.nsIFile); file.append(this.config.tempFile); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(600)); @@ -337,6 +337,9 @@ var IO = Module("io", { isJarURL: function isJarURL(url) { try { let uri = util.newURI(util.fixURI(url)); + if (uri instanceof Ci.nsIJARURI) + return uri; + let channel = services.io.newChannelFromURI(uri); channel.cancel(Cr.NS_BINDING_ABORTED); if (channel instanceof Ci.nsIJARChannel) @@ -373,7 +376,7 @@ var IO = Module("io", { } }, - readHeredoc: function (end) { + readHeredoc: function readHeredoc(end) { return ""; }, @@ -387,8 +390,9 @@ var IO = Module("io", { * name and searched for in turn. * * @param {string} bin The name of the executable to find. + * @returns {File|null} */ - pathSearch: function (bin) { + pathSearch: function pathSearch(bin) { if (bin instanceof File || File.isAbsolutePath(bin)) return this.File(bin); @@ -426,7 +430,7 @@ var IO = Module("io", { * @param {File|string} program The program to run. * @param {[string]} args An array of arguments to pass to *program*. */ - run: function (program, args, blocking, self) { + run: function run(program, args, blocking, self) { args = args || []; let file = this.pathSearch(program); @@ -474,7 +478,7 @@ var IO = Module("io", { * the command completes. @optional * @returns {object|null} */ - system: function (command, input, callback) { + system: function system(command, input, callback) { util.dactyl.echomsg(_("io.callingShell", command), 4); let { shellEscape } = util.closure; @@ -533,7 +537,7 @@ var IO = Module("io", { * @returns {boolean} false if temp files couldn't be created, * otherwise, the return value of *func*. */ - withTempFiles: function (func, self, checked) { + withTempFiles: function withTempFiles(func, self, checked) { let args = array(util.range(0, func.length)).map(this.closure.createTempFile).array; try { if (!args.every(util.identity)) @@ -566,7 +570,7 @@ var IO = Module("io", { */ PATH_SEP: deprecated("File.PATH_SEP", { get: function PATH_SEP() File.PATH_SEP }) }, { - commands: function (dactyl, modules, window) { + commands: function init_commands(dactyl, modules, window) { const { commands, completion, io } = modules; commands.add(["cd", "chd[ir]"], @@ -858,7 +862,7 @@ unlet s:cpo_save literal: 0 }); }, - completion: function (dactyl, modules, window) { + completion: function init_completion(dactyl, modules, window) { const { completion, io } = modules; completion.charset = function (context) { @@ -1006,7 +1010,7 @@ unlet s:cpo_save completion.file(context, full); }); }, - javascript: function (dactyl, modules, window) { + javascript: function init_javascript(dactyl, modules, window) { modules.JavaScript.setCompleter([File, File.expandPath], [function (context, obj, args) { context.quote[2] = ""; @@ -1025,7 +1029,7 @@ unlet s:cpo_save input: true }); }, - options: function (dactyl, modules, window) { + options: function init_options(dactyl, modules, window) { const { completion, options } = modules; var shell, shellcmdflag; diff --git a/common/modules/overlay.jsm b/common/modules/overlay.jsm index 64e056cc..6cc124d4 100644 --- a/common/modules/overlay.jsm +++ b/common/modules/overlay.jsm @@ -460,9 +460,9 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen if (doc.readyState === "complete") load(); else - doc.addEventListener("load", util.wrapCallback(function onLoad(event) { - if (event.originalTarget === event.target) { - doc.removeEventListener("load", onLoad.wrapper, true); + window.addEventListener("load", util.wrapCallback(function onLoad(event) { + if (event.originalTarget === doc) { + window.removeEventListener("load", onLoad.wrapper, true); load(event); } }), true); diff --git a/common/modules/protocol.jsm b/common/modules/protocol.jsm index cf9f905d..da0ce1f3 100644 --- a/common/modules/protocol.jsm +++ b/common/modules/protocol.jsm @@ -104,7 +104,7 @@ ProtocolBase.prototype = { | Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE, newURI: function newURI(spec, charset, baseURI) { - if (baseURI && baseURI.host === "data") + if (baseURI && (!(baseURI instanceof Ci.nsIURL) || baseURI.host === "data")) baseURI = null; return services.URL(services.URL.URLTYPE_AUTHORITY, this.defaultPort, spec, charset, baseURI); diff --git a/common/modules/template.jsm b/common/modules/template.jsm index b15e92e5..5cb06e43 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -275,7 +275,7 @@ var Template = Module("Template", { // if "processStrings" is true, any passed strings will be surrounded by " and // any line breaks are displayed as \n - highlight: function highlight(arg, processStrings, clip) { + highlight: function highlight(arg, processStrings, clip, bw) { XML.ignoreWhitespace = false; XML.prettyPrinting = false; // some objects like window.JSON or getBrowsers()._browsers need the try/catch try { @@ -302,7 +302,8 @@ var Template = Module("Template", { return <span highlight="Null">{arg}</span>; case "object": if (arg instanceof Ci.nsIDOMElement) - return util.objectToString(arg, true); + return util.objectToString(arg, !bw); + // for java packages value.toString() would crash so badly // that we cannot even try/catch it if (/^\[JavaPackage.*\]$/.test(arg)) diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 39a9094d..1e7feacb 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -624,6 +624,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), if (uri instanceof Ci.nsIFileURL) return File(uri.file); + if (uri instanceof Ci.nsIFile) + return File(uri); + let channel = services.io.newChannelFromURI(uri); channel.cancel(Cr.NS_BINDING_ABORTED); if (channel instanceof Ci.nsIFileChannel) @@ -902,7 +905,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), } } - value = template.highlight(value, true, 150); + value = template.highlight(value, true, 150, !color); let key = <span highlight="Key">{i}</span>; if (!isNaN(i)) i = parseInt(i); @@ -1137,7 +1140,7 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]), * along with a stack trace and other relevant information. The * error is appended to {@seeĀ #errors}. */ - reportError: function (error) { + reportError: function reportError(error) { if (error.noTrace) return; diff --git a/pentadactyl/icon.png b/pentadactyl/icon.png Binary files differnew file mode 100644 index 00000000..862a3bdc --- /dev/null +++ b/pentadactyl/icon.png diff --git a/pentadactyl/icon64.png b/pentadactyl/icon64.png Binary files differnew file mode 100644 index 00000000..dd248bb0 --- /dev/null +++ b/pentadactyl/icon64.png diff --git a/pentadactyl/install.rdf b/pentadactyl/install.rdf index f7127216..216c87ee 100644 --- a/pentadactyl/install.rdf +++ b/pentadactyl/install.rdf @@ -8,7 +8,6 @@ em:version="1.0b8pre" em:description="Firefox for Vim and Links addicts" em:homepageURL="http://dactyl.sourceforge.net/pentadactyl" - em:iconURL="resource://dactyl-local-skin/icon.png" em:bootstrap="true"> <em:creator>Kris Maglione, Doug Kearns</em:creator> |