1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-21 00:28:00 +01:00

More camel-casing.

isInstance -> isinstance as homage to instanceof.
This commit is contained in:
Doug Kearns
2010-09-24 16:19:50 +10:00
parent a06b571058
commit 904f3cb974
14 changed files with 36 additions and 36 deletions

View File

@@ -164,7 +164,7 @@ AboutHandler.prototype = {
classID: Components.ID("81495d80-89ee-4c36-a88d-ea7c4e5ac63f"), classID: Components.ID("81495d80-89ee-4c36-a88d-ea7c4e5ac63f"),
contractID: "@mozilla.org/network/protocol/about;1?what=" + Dactyl.prototype.appname, contractID: "@mozilla.org/network/protocol/about;1?what=" + Dactyl.prototype.appName,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]), QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),

View File

@@ -500,7 +500,7 @@ const Buffer = Module("buffer", {
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
win.dactylFocusAllowed = true; win.dactylFocusAllowed = true;
if (isInstance(elem, [HTMLFrameElement, HTMLIFrameElement])) if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement]))
elem.contentWindow.focus(); elem.contentWindow.focus();
else if (elem instanceof HTMLInputElement && elem.type == "file") { else if (elem instanceof HTMLInputElement && elem.type == "file") {
Buffer.openUploadPrompt(elem); Buffer.openUploadPrompt(elem);
@@ -592,7 +592,7 @@ const Buffer = Module("buffer", {
let offsetX = 1; let offsetX = 1;
let offsetY = 1; let offsetY = 1;
if (isInstance(elem, [HTMLFrameElement, HTMLIFrameElement])) { if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement])) {
buffer.focusElement(elem); buffer.focusElement(elem);
return; return;
} }

View File

@@ -321,7 +321,7 @@ const CompletionContext = Class("CompletionContext", {
yield ["result", quote ? function () quote[0] + quote[1](this.text) + quote[2] yield ["result", quote ? function () quote[0] + quote[1](this.text) + quote[2]
: function () this.text]; : function () this.text];
}; };
for (let i in iterall(this.keys, result(this.quote))) { for (let i in iterAll(this.keys, result(this.quote))) {
let [k, v] = i; let [k, v] = i;
if (typeof v == "string" && /^[.[]/.test(v)) if (typeof v == "string" && /^[.[]/.test(v))
// This is only allowed to be a simple accessor, and shouldn't // This is only allowed to be a simple accessor, and shouldn't

View File

@@ -13,8 +13,8 @@ const ConfigBase = Class(ModuleBase, {
*/ */
init: function () { init: function () {
this.name = services.get("dactyl:").name; this.name = services.get("dactyl:").name;
this.idname = services.get("dactyl:").idname; this.idName = services.get("dactyl:").idName;
this.appname = services.get("dactyl:").appname; this.appName = services.get("dactyl:").appName;
this.host = services.get("dactyl:").host; this.host = services.get("dactyl:").host;
highlight.styleableChrome = this.styleableChrome; highlight.styleableChrome = this.styleableChrome;

View File

@@ -252,11 +252,11 @@ const Dactyl = Module("dactyl", {
echoerr: function echoerr(str, flags) { echoerr: function echoerr(str, flags) {
flags |= commandline.APPEND_TO_MESSAGES; flags |= commandline.APPEND_TO_MESSAGES;
if (isInstance(str, ["Error", "Exception"])) if (isinstance(str, ["Error", "Exception"]))
dactyl.reportError(str); dactyl.reportError(str);
if (typeof str == "object" && "echoerr" in str) if (typeof str == "object" && "echoerr" in str)
str = str.echoerr; str = str.echoerr;
else if (isInstance(str, ["Error"])) else if (isinstance(str, ["Error"]))
str = str.fileName + ":" + str.lineNumber + ": " + str; str = str.fileName + ":" + str.lineNumber + ": " + str;
if (options["errorbells"]) if (options["errorbells"])
@@ -552,7 +552,7 @@ const Dactyl = Module("dactyl", {
'<?xml-stylesheet type="text/xsl" href="chrome://dactyl/content/help.xsl"?>\n' + '<?xml-stylesheet type="text/xsl" href="chrome://dactyl/content/help.xsl"?>\n' +
'<!DOCTYPE document SYSTEM "chrome://dactyl/content/dactyl.dtd">\n' + '<!DOCTYPE document SYSTEM "chrome://dactyl/content/dactyl.dtd">\n' +
<document xmlns={NS} <document xmlns={NS}
name="plugins" title={config.appname + " Plugins"}> name="plugins" title={config.appName + " Plugins"}>
<h1 tag="using-plugins">Using Plugins</h1> <h1 tag="using-plugins">Using Plugins</h1>
<toc start="2"/> <toc start="2"/>
@@ -1371,7 +1371,7 @@ const Dactyl = Module("dactyl", {
{ argCount: "0" }); { argCount: "0" });
commands.add(["dia[log]"], commands.add(["dia[log]"],
"Open a " + config.appname + " dialog", "Open a " + config.appName + " dialog",
function (args) { function (args) {
let dialog = args[0]; let dialog = args[0];
@@ -1761,7 +1761,7 @@ const Dactyl = Module("dactyl", {
}); });
commands.add(["res[tart]"], commands.add(["res[tart]"],
"Force " + config.appname + " to restart", "Force " + config.appName + " to restart",
function () { dactyl.restart(); }, function () { dactyl.restart(); },
{ argCount: "0" }); { argCount: "0" });
@@ -1913,7 +1913,7 @@ const Dactyl = Module("dactyl", {
dactyl.open("about:"); dactyl.open("about:");
else else
commandline.commandOutput(<> commandline.commandOutput(<>
{config.appname} {dactyl.version} running on:<br/>{navigator.userAgent} {config.appName} {dactyl.version} running on:<br/>{navigator.userAgent}
</>); </>);
}, { }, {
argCount: "0", argCount: "0",
@@ -2025,7 +2025,7 @@ const Dactyl = Module("dactyl", {
// finally, read the RC file and source plugins // finally, read the RC file and source plugins
// make sourcing asynchronous, otherwise commands that open new tabs won't work // make sourcing asynchronous, otherwise commands that open new tabs won't work
util.timeout(function () { util.timeout(function () {
let init = services.get("environment").get(config.idname + "_INIT"); let init = services.get("environment").get(config.idName + "_INIT");
let rcFile = io.getRCFile("~"); let rcFile = io.getRCFile("~");
try { try {
@@ -2040,7 +2040,7 @@ const Dactyl = Module("dactyl", {
else { else {
if (rcFile) { if (rcFile) {
io.source(rcFile.path, true); io.source(rcFile.path, true);
services.get("environment").set("MY_" + config.idname + "RC", rcFile.path); services.get("environment").set("MY_" + config.idName + "RC", rcFile.path);
} }
else else
dactyl.log("No user RC file found", 3); dactyl.log("No user RC file found", 3);
@@ -2089,7 +2089,7 @@ const Dactyl = Module("dactyl", {
}, 0); }, 0);
statusline.update(); statusline.update();
dactyl.log(config.appname + " fully initialized", 0); dactyl.log(config.appName + " fully initialized", 0);
dactyl.initialized = true; dactyl.initialized = true;
} }
}); });

View File

@@ -741,7 +741,7 @@ const Events = Module("events", {
let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem;
if (Events.isContentNode(elem) && !buffer.focusAllowed(win) if (Events.isContentNode(elem) && !buffer.focusAllowed(win)
&& isInstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
elem.blur(); elem.blur();
}, },
@@ -773,7 +773,7 @@ const Events = Module("events", {
return; return;
} }
if(isInstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) { if(isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) {
dactyl.mode = modes.EMBED; dactyl.mode = modes.EMBED;
return; return;
} }
@@ -1118,7 +1118,7 @@ const Events = Module("events", {
isInputElemFocused: function () { isInputElemFocused: function () {
let elem = dactyl.focus; let elem = dactyl.focus;
return elem instanceof HTMLInputElement && set.has(Events.editableInputs, elem.type) || return elem instanceof HTMLInputElement && set.has(Events.editableInputs, elem.type) ||
isInstance(elem, [HTMLIsIndexElement, HTMLEmbedElement, isinstance(elem, [HTMLIsIndexElement, HTMLEmbedElement,
HTMLObjectElement, HTMLTextAreaElement]); HTMLObjectElement, HTMLTextAreaElement]);
} }
}, { }, {
@@ -1173,7 +1173,7 @@ const Events = Module("events", {
function () { document.commandDispatcher.rewindFocus(); }); function () { document.commandDispatcher.rewindFocus(); });
mappings.add(modes.all, mappings.add(modes.all,
["<C-z>"], "Temporarily ignore all " + config.appname + " key bindings", ["<C-z>"], "Temporarily ignore all " + config.appName + " key bindings",
function () { modes.passAllKeys = true; }); function () { modes.passAllKeys = true; });
mappings.add(modes.all, mappings.add(modes.all,

View File

@@ -260,7 +260,7 @@ const Hints = Module("hints", {
if (computedStyle.visibility != "visible" || computedStyle.display == "none") if (computedStyle.visibility != "visible" || computedStyle.display == "none")
continue; continue;
if (isInstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) if (isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement]))
[hint.text, hint.showText] = this._getInputHint(elem, doc); [hint.text, hint.showText] = this._getInputHint(elem, doc);
else else
hint.text = elem.textContent.toLowerCase(); hint.text = elem.textContent.toLowerCase();

View File

@@ -508,7 +508,7 @@ lookup:
* variable. * variable.
*/ */
get runtimePath() { get runtimePath() {
const rtpvar = config.idname + "_RUNTIME"; const rtpvar = config.idName + "_RUNTIME";
let rtp = services.get("environment").get(rtpvar); let rtp = services.get("environment").get(rtpvar);
if (!rtp) { if (!rtp) {
rtp = "~/" + (dactyl.has("WINNT") ? "" : ".") + config.name; rtp = "~/" + (dactyl.has("WINNT") ? "" : ".") + config.name;

View File

@@ -712,7 +712,7 @@ const Tabs = Module("tabs", {
}); });
commands.add(["quita[ll]", "qa[ll]"], commands.add(["quita[ll]", "qa[ll]"],
"Quit " + config.appname, "Quit " + config.appName,
function (args) { dactyl.quit(false, args.bang); }, { function (args) { dactyl.quit(false, args.bang); }, {
argCount: "0", argCount: "0",
bang: true bang: true

View File

@@ -142,7 +142,7 @@ defineModule("base", {
"Struct", "StructBase", "Timer", "UTF8", "XPCOMUtils", "array", "Struct", "StructBase", "Timer", "UTF8", "XPCOMUtils", "array",
"call", "callable", "curry", "debuggerProperties", "defineModule", "call", "callable", "curry", "debuggerProperties", "defineModule",
"endModule", "extend", "forEach", "isArray", "isGenerator", "endModule", "extend", "forEach", "isArray", "isGenerator",
"isInstance", "isObject", "isString", "isSubclass", "iter", "iterall", "isinstance", "isObject", "isString", "isSubclass", "iter", "iterAll",
"keys", "memoize", "properties", "requiresMainThread", "set", "keys", "memoize", "properties", "requiresMainThread", "set",
"update", "values" "update", "values"
], ],
@@ -241,7 +241,7 @@ function forEach(iter, fn, self) {
* *
* @returns {Generator} * @returns {Generator}
*/ */
function iterall() { function iterAll() {
for (let i = 0; i < arguments.length; i++) for (let i = 0; i < arguments.length; i++)
for (let j in Iterator(arguments[i])) for (let j in Iterator(arguments[i]))
yield j; yield j;
@@ -341,7 +341,7 @@ set.remove = function (set, key) {
* @returns {Generator} * @returns {Generator}
*/ */
function iter(obj) { function iter(obj) {
if (isInstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList])) if (isinstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList]))
return array.iteritems(obj); return array.iteritems(obj);
if (obj instanceof Ci.nsIDOMNamedNodeMap) if (obj instanceof Ci.nsIDOMNamedNodeMap)
return (function () { return (function () {
@@ -392,14 +392,14 @@ function isSubclass(targ, src) {
* returns true if targ is an instance of any element of src. If src is * returns true if targ is an instance of any element of src. If src is
* the object form of a primitive type, returns true if targ is a * the object form of a primitive type, returns true if targ is a
* non-boxed version of the type, i.e., if (typeof targ == "string"), * non-boxed version of the type, i.e., if (typeof targ == "string"),
* isInstance(targ, String) is true. Finally, if src is a string, * isinstance(targ, String) is true. Finally, if src is a string,
* returns true if ({}.toString.call(targ) == "[object <src>]"). * returns true if ({}.toString.call(targ) == "[object <src>]").
* *
* @param {object} targ The object to check. * @param {object} targ The object to check.
* @param {object|string|[object|string]} src The types to check targ against. * @param {object|string|[object|string]} src The types to check targ against.
* @returns {boolean} * @returns {boolean}
*/ */
function isInstance(targ, src) { function isinstance(targ, src) {
const types = { const types = {
boolean: Boolean, boolean: Boolean,
string: String, string: String,
@@ -645,7 +645,7 @@ function Class() {
configurable: true, configurable: true,
get: function () { get: function () {
function closure(fn) function () fn.apply(self, arguments); function closure(fn) function () fn.apply(self, arguments);
for (let k in iterall(properties(this), for (let k in iterAll(properties(this),
properties(this, true))) properties(this, true)))
if (!this.__lookupGetter__(k) && callable(this[k])) if (!this.__lookupGetter__(k) && callable(this[k]))
closure[k] = closure(self[k]); closure[k] = closure(self[k]);
@@ -890,7 +890,7 @@ function UTF8(str) {
*/ */
const array = Class("array", Array, { const array = Class("array", Array, {
init: function (ary) { init: function (ary) {
if (isInstance(ary, ["Iterator", "Generator"])) if (isinstance(ary, ["Iterator", "Generator"]))
ary = [k for (k in ary)]; ary = [k for (k in ary)];
else if (ary.length) else if (ary.length)
ary = Array.slice(ary); ary = Array.slice(ary);

View File

@@ -581,7 +581,7 @@ const Util = Module("Util", {
// window.content often does not want to be queried with "var i in object" // window.content often does not want to be queried with "var i in object"
try { try {
let hasValue = !("__iterator__" in object || isInstance(object, ["Generator", "Iterator"])); let hasValue = !("__iterator__" in object || isinstance(object, ["Generator", "Iterator"]));
if (object.dactyl && object.modules && object.modules.modules == object.modules) { if (object.dactyl && object.modules && object.modules.modules == object.modules) {
object = Iterator(object); object = Iterator(object);
hasValue = false; hasValue = false;

View File

@@ -18,9 +18,9 @@ Dactyl.prototype = {
classDescription: "Dactyl component base definitions", classDescription: "Dactyl component base definitions",
QueryInterface: XPCOMUtils.generateQI([]), QueryInterface: XPCOMUtils.generateQI([]),
appname: "Pentadactyl", appName: "Pentadactyl",
name: "pentadactyl", name: "pentadactyl",
idname: "PENTADACTYL", idName: "PENTADACTYL",
host: "Firefox" host: "Firefox"
}; };

View File

@@ -18,9 +18,9 @@ Dactyl.prototype = {
classDescription: "Dactyl component base definitions", classDescription: "Dactyl component base definitions",
QueryInterface: XPCOMUtils.generateQI([]), QueryInterface: XPCOMUtils.generateQI([]),
appname: "Teledactyl", appName: "Teledactyl",
name: "teledactyl", name: "teledactyl",
idname: "TELEDACTYL", idName: "TELEDACTYL",
host: "Thunderbird" host: "Thunderbird"
}; };

View File

@@ -18,9 +18,9 @@ Dactyl.prototype = {
classDescription: "Dactyl component base definitions", classDescription: "Dactyl component base definitions",
QueryInterface: XPCOMUtils.generateQI([]), QueryInterface: XPCOMUtils.generateQI([]),
appname: "Xulmus", appName: "Xulmus",
name: "xulmus", name: "xulmus",
idname: "XULMUS", idName: "XULMUS",
host: "Songbird" host: "Songbird"
}; };