X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=common%2Fcontent%2Fdactyl.js;fp=common%2Fcontent%2Fdactyl.js;h=64aa91358d46886bd9cbe3e492cf8cb991a054df;hb=3d837eb266a3a01d424192aa4ec1a167366178c5;hp=02ce9bd177eec85c419f7875c35bdd8caac1e2be;hpb=d8a3bcebff36df7b128b36e0b57b715479e155a0;p=dactyl.git diff --git a/common/content/dactyl.js b/common/content/dactyl.js index 02ce9bd..64aa913 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -1,6 +1,6 @@ // Copyright (c) 2006-2008 by Martin Stubenschrott // Copyright (c) 2007-2011 by Doug Kearns -// Copyright (c) 2008-2012 Kris Maglione +// Copyright (c) 2008-2013 Kris Maglione // // This work is licensed for reuse under an MIT license. Details are // given in the LICENSE.txt file included with this file. @@ -83,7 +83,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { } }, - observers: { "dactyl-cleanup": function dactyl_cleanup(subject, reason) { let modules = dactyl.modules; @@ -236,8 +235,8 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { }); }, - triggerObserver: function triggerObserver(type) { - return this.applyTriggerObserver(type, Array.slice(arguments, 1)); + triggerObserver: function triggerObserver(type, ...args) { + return this.applyTriggerObserver(type, args); }, addUsageCommand: function (params) { @@ -524,10 +523,10 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * Acts like the Function builtin, but the code executes in the * userContext global. */ - userFunc: function userFunc() { + userFunc: function userFunc(...args) { return this.userEval( - "(function userFunction(" + Array.slice(arguments, 0, -1).join(", ") + ")" + - " { " + arguments[arguments.length - 1] + " })"); + "(function userFunction(" + args.slice(0, -1).join(", ") + ")" + + " { " + args.pop() + " })"); }, /** @@ -600,7 +599,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { if (win.frameElement) win.frameElement.blur(); // Grr. - if (content.document.activeElement instanceof HTMLIFrameElement) + if (content.document.activeElement instanceof Ci.nsIDOMHTMLIFrameElement) content.document.activeElement.blur(); }); } @@ -682,7 +681,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { tag = function (map) [ let (c = obj.modes[0].char) c ? c + "_" : "", map - ] + ]; link = function (map) { let [, mode, name, extra] = /^(?:(.)_)?(?:<([^>]+)>)?(.*)$/.exec(map); let k = ["k", {}, extra]; @@ -710,7 +709,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { let description = ["description", {}, obj.description ? ["p", {}, template.linkifyHelp(obj.description.replace(/\.?$/, "."), true)] : "", extraHelp ? extraHelp : "", - !(extraHelp || obj.description) ? ["p", {}, /*L*/ "Sorry, no help available."] : ""] + !(extraHelp || obj.description) ? ["p", {}, /*L*/ "Sorry, no help available."] : ""]; res.push( ["item", {}, @@ -1117,11 +1116,11 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { * @param {function} func The function to call * @param {object} self The 'this' object for the function. */ - trapErrors: function trapErrors(func, self) { + trapErrors: function trapErrors(func, self, ...args) { try { if (isString(func)) func = self[func]; - return func.apply(self || this, Array.slice(arguments, 2)); + return func.apply(self || this, args); } catch (e) { try { @@ -1200,7 +1199,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { dactyl.reportError(e, true); } }); - } + }; }, /** @@ -1404,10 +1403,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { groups.every(function (g) !g.validator || g.validator(val)) }); - options.add(["helpfile", "hf"], - "Name of the main help file", - "string", "intro"); - options.add(["loadplugins", "lpl"], "A regexp list that defines which plugins are loaded at startup and via :loadplugins", "regexplist", "'\\.(js|" + config.fileExtension + ")$'"); @@ -1829,7 +1824,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { commandline.commandOutput([ ["div", {}, [config.appName, " ", config.version, date, " running on: "].join("")], ["div", {}, [window.navigator.userAgent].join("")] - ]) + ]); } }, { argCount: "0", @@ -2003,4 +1998,4 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), { } }); -// vim: set fdm=marker sw=4 ts=4 et: +// vim: set fdm=marker sw=4 sts=4 ts=8 et: