1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 13:47:57 +01:00

Fix crappy add-on manager icons.

This commit is contained in:
Kris Maglione
2011-09-03 21:13:51 -04:00
parent 3764176940
commit aa78825133
10 changed files with 55 additions and 28 deletions

View File

@@ -40,7 +40,7 @@ CHROME = $(MANGLE)/
JAR = $(CHROME)$(NAME).jar JAR = $(CHROME)$(NAME).jar
XPI_BASES = $(JAR_BASES) $(TOP)/.. 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_DIRS = components $(MANGLE) defaults
XPI_TEXTS = js jsm $(JAR_TEXTS) XPI_TEXTS = js jsm $(JAR_TEXTS)
XPI_BINS = $(JAR_BINS) XPI_BINS = $(JAR_BINS)

View File

@@ -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"); var NS = Namespace("dactyl", "http://vimperator.org/namespaces/liberator");
default xml namespace = XHTML; 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 * @class
* *
@@ -73,7 +83,11 @@ var DOM = Class("DOM", {
attrHooks: array.toObject([ attrHooks: array.toObject([
["", { ["", {
href: { get: function (elem) elem.href || elem.getAttribute("href") }, 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)); 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) { filter: function filter(val, self) {
let res = this.Empty(); let res = this.Empty();
@@ -507,7 +525,7 @@ var DOM = Class("DOM", {
return this.each(function (elem) { return this.each(function (elem) {
for (let [k, v] in Iterator(key)) for (let [k, v] in Iterator(key))
if (Set.has(hooks, k) && hooks[k].set) 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) else if (v == null)
elem.removeAttributeNS(ns, k); elem.removeAttributeNS(ns, k);
else else
@@ -518,7 +536,7 @@ var DOM = Class("DOM", {
return null; return null;
if (Set.has(hooks, key) && hooks[key].get) 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)) if (!this[0].hasAttributeNS(ns, key))
return null; return null;
@@ -526,6 +544,7 @@ var DOM = Class("DOM", {
return this[0].getAttributeNS(ns, key); return this[0].getAttributeNS(ns, key);
}, },
css: update(function css(key, val) { css: update(function css(key, val) {
if (val !== undefined) if (val !== undefined)
key = array.toObject([[key, val]]); key = array.toObject([[key, val]]);
@@ -811,9 +830,10 @@ var DOM = Class("DOM", {
types: Class.Memoize(function () iter( 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", Key: "keydown keypress keyup",
"": "change dactyl-input input submit " + "": "change command dactyl-input input submit " +
"load unload pageshow pagehide DOMContentLoaded" "load unload pageshow pagehide DOMContentLoaded"
} }
).map(function ([k, v]) v.split(" ").map(function (v) [v, k])) ).map(function ([k, v]) v.split(" ").map(function (v) [v, k]))

View File

@@ -21,14 +21,14 @@ defineModule("io", {
* @instance io * @instance io
*/ */
var IO = Module("io", { var IO = Module("io", {
init: function () { init: function init() {
this._processDir = services.directory.get("CurWorkD", Ci.nsIFile); this._processDir = services.directory.get("CurWorkD", Ci.nsIFile);
this._cwd = this._processDir.path; this._cwd = this._processDir.path;
this._oldcwd = null; this._oldcwd = null;
this.config = config; 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() { init: function init() {
this.config = modules.config; this.config = modules.config;
@@ -292,7 +292,7 @@ var IO = Module("io", {
* @default $HOME. * @default $HOME.
* @returns {nsIFile} The RC file or null if none is found. * @returns {nsIFile} The RC file or null if none is found.
*/ */
getRCFile: function (dir, always) { getRCFile: function getRCFile(dir, always) {
dir = this.File(dir || "~"); dir = this.File(dir || "~");
let rcFile1 = dir.child("." + config.name + "rc"); let rcFile1 = dir.child("." + config.name + "rc");
@@ -316,7 +316,7 @@ var IO = Module("io", {
* *
* @returns {File} * @returns {File}
*/ */
createTempFile: function () { createTempFile: function createTempFile() {
let file = services.directory.get("TmpD", Ci.nsIFile); let file = services.directory.get("TmpD", Ci.nsIFile);
file.append(this.config.tempFile); file.append(this.config.tempFile);
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(600)); file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, octal(600));
@@ -337,6 +337,9 @@ var IO = Module("io", {
isJarURL: function isJarURL(url) { isJarURL: function isJarURL(url) {
try { try {
let uri = util.newURI(util.fixURI(url)); let uri = util.newURI(util.fixURI(url));
if (uri instanceof Ci.nsIJARURI)
return uri;
let channel = services.io.newChannelFromURI(uri); let channel = services.io.newChannelFromURI(uri);
channel.cancel(Cr.NS_BINDING_ABORTED); channel.cancel(Cr.NS_BINDING_ABORTED);
if (channel instanceof Ci.nsIJARChannel) if (channel instanceof Ci.nsIJARChannel)
@@ -373,7 +376,7 @@ var IO = Module("io", {
} }
}, },
readHeredoc: function (end) { readHeredoc: function readHeredoc(end) {
return ""; return "";
}, },
@@ -387,8 +390,9 @@ var IO = Module("io", {
* name and searched for in turn. * name and searched for in turn.
* *
* @param {string} bin The name of the executable to find. * @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)) if (bin instanceof File || File.isAbsolutePath(bin))
return this.File(bin); return this.File(bin);
@@ -426,7 +430,7 @@ var IO = Module("io", {
* @param {File|string} program The program to run. * @param {File|string} program The program to run.
* @param {[string]} args An array of arguments to pass to *program*. * @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 || []; args = args || [];
let file = this.pathSearch(program); let file = this.pathSearch(program);
@@ -474,7 +478,7 @@ var IO = Module("io", {
* the command completes. @optional * the command completes. @optional
* @returns {object|null} * @returns {object|null}
*/ */
system: function (command, input, callback) { system: function system(command, input, callback) {
util.dactyl.echomsg(_("io.callingShell", command), 4); util.dactyl.echomsg(_("io.callingShell", command), 4);
let { shellEscape } = util.closure; let { shellEscape } = util.closure;
@@ -533,7 +537,7 @@ var IO = Module("io", {
* @returns {boolean} false if temp files couldn't be created, * @returns {boolean} false if temp files couldn't be created,
* otherwise, the return value of *func*. * 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; let args = array(util.range(0, func.length)).map(this.closure.createTempFile).array;
try { try {
if (!args.every(util.identity)) 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 }) 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; const { commands, completion, io } = modules;
commands.add(["cd", "chd[ir]"], commands.add(["cd", "chd[ir]"],
@@ -858,7 +862,7 @@ unlet s:cpo_save
literal: 0 literal: 0
}); });
}, },
completion: function (dactyl, modules, window) { completion: function init_completion(dactyl, modules, window) {
const { completion, io } = modules; const { completion, io } = modules;
completion.charset = function (context) { completion.charset = function (context) {
@@ -1006,7 +1010,7 @@ unlet s:cpo_save
completion.file(context, full); completion.file(context, full);
}); });
}, },
javascript: function (dactyl, modules, window) { javascript: function init_javascript(dactyl, modules, window) {
modules.JavaScript.setCompleter([File, File.expandPath], modules.JavaScript.setCompleter([File, File.expandPath],
[function (context, obj, args) { [function (context, obj, args) {
context.quote[2] = ""; context.quote[2] = "";
@@ -1025,7 +1029,7 @@ unlet s:cpo_save
input: true input: true
}); });
}, },
options: function (dactyl, modules, window) { options: function init_options(dactyl, modules, window) {
const { completion, options } = modules; const { completion, options } = modules;
var shell, shellcmdflag; var shell, shellcmdflag;

View File

@@ -460,9 +460,9 @@ var Overlay = Module("Overlay", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReferen
if (doc.readyState === "complete") if (doc.readyState === "complete")
load(); load();
else else
doc.addEventListener("load", util.wrapCallback(function onLoad(event) { window.addEventListener("load", util.wrapCallback(function onLoad(event) {
if (event.originalTarget === event.target) { if (event.originalTarget === doc) {
doc.removeEventListener("load", onLoad.wrapper, true); window.removeEventListener("load", onLoad.wrapper, true);
load(event); load(event);
} }
}), true); }), true);

View File

@@ -104,7 +104,7 @@ ProtocolBase.prototype = {
| Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE, | Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE,
newURI: function newURI(spec, charset, baseURI) { newURI: function newURI(spec, charset, baseURI) {
if (baseURI && baseURI.host === "data") if (baseURI && (!(baseURI instanceof Ci.nsIURL) || baseURI.host === "data"))
baseURI = null; baseURI = null;
return services.URL(services.URL.URLTYPE_AUTHORITY, return services.URL(services.URL.URLTYPE_AUTHORITY,
this.defaultPort, spec, charset, baseURI); this.defaultPort, spec, charset, baseURI);

View File

@@ -275,7 +275,7 @@ var Template = Module("Template", {
// if "processStrings" is true, any passed strings will be surrounded by " and // if "processStrings" is true, any passed strings will be surrounded by " and
// any line breaks are displayed as \n // 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; XML.ignoreWhitespace = false; XML.prettyPrinting = false;
// some objects like window.JSON or getBrowsers()._browsers need the try/catch // some objects like window.JSON or getBrowsers()._browsers need the try/catch
try { try {
@@ -302,7 +302,8 @@ var Template = Module("Template", {
return <span highlight="Null">{arg}</span>; return <span highlight="Null">{arg}</span>;
case "object": case "object":
if (arg instanceof Ci.nsIDOMElement) if (arg instanceof Ci.nsIDOMElement)
return util.objectToString(arg, true); return util.objectToString(arg, !bw);
// for java packages value.toString() would crash so badly // for java packages value.toString() would crash so badly
// that we cannot even try/catch it // that we cannot even try/catch it
if (/^\[JavaPackage.*\]$/.test(arg)) if (/^\[JavaPackage.*\]$/.test(arg))

View File

@@ -624,6 +624,9 @@ var Util = Module("Util", XPCOM([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
if (uri instanceof Ci.nsIFileURL) if (uri instanceof Ci.nsIFileURL)
return File(uri.file); return File(uri.file);
if (uri instanceof Ci.nsIFile)
return File(uri);
let channel = services.io.newChannelFromURI(uri); let channel = services.io.newChannelFromURI(uri);
channel.cancel(Cr.NS_BINDING_ABORTED); channel.cancel(Cr.NS_BINDING_ABORTED);
if (channel instanceof Ci.nsIFileChannel) 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>; let key = <span highlight="Key">{i}</span>;
if (!isNaN(i)) if (!isNaN(i))
i = parseInt(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 * along with a stack trace and other relevant information. The
* error is appended to {@see #errors}. * error is appended to {@see #errors}.
*/ */
reportError: function (error) { reportError: function reportError(error) {
if (error.noTrace) if (error.noTrace)
return; return;

BIN
pentadactyl/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

BIN
pentadactyl/icon64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -8,7 +8,6 @@
em:version="1.0b8pre" em:version="1.0b8pre"
em:description="Firefox for Vim and Links addicts" em:description="Firefox for Vim and Links addicts"
em:homepageURL="http://dactyl.sourceforge.net/pentadactyl" em:homepageURL="http://dactyl.sourceforge.net/pentadactyl"
em:iconURL="resource://dactyl-local-skin/icon.png"
em:bootstrap="true"> em:bootstrap="true">
<em:creator>Kris Maglione, Doug Kearns</em:creator> <em:creator>Kris Maglione, Doug Kearns</em:creator>