diff --git a/common/content/abbreviations.js b/common/content/abbreviations.js index d41ccaff..5a9e2935 100644 --- a/common/content/abbreviations.js +++ b/common/content/abbreviations.js @@ -236,7 +236,7 @@ const Abbreviations = Module("abbreviations", { if (rhs) { if (args["-javascript"]) { let expr = rhs; - rhs = dactyl.userfunc("editor", expr); + rhs = dactyl.userFunc("editor", expr); rhs.toString = function () expr; } abbreviations.add(modes, lhs, rhs); diff --git a/common/content/autocommands.js b/common/content/autocommands.js index 3b43ad5a..74f8a614 100644 --- a/common/content/autocommands.js +++ b/common/content/autocommands.js @@ -174,7 +174,7 @@ const AutoCommands = Module("autocommands", { if (args.bang) autocommands.remove(event, regex); if (args["-javascript"]) - cmd = dactyl.userfunc("args", "with(args) {" + cmd + "}"); + cmd = dactyl.userFunc("args", "with(args) {" + cmd + "}"); autocommands.add(events, regex, cmd); } else { diff --git a/common/content/buffer.js b/common/content/buffer.js index 3765f7b0..ced26b1f 100644 --- a/common/content/buffer.js +++ b/common/content/buffer.js @@ -500,7 +500,7 @@ const Buffer = Module("buffer", { let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; win.dactylFocusAllowed = true; - if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement])) + if (isInstance(elem, [HTMLFrameElement, HTMLIFrameElement])) elem.contentWindow.focus(); else if (elem instanceof HTMLInputElement && elem.type == "file") { Buffer.openUploadPrompt(elem); @@ -592,7 +592,7 @@ const Buffer = Module("buffer", { let offsetX = 1; let offsetY = 1; - if (isinstance(elem, [HTMLFrameElement, HTMLIFrameElement])) { + if (isInstance(elem, [HTMLFrameElement, HTMLIFrameElement])) { buffer.focusElement(elem); return; } diff --git a/common/content/commandline.js b/common/content/commandline.js index 4416247a..9399b31f 100644 --- a/common/content/commandline.js +++ b/common/content/commandline.js @@ -497,7 +497,7 @@ const CommandLine = Module("commandline", { highlightGroup = highlightGroup || this.HL_NORMAL; if (flags & this.APPEND_TO_MESSAGES) { - let message = isobject(str) ? str : { message: str }; + let message = isObject(str) ? str : { message: str }; this._messageHistory.add(update({ highlight: highlightGroup }, message)); str = message.message; } @@ -1388,7 +1388,7 @@ const CommandLine = Module("commandline", { return ""; try { - arg = dactyl.usereval(arg); + arg = dactyl.userEval(arg); } catch (e) { dactyl.echoerr(e); diff --git a/common/content/commands.js b/common/content/commands.js index b9623754..03315902 100644 --- a/common/content/commands.js +++ b/common/content/commands.js @@ -934,7 +934,7 @@ const Commands = Module("commands", { try { let compObject = command.completer.call(command, cmdContext, args); - if (isarray(compObject)) // for now at least, let completion functions return arrays instead of objects + if (isArray(compObject)) // for now at least, let completion functions return arrays instead of objects compObject = { start: compObject[0], items: compObject[1] }; if (compObject != null) { cmdContext.advance(compObject.start); @@ -1004,7 +1004,7 @@ const Commands = Module("commands", { completeOpt = completeOpt.substr(7); completeFunc = function () { try { - var completer = dactyl.usereval(completeOpt); + var completer = dactyl.userEval(completeOpt); if (!callable(completer)) throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function"); diff --git a/common/content/completion.js b/common/content/completion.js index 3334055d..1d8c35be 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -262,7 +262,7 @@ const CompletionContext = Class("CompletionContext", { get completions() this._completions || [], set completions(items) { // Accept a generator - if (!isarray(items)) + if (!isArray(items)) items = [x for (x in Iterator(items))]; if (this._completions !== items) { delete this.cache.filtered; diff --git a/common/content/dactyl.js b/common/content/dactyl.js index c62be662..a9605542 100644 --- a/common/content/dactyl.js +++ b/common/content/dactyl.js @@ -252,11 +252,11 @@ const Dactyl = Module("dactyl", { echoerr: function echoerr(str, flags) { flags |= commandline.APPEND_TO_MESSAGES; - if (isinstance(str, ["Error", "Exception"])) + if (isInstance(str, ["Error", "Exception"])) dactyl.reportError(str); if (typeof str == "object" && "echoerr" in str) str = str.echoerr; - else if (isinstance(str, ["Error"])) + else if (isInstance(str, ["Error"])) str = str.fileName + ":" + str.lineNumber + ": " + str; if (options["errorbells"]) @@ -299,7 +299,7 @@ const Dactyl = Module("dactyl", { services.get("subscriptLoader").loadSubScript(uri, context); }, - usereval: function (str, context) { + userEval: function (str, context) { try { if (!context) context = userContext; @@ -328,8 +328,8 @@ const Dactyl = Module("dactyl", { * Acts like the Function builtin, but the code executes in the * userContext global. */ - userfunc: function () { - return this.usereval( + userFunc: function () { + return this.userEval( "(function (" + Array.slice(arguments, 0, -1).join(", ") + ") { " + arguments[arguments.length - 1] + " })"); @@ -338,7 +338,7 @@ const Dactyl = Module("dactyl", { // partial sixth level expression evaluation // TODO: what is that really needed for, and where could it be used? // Or should it be removed? (c) Viktor - // Better name? See other dactyl.usereval() + // Better name? See other dactyl.userEval() // I agree, the name is confusing, and so is the // description --Kris evalExpression: function (str) { @@ -839,7 +839,7 @@ const Dactyl = Module("dactyl", { }); params = params || {}; - if (isarray(params)) + if (isArray(params)) params = { where: params }; let flags = 0; @@ -1413,7 +1413,7 @@ const Dactyl = Module("dactyl", { "Execute the argument as an Ex command", function (args) { try { - let cmd = dactyl.usereval(args.string); + let cmd = dactyl.userEval(args.string); dactyl.execute(cmd, null, true); } catch (e) { @@ -1428,7 +1428,7 @@ const Dactyl = Module("dactyl", { getAddonByID: function (id, callback) { callback = callback || util.identity; let addon = id; - if (!isobject(addon)) + if (!isObject(addon)) addon = services.get("extensionManager").getItemForID(id); if (!addon) return callback(null); @@ -1714,7 +1714,7 @@ const Dactyl = Module("dactyl", { } else { try { - dactyl.usereval(args.string); + dactyl.userEval(args.string); } catch (e) { dactyl.echoerr(e); @@ -1807,7 +1807,7 @@ const Dactyl = Module("dactyl", { if (args[0] == ":") var method = function () dactyl.execute(args, null, true); else - method = dactyl.userfunc(args); + method = dactyl.userFunc(args); try { if (count > 1) { diff --git a/common/content/events.js b/common/content/events.js index 6958c9a4..0678cfc6 100644 --- a/common/content/events.js +++ b/common/content/events.js @@ -24,7 +24,7 @@ const Events = Module("events", { this._macros = storage.newMap("macros", { privateData: true, store: true }); for (let [k, m] in this._macros) - if (isstring(m)) + if (isString(m)) m = { keys: m, timeRecorded: Date.now() }; // NOTE: the order of ["Esc", "Escape"] or ["Escape", "Esc"] @@ -741,7 +741,7 @@ const Events = Module("events", { let win = elem.ownerDocument && elem.ownerDocument.defaultView || elem; if (Events.isContentNode(elem) && !buffer.focusAllowed(win) - && isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) + && isInstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) elem.blur(); }, @@ -773,7 +773,7 @@ const Events = Module("events", { return; } - if(isinstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) { + if(isInstance(elem, [HTMLEmbedElement, HTMLEmbedElement])) { dactyl.mode = modes.EMBED; return; } @@ -1118,7 +1118,7 @@ const Events = Module("events", { isInputElemFocused: function () { let elem = dactyl.focus; return elem instanceof HTMLInputElement && set.has(Events.editableInputs, elem.type) || - isinstance(elem, [HTMLIsIndexElement, HTMLEmbedElement, + isInstance(elem, [HTMLIsIndexElement, HTMLEmbedElement, HTMLObjectElement, HTMLTextAreaElement]); } }, { diff --git a/common/content/hints.js b/common/content/hints.js index c5e1d085..c48c3bb3 100644 --- a/common/content/hints.js +++ b/common/content/hints.js @@ -260,7 +260,7 @@ const Hints = Module("hints", { if (computedStyle.visibility != "visible" || computedStyle.display == "none") continue; - if (isinstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) + if (isInstance(elem, [HTMLInputElement, HTMLSelectElement, HTMLTextAreaElement])) [hint.text, hint.showText] = this._getInputHint(elem, doc); else hint.text = elem.textContent.toLowerCase(); diff --git a/common/content/io.js b/common/content/io.js index ec2076e8..d3b3886b 100644 --- a/common/content/io.js +++ b/common/content/io.js @@ -311,7 +311,7 @@ lookup: */ source: function (filename, silent) { let wasSourcing = this.sourcing; - defmodule.loadLog.push("sourcing " + filename); + defineModule.loadLog.push("sourcing " + filename); let time = Date.now(); try { var file = io.File(filename); @@ -343,7 +343,7 @@ lookup: dactyl.helpInitialized = false; } catch (e) { - if (isstring(e)) + if (isString(e)) e = { message: e }; let err = new Error(); for (let [k, v] in Iterator(e)) @@ -431,7 +431,7 @@ lookup: dactyl.echoerr(message); } finally { - defmodule.loadLog.push("done sourcing " + filename + ": " + (Date.now() - time) + "ms"); + defineModule.loadLog.push("done sourcing " + filename + ": " + (Date.now() - time) + "ms"); this.sourcing = wasSourcing; } }, diff --git a/common/content/javascript.js b/common/content/javascript.js index 04b33e96..7c29f69b 100644 --- a/common/content/javascript.js +++ b/common/content/javascript.js @@ -75,7 +75,7 @@ const JavaScript = Module("javascript", { context[JavaScript.EVAL_TMP] = tmp; try { - return cache[key] = dactyl.usereval(arg, context); + return cache[key] = dactyl.userEval(arg, context); } catch (e) { this.context.message = "Error: " + e; diff --git a/common/content/mappings.js b/common/content/mappings.js index afaa8057..fc67459b 100644 --- a/common/content/mappings.js +++ b/common/content/mappings.js @@ -31,7 +31,7 @@ */ const Map = Class("Map", { init: function (modes, keys, description, action, extraInfo) { - modes = Array.concat(modes).map(function (m) isobject(m) ? m.mask : m); + modes = Array.concat(modes).map(function (m) isObject(m) ? m.mask : m); this.id = ++Map.id; this.modes = modes; @@ -392,7 +392,7 @@ const Mappings = Module("mappings", { else { if (args["-javascript"]) { rhs = ["-javascript", rhs]; - var action = dactyl.userfunc("count", rhs); + var action = dactyl.userFunc("count", rhs); } else if (args["-ex"]) { rhs = ["-ex", rhs]; diff --git a/common/content/marks.js b/common/content/marks.js index e2c5a9e1..0cbbe39c 100644 --- a/common/content/marks.js +++ b/common/content/marks.js @@ -17,7 +17,7 @@ const Marks = Module("marks", { this._urlMarks = storage.newMap("url-marks", { privateData: true, replacer: replacer, store: true }); try { - if(isarray(Iterator(this._localMarks).next()[1])) + if(isArray(Iterator(this._localMarks).next()[1])) this._localMarks.clear(); } catch(e) {} diff --git a/common/content/modules.js b/common/content/modules.js index 82d46d0e..ad383e4f 100644 --- a/common/content/modules.js +++ b/common/content/modules.js @@ -15,7 +15,7 @@ const ModuleBase = Class("ModuleBase", { */ requires: [], - toString: function () "[module " + this.constructor.classname + "]" + toString: function () "[module " + this.constructor.className + "]" }); /** @@ -76,9 +76,9 @@ window.addEventListener("load", function onLoad() { window.removeEventListener("load", onLoad, false); Module.list.forEach(function (module) { - modules.__defineGetter__(module.classname, function () { - delete modules[module.classname]; - return load(module.classname, null, Components.stack.caller); + modules.__defineGetter__(module.className, function () { + delete modules[module.className]; + return load(module.className, null, Components.stack.caller); }); }); @@ -91,11 +91,11 @@ window.addEventListener("load", function onLoad() { function init(module) { function init(func, mod) - function () defmodule.time(module.classname || module.constructor.classname, mod, + function () defineModule.time(module.className || module.constructor.className, mod, func, module, dactyl, modules, window); - set.add(loaded, module.constructor.classname); + set.add(loaded, module.constructor.className); for (let [mod, func] in Iterator(module.INIT)) { if (mod in loaded) init(func, mod)(); @@ -105,45 +105,45 @@ window.addEventListener("load", function onLoad() { } } } - defmodule.modules.map(init); + defineModule.modules.map(init); function load(module, prereq, frame) { - if (isstring(module)) { + if (isString(module)) { if (!Module.constructors.hasOwnProperty(module)) modules.load(module); module = Module.constructors[module]; } try { - if (module.classname in loaded) + if (module.className in loaded) return; - if (module.classname in seen) + if (module.className in seen) throw Error("Module dependency loop."); - set.add(seen, module.classname); + set.add(seen, module.className); for (let dep in values(module.requires)) - load(Module.constructors[dep], module.classname); + load(Module.constructors[dep], module.className); - defmodule.loadLog.push("Load" + (isstring(prereq) ? " " + prereq + " dependency: " : ": ") + module.classname); + defineModule.loadLog.push("Load" + (isString(prereq) ? " " + prereq + " dependency: " : ": ") + module.className); if (frame && frame.filename) - defmodule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber); + defineModule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber); - delete modules[module.classname]; - modules[module.classname] = defmodule.time(module.classname, "init", module); + delete modules[module.className]; + modules[module.className] = defineModule.time(module.className, "init", module); - init(modules[module.classname]); - for (let [, fn] in iter(deferredInit[module.classname] || [])) + init(modules[module.className]); + for (let [, fn] in iter(deferredInit[module.className] || [])) fn(); } catch (e) { - dump("Loading " + (module && module.classname) + ": " + e + "\n" + (e.stack || "")); + dump("Loading " + (module && module.className) + ": " + e + "\n" + (e.stack || "")); } - return modules[module.classname]; + return modules[module.className]; } Module.list.forEach(load); deferredInit["load"].forEach(call); - modules.times = update({}, defmodule.times); + modules.times = update({}, defineModule.times); dump("Loaded in " + (Date.now() - start) + "ms"); }, false); diff --git a/common/content/options.js b/common/content/options.js index 9285b43b..ac58225c 100644 --- a/common/content/options.js +++ b/common/content/options.js @@ -1123,7 +1123,7 @@ const Options = Module("options", { if (context.filter.indexOf("=") == -1) { if (false && prefix) - context.filters.push(function ({ item }) item.type == "boolean" || prefix == "inv" && isarray(item.values)); + context.filters.push(function ({ item }) item.type == "boolean" || prefix == "inv" && isArray(item.values)); return completion.option(context, opt.scope, prefix); } @@ -1152,7 +1152,7 @@ const Options = Module("options", { completion.optionValue(optcontext, opt.name, opt.operator); // Fill in the current values if we're removing - if (opt.operator == "-" && isarray(opt.values)) { + if (opt.operator == "-" && isArray(opt.values)) { let have = set([i.text for (i in context.allItems)]); context = context.fork("current-values", 0); context.anchored = optcontext.anchored; @@ -1326,7 +1326,7 @@ const Options = Module("options", { context.completions = options; if (prefix == "inv") context.keys.text = function (opt) - opt.type == "boolean" || isarray(opt.values) ? opt.names.map(function (n) "inv" + n) + opt.type == "boolean" || isArray(opt.values) ? opt.names.map(function (n) "inv" + n) : opt.names; if (scope) context.filters.push(function ({ item }) item.scope & scope); @@ -1377,7 +1377,7 @@ const Options = Module("options", { context.title = ["Option Value"]; // Not Vim compatible, but is a significant enough improvement // that it's worth breaking compatibility. - if (isarray(newValues)) { + if (isArray(newValues)) { context.filters.push(function (i) newValues.indexOf(i.text) == -1); if (op == "+") context.filters.push(function (i) curValues.indexOf(i.text) == -1); diff --git a/common/modules/base.jsm b/common/modules/base.jsm index 94bec739..5e52dc1b 100644 --- a/common/modules/base.jsm +++ b/common/modules/base.jsm @@ -82,11 +82,11 @@ if (!Object.keys) let use = {}; let loaded = {}; let currentModule; -function defmodule(name, params) { +function defineModule(name, params) { let module = Cu.getGlobalForObject ? Cu.getGlobalForObject(params) : params.__parent__; module.NAME = name; module.EXPORTED_SYMBOLS = params.exports || []; - defmodule.loadLog.push("defmodule " + name); + defineModule.loadLog.push("defineModule " + name); for(let [, mod] in Iterator(params.require || [])) require(module, mod); @@ -100,25 +100,25 @@ function defmodule(name, params) { currentModule = module; } -defmodule.loadLog = []; -Object.defineProperty(defmodule.loadLog, "push", { value: function (val) { dump(val + "\n"); this[this.length] = val; } }); -defmodule.modules = []; -defmodule.times = { all: 0 }; -defmodule.time = function time(major, minor, func, self) { +defineModule.loadLog = []; +Object.defineProperty(defineModule.loadLog, "push", { value: function (val) { dump(val + "\n"); this[this.length] = val; } }); +defineModule.modules = []; +defineModule.times = { all: 0 }; +defineModule.time = function time(major, minor, func, self) { let time = Date.now(); let res = func.apply(self, Array.slice(arguments, 4)); let delta = Date.now() - time; - defmodule.times.all += delta; - defmodule.times[major] = (defmodule.times[major] || 0) + delta; + defineModule.times.all += delta; + defineModule.times[major] = (defineModule.times[major] || 0) + delta; if (minor) { - defmodule.times[":" + minor] = (defmodule.times[":" + minor] || 0) + delta; - defmodule.times[major + ":" + minor] = (defmodule.times[major + ":" + minor] || 0) + delta; + defineModule.times[":" + minor] = (defineModule.times[":" + minor] || 0) + delta; + defineModule.times[major + ":" + minor] = (defineModule.times[major + ":" + minor] || 0) + delta; } return res; } -function endmodule() { - defmodule.loadLog.push("endmodule " + currentModule.NAME); +function endModule() { + defineModule.loadLog.push("endModule " + currentModule.NAME); loaded[currentModule.NAME] = 1; for(let [, mod] in Iterator(use[currentModule.NAME] || [])) require(mod, currentModule.NAME, "use"); @@ -126,7 +126,7 @@ function endmodule() { function require(obj, name, from) { try { - defmodule.loadLog.push((from || "require") + ": loading " + name + " into " + obj.NAME); + defineModule.loadLog.push((from || "require") + ": loading " + name + " into " + obj.NAME); Cu.import("resource://dactyl/" + name + ".jsm", obj); } catch (e) { @@ -135,14 +135,14 @@ function require(obj, name, from) { } } -defmodule("base", { +defineModule("base", { // sed -n 's/^(const|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt exports: [ "Cc", "Ci", "Class", "Cr", "Cu", "Module", "Object", "Runnable", "Struct", "StructBase", "Timer", "UTF8", "XPCOMUtils", "array", - "call", "callable", "curry", "debuggerProperties", "defmodule", - "endmodule", "extend", "foreach", "isarray", "isgenerator", - "isinstance", "isobject", "isstring", "issubclass", "iter", "iterall", + "call", "callable", "curry", "debuggerProperties", "defineModule", + "endModule", "extend", "forEach", "isArray", "isGenerator", + "isInstance", "isObject", "isString", "isSubclass", "iter", "iterall", "keys", "memoize", "properties", "requiresMainThread", "set", "update", "values" ], @@ -231,7 +231,7 @@ function values(obj) { * @param {function} fn The callback. * @param {object} self The this object for 'fn'. */ -function foreach(iter, fn, self) { +function forEach(iter, fn, self) { for (let val in iter) fn.call(self, val); } @@ -341,7 +341,7 @@ set.remove = function (set, key) { * @returns {Generator} */ function iter(obj) { - if (isinstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList])) + if (isInstance(obj, [Ci.nsIDOMHTMLCollection, Ci.nsIDOMNodeList])) return array.iteritems(obj); if (obj instanceof Ci.nsIDOMNamedNodeMap) return (function () { @@ -382,7 +382,7 @@ function iter(obj) { * @param {function} src * @returns {boolean} */ -function issubclass(targ, src) { +function isSubclass(targ, src) { return src === targ || targ && typeof targ === "function" && targ.prototype instanceof src; } @@ -392,14 +392,14 @@ function issubclass(targ, src) { * 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 * 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 ]"). * * @param {object} targ The object to check. * @param {object|string|[object|string]} src The types to check targ against. * @returns {boolean} */ -function isinstance(targ, src) { +function isInstance(targ, src) { const types = { boolean: Boolean, string: String, @@ -416,7 +416,7 @@ function isinstance(targ, src) { if (targ instanceof src[i]) return true; var type = types[typeof targ]; - if (type && issubclass(src[i], type)) + if (type && isSubclass(src[i], type)) return true; } } @@ -426,7 +426,7 @@ function isinstance(targ, src) { /** * Returns true if obj is a non-null object. */ -function isobject(obj) typeof obj === "object" && obj != null; +function isObject(obj) typeof obj === "object" && obj != null; /** * Returns true if and only if its sole argument is an @@ -434,8 +434,8 @@ function isobject(obj) typeof obj === "object" && obj != null; * any window, frame, namespace, or execution context, which * is not the case when using (obj instanceof Array). */ -const isarray = Array.isArray || - function isarray(val) objproto.toString.call(val) == "[object Array]"; +const isArray = Array.isArray || + function isArray(val) objproto.toString.call(val) == "[object Array]"; /** * Returns true if and only if its sole argument is an @@ -443,7 +443,7 @@ const isarray = Array.isArray || * functions containing the 'yield' statement and generator * statements such as (x for (x in obj)). */ -function isgenerator(val) objproto.toString.call(val) == "[object Generator]"; +function isGenerator(val) objproto.toString.call(val) == "[object Generator]"; /** * Returns true if and only if its sole argument is a String, @@ -452,7 +452,7 @@ function isgenerator(val) objproto.toString.call(val) == "[object Generator]"; * namespace, or execution context, which is not the case when * using (obj instanceof String) or (typeof obj == "string"). */ -function isstring(val) objproto.toString.call(val) == "[object String]"; +function isString(val) objproto.toString.call(val) == "[object String]"; /** * Returns true if and only if its sole argument may be called @@ -631,7 +631,7 @@ function extend(subclass, superclass, overrides) { function Class() { var args = Array.slice(arguments); - if (isstring(args[0])) + if (isString(args[0])) var name = args.shift(); var superclass = Class; if (callable(args[0])) @@ -657,8 +657,8 @@ function Class() { var res = self.init.apply(self, arguments); return res !== undefined ? res : self; })]]>, - "constructor", (name || superclass.classname).replace(/\W/g, "_"))); - Constructor.classname = name || superclass.classname || superclass.name; + "constructor", (name || superclass.className).replace(/\W/g, "_"))); + Constructor.className = name || superclass.className || superclass.name; if ("init" in superclass.prototype) Constructor.__proto__ = superclass; @@ -686,7 +686,7 @@ Class.replaceProperty = function (obj, prop, value) { Object.defineProperty(obj, prop, { configurable: true, enumerable: true, value: value, writable: true }); return value; }; -Class.toString = function () "[class " + this.classname + "]"; +Class.toString = function () "[class " + this.className + "]"; Class.prototype = { /** * Initializes new instances of this class. Called automatically @@ -694,7 +694,7 @@ Class.prototype = { */ init: function () {}, - toString: function () "[instance " + this.constructor.classname + "]", + toString: function () "[instance " + this.constructor.className + "]", /** * Executes 'callback' after 'timeout' milliseconds. The value of @@ -727,10 +727,10 @@ function Module(name, prototype) { let init = callable(prototype) ? 4 : 3; const module = Class.apply(Class, Array.slice(arguments, 0, init)); let instance = module(); - module.classname = name.toLowerCase(); + module.className = name.toLowerCase(); instance.INIT = arguments[init] || {}; - currentModule[module.classname] = instance; - defmodule.modules.push(instance); + currentModule[module.className] = instance; + defineModule.modules.push(instance); return module; } if (Cu.getGlobalForObject) @@ -890,7 +890,7 @@ function UTF8(str) { */ const array = Class("array", Array, { init: function (ary) { - if (isinstance(ary, ["Iterator", "Generator"])) + if (isInstance(ary, ["Iterator", "Generator"])) ary = [k for (k in ary)]; else if (ary.length) ary = Array.slice(ary); @@ -900,7 +900,7 @@ const array = Class("array", Array, { __iterator__: function () this.iteritems(), __noSuchMethod__: function (meth, args) { var res = array[meth].apply(null, [this.array].concat(args)); - if (isarray(res)) + if (isArray(res)) return array(res); return res; }, @@ -1024,7 +1024,7 @@ const array = Class("array", Array, { } }); -endmodule(); +endModule(); // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);} diff --git a/common/modules/bookmarkcache.jsm b/common/modules/bookmarkcache.jsm index 1378c271..4ebbe3d3 100644 --- a/common/modules/bookmarkcache.jsm +++ b/common/modules/bookmarkcache.jsm @@ -5,7 +5,7 @@ "use strict"; Components.utils.import("resource://dactyl/base.jsm"); -defmodule("bookmarkcache", { +defineModule("bookmarkcache", { exports: ["Bookmark", "BookmarkCache", "Keyword", "bookmarkcache"], require: ["services", "storage", "util"] }); @@ -153,6 +153,6 @@ const BookmarkCache = Module("BookmarkCache", { } }); -endmodule(); +endModule(); // vim: set fdm=marker sw=4 sts=4 et ft=javascript: diff --git a/common/modules/highlight.jsm b/common/modules/highlight.jsm index 92644273..0f966f90 100644 --- a/common/modules/highlight.jsm +++ b/common/modules/highlight.jsm @@ -5,7 +5,7 @@ "use strict"; Components.utils.import("resource://dactyl/base.jsm"); -defmodule("highlight", { +defineModule("highlight", { exports: ["Highlight", "Highlights", "highlight"], require: ["services", "styles"], use: ["template", "util"] @@ -66,7 +66,7 @@ const Highlights = Module("Highlight", { _create: function (agent, args) { let obj = Highlight.apply(Highlight, args); - if (!isarray(obj[2])) + if (!isArray(obj[2])) obj[2] = obj[2].split(","); obj[5] = agent; @@ -337,6 +337,6 @@ const Highlights = Module("Highlight", { // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);} -endmodule(); +endModule(); // vim:se fdm=marker sw=4 ts=4 et ft=javascript: diff --git a/common/modules/sanitizer.jsm b/common/modules/sanitizer.jsm index f10810c5..d69c7785 100644 --- a/common/modules/sanitizer.jsm +++ b/common/modules/sanitizer.jsm @@ -15,7 +15,7 @@ // - finish 1.9.0 support if we're going to support sanitizing in Xulmus Components.utils.import("resource://dactyl/base.jsm"); -defmodule("sanitizer", { +defineModule("sanitizer", { exports: ["Range", "Sanitizer", "sanitizer"], require: ["services", "storage", "util"] }); @@ -324,7 +324,7 @@ const Sanitizer = Module("sanitizer", tmp.Sanitizer, { } }); -endmodule(); +endModule(); // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);} diff --git a/common/modules/services.jsm b/common/modules/services.jsm index fb97b35c..ce551879 100644 --- a/common/modules/services.jsm +++ b/common/modules/services.jsm @@ -5,7 +5,7 @@ "use strict"; Components.utils.import("resource://dactyl/base.jsm"); -defmodule("services", { +defineModule("services", { exports: ["Services", "services"] }); @@ -132,7 +132,7 @@ const Services = Module("Services", { } }); -endmodule(); +endModule(); // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);} diff --git a/common/modules/storage.jsm b/common/modules/storage.jsm index 4a06ce35..d30f18c6 100644 --- a/common/modules/storage.jsm +++ b/common/modules/storage.jsm @@ -6,7 +6,7 @@ const myObject = Object; Components.utils.import("resource://dactyl/base.jsm"); -defmodule("storage", { +defineModule("storage", { exports: ["File", "storage"], require: ["services", "util"] }); @@ -169,7 +169,7 @@ const Storage = Module("Storage", { alwaysReload: {}, newObject: function newObject(key, constructor, params) { - if (params == null || !isobject(params)) + if (params == null || !isObject(params)) throw Error("Invalid argument type"); if (!(key in keys) || params.reload || this.alwaysReload[key]) { @@ -559,7 +559,7 @@ const File = Class("File", { replacePathSep: function (path) path.replace("/", File.PATH_SEP, "g") }); -endmodule(); +endModule(); // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);} diff --git a/common/modules/styles.jsm b/common/modules/styles.jsm index 5e8dbd3e..997f4419 100644 --- a/common/modules/styles.jsm +++ b/common/modules/styles.jsm @@ -5,7 +5,7 @@ "use strict"; Components.utils.import("resource://dactyl/base.jsm"); -defmodule("styles", { +defineModule("styles", { exports: ["Style", "Styles", "styles"], require: ["services", "util"], use: ["template"] @@ -100,7 +100,7 @@ const Styles = Module("Styles", { let sheets = system ? this.systemSheets : this.userSheets; let names = system ? this.systemNames : this.userNames; - if (!isarray(filter)) + if (!isArray(filter)) filter = filter.split(","); if (name && name in names) { var sheet = names[name]; @@ -390,7 +390,7 @@ const Styles = Module("Styles", { } }); -endmodule(); +endModule(); // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);} diff --git a/common/modules/template.jsm b/common/modules/template.jsm index 8c129708..0f8302bf 100644 --- a/common/modules/template.jsm +++ b/common/modules/template.jsm @@ -5,7 +5,7 @@ "use strict"; Components.utils.import("resource://dactyl/base.jsm"); -defmodule("template", { +defineModule("template", { exports: ["Template", "template"], require: ["util"] }); @@ -308,6 +308,6 @@ const Template = Module("Template", { } }); -endmodule(); +endModule(); // vim: set fdm=marker sw=4 ts=4 et ft=javascript: diff --git a/common/modules/util.jsm b/common/modules/util.jsm index 8649de6d..8417fea5 100644 --- a/common/modules/util.jsm +++ b/common/modules/util.jsm @@ -7,7 +7,7 @@ "use strict"; Components.utils.import("resource://dactyl/base.jsm"); -defmodule("util", { +defineModule("util", { exports: ["Math", "NS", "Util", "XHTML", "XUL", "util"], require: ["services"], use: ["highlight", "template"] @@ -116,7 +116,7 @@ const Util = Module("Util", { * @returns {Object} */ cloneObject: function cloneObject(obj) { - if (isarray(obj)) + if (isArray(obj)) return obj.slice(); let newObj = {}; for (let [k, v] in Iterator(obj)) @@ -280,7 +280,7 @@ const Util = Module("Util", { doc = util.activeWindow.content.document; if (!elem) elem = doc; - if (isarray(expression)) + if (isArray(expression)) expression = util.makeXPath(expression); let result = doc.evaluate(expression, elem, @@ -581,7 +581,7 @@ const Util = Module("Util", { // window.content often does not want to be queried with "var i in object" 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) { object = Iterator(object); hasValue = false; @@ -593,7 +593,7 @@ const Util = Module("Util", { } catch (e) {} if (!hasValue) { - if (isarray(i) && i.length == 2) + if (isArray(i) && i.length == 2) [i, value] = i; else var noVal = true; @@ -853,6 +853,6 @@ var Math = update(Object.create(GlobalMath), { // catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);} -endmodule(); +endModule(); // vim: set fdm=marker sw=4 ts=4 et ft=javascript: