mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 16:17:59 +01:00
Camel-case some identifiers gone rogue.
Do not free a camel of the burden of his hump; you may be freeing him from being a camel. - G. K. Chesterton
This commit is contained in:
@@ -236,7 +236,7 @@ const Abbreviations = Module("abbreviations", {
|
|||||||
if (rhs) {
|
if (rhs) {
|
||||||
if (args["-javascript"]) {
|
if (args["-javascript"]) {
|
||||||
let expr = rhs;
|
let expr = rhs;
|
||||||
rhs = dactyl.userfunc("editor", expr);
|
rhs = dactyl.userFunc("editor", expr);
|
||||||
rhs.toString = function () expr;
|
rhs.toString = function () expr;
|
||||||
}
|
}
|
||||||
abbreviations.add(modes, lhs, rhs);
|
abbreviations.add(modes, lhs, rhs);
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ const AutoCommands = Module("autocommands", {
|
|||||||
if (args.bang)
|
if (args.bang)
|
||||||
autocommands.remove(event, regex);
|
autocommands.remove(event, regex);
|
||||||
if (args["-javascript"])
|
if (args["-javascript"])
|
||||||
cmd = dactyl.userfunc("args", "with(args) {" + cmd + "}");
|
cmd = dactyl.userFunc("args", "with(args) {" + cmd + "}");
|
||||||
autocommands.add(events, regex, cmd);
|
autocommands.add(events, regex, cmd);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ const CommandLine = Module("commandline", {
|
|||||||
highlightGroup = highlightGroup || this.HL_NORMAL;
|
highlightGroup = highlightGroup || this.HL_NORMAL;
|
||||||
|
|
||||||
if (flags & this.APPEND_TO_MESSAGES) {
|
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));
|
this._messageHistory.add(update({ highlight: highlightGroup }, message));
|
||||||
str = message.message;
|
str = message.message;
|
||||||
}
|
}
|
||||||
@@ -1388,7 +1388,7 @@ const CommandLine = Module("commandline", {
|
|||||||
return "";
|
return "";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
arg = dactyl.usereval(arg);
|
arg = dactyl.userEval(arg);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dactyl.echoerr(e);
|
dactyl.echoerr(e);
|
||||||
|
|||||||
@@ -934,7 +934,7 @@ const Commands = Module("commands", {
|
|||||||
try {
|
try {
|
||||||
let compObject = command.completer.call(command, cmdContext, args);
|
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] };
|
compObject = { start: compObject[0], items: compObject[1] };
|
||||||
if (compObject != null) {
|
if (compObject != null) {
|
||||||
cmdContext.advance(compObject.start);
|
cmdContext.advance(compObject.start);
|
||||||
@@ -1004,7 +1004,7 @@ const Commands = Module("commands", {
|
|||||||
completeOpt = completeOpt.substr(7);
|
completeOpt = completeOpt.substr(7);
|
||||||
completeFunc = function () {
|
completeFunc = function () {
|
||||||
try {
|
try {
|
||||||
var completer = dactyl.usereval(completeOpt);
|
var completer = dactyl.userEval(completeOpt);
|
||||||
|
|
||||||
if (!callable(completer))
|
if (!callable(completer))
|
||||||
throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function");
|
throw new TypeError("User-defined custom completer " + completeOpt.quote() + " is not a function");
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ const CompletionContext = Class("CompletionContext", {
|
|||||||
get completions() this._completions || [],
|
get completions() this._completions || [],
|
||||||
set completions(items) {
|
set completions(items) {
|
||||||
// Accept a generator
|
// Accept a generator
|
||||||
if (!isarray(items))
|
if (!isArray(items))
|
||||||
items = [x for (x in Iterator(items))];
|
items = [x for (x in Iterator(items))];
|
||||||
if (this._completions !== items) {
|
if (this._completions !== items) {
|
||||||
delete this.cache.filtered;
|
delete this.cache.filtered;
|
||||||
|
|||||||
@@ -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"])
|
||||||
@@ -299,7 +299,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
services.get("subscriptLoader").loadSubScript(uri, context);
|
services.get("subscriptLoader").loadSubScript(uri, context);
|
||||||
},
|
},
|
||||||
|
|
||||||
usereval: function (str, context) {
|
userEval: function (str, context) {
|
||||||
try {
|
try {
|
||||||
if (!context)
|
if (!context)
|
||||||
context = userContext;
|
context = userContext;
|
||||||
@@ -328,8 +328,8 @@ const Dactyl = Module("dactyl", {
|
|||||||
* Acts like the Function builtin, but the code executes in the
|
* Acts like the Function builtin, but the code executes in the
|
||||||
* userContext global.
|
* userContext global.
|
||||||
*/
|
*/
|
||||||
userfunc: function () {
|
userFunc: function () {
|
||||||
return this.usereval(
|
return this.userEval(
|
||||||
"(function (" +
|
"(function (" +
|
||||||
Array.slice(arguments, 0, -1).join(", ") +
|
Array.slice(arguments, 0, -1).join(", ") +
|
||||||
") { " + arguments[arguments.length - 1] + " })");
|
") { " + arguments[arguments.length - 1] + " })");
|
||||||
@@ -338,7 +338,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
// partial sixth level expression evaluation
|
// partial sixth level expression evaluation
|
||||||
// TODO: what is that really needed for, and where could it be used?
|
// TODO: what is that really needed for, and where could it be used?
|
||||||
// Or should it be removed? (c) Viktor
|
// 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
|
// I agree, the name is confusing, and so is the
|
||||||
// description --Kris
|
// description --Kris
|
||||||
evalExpression: function (str) {
|
evalExpression: function (str) {
|
||||||
@@ -839,7 +839,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
});
|
});
|
||||||
|
|
||||||
params = params || {};
|
params = params || {};
|
||||||
if (isarray(params))
|
if (isArray(params))
|
||||||
params = { where: params };
|
params = { where: params };
|
||||||
|
|
||||||
let flags = 0;
|
let flags = 0;
|
||||||
@@ -1413,7 +1413,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
"Execute the argument as an Ex command",
|
"Execute the argument as an Ex command",
|
||||||
function (args) {
|
function (args) {
|
||||||
try {
|
try {
|
||||||
let cmd = dactyl.usereval(args.string);
|
let cmd = dactyl.userEval(args.string);
|
||||||
dactyl.execute(cmd, null, true);
|
dactyl.execute(cmd, null, true);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
@@ -1428,7 +1428,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
getAddonByID: function (id, callback) {
|
getAddonByID: function (id, callback) {
|
||||||
callback = callback || util.identity;
|
callback = callback || util.identity;
|
||||||
let addon = id;
|
let addon = id;
|
||||||
if (!isobject(addon))
|
if (!isObject(addon))
|
||||||
addon = services.get("extensionManager").getItemForID(id);
|
addon = services.get("extensionManager").getItemForID(id);
|
||||||
if (!addon)
|
if (!addon)
|
||||||
return callback(null);
|
return callback(null);
|
||||||
@@ -1714,7 +1714,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
dactyl.usereval(args.string);
|
dactyl.userEval(args.string);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dactyl.echoerr(e);
|
dactyl.echoerr(e);
|
||||||
@@ -1807,7 +1807,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
if (args[0] == ":")
|
if (args[0] == ":")
|
||||||
var method = function () dactyl.execute(args, null, true);
|
var method = function () dactyl.execute(args, null, true);
|
||||||
else
|
else
|
||||||
method = dactyl.userfunc(args);
|
method = dactyl.userFunc(args);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const Events = Module("events", {
|
|||||||
|
|
||||||
this._macros = storage.newMap("macros", { privateData: true, store: true });
|
this._macros = storage.newMap("macros", { privateData: true, store: true });
|
||||||
for (let [k, m] in this._macros)
|
for (let [k, m] in this._macros)
|
||||||
if (isstring(m))
|
if (isString(m))
|
||||||
m = { keys: m, timeRecorded: Date.now() };
|
m = { keys: m, timeRecorded: Date.now() };
|
||||||
|
|
||||||
// NOTE: the order of ["Esc", "Escape"] or ["Escape", "Esc"]
|
// 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;
|
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]);
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ lookup:
|
|||||||
*/
|
*/
|
||||||
source: function (filename, silent) {
|
source: function (filename, silent) {
|
||||||
let wasSourcing = this.sourcing;
|
let wasSourcing = this.sourcing;
|
||||||
defmodule.loadLog.push("sourcing " + filename);
|
defineModule.loadLog.push("sourcing " + filename);
|
||||||
let time = Date.now();
|
let time = Date.now();
|
||||||
try {
|
try {
|
||||||
var file = io.File(filename);
|
var file = io.File(filename);
|
||||||
@@ -343,7 +343,7 @@ lookup:
|
|||||||
dactyl.helpInitialized = false;
|
dactyl.helpInitialized = false;
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (isstring(e))
|
if (isString(e))
|
||||||
e = { message: e };
|
e = { message: e };
|
||||||
let err = new Error();
|
let err = new Error();
|
||||||
for (let [k, v] in Iterator(e))
|
for (let [k, v] in Iterator(e))
|
||||||
@@ -431,7 +431,7 @@ lookup:
|
|||||||
dactyl.echoerr(message);
|
dactyl.echoerr(message);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
defmodule.loadLog.push("done sourcing " + filename + ": " + (Date.now() - time) + "ms");
|
defineModule.loadLog.push("done sourcing " + filename + ": " + (Date.now() - time) + "ms");
|
||||||
this.sourcing = wasSourcing;
|
this.sourcing = wasSourcing;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ const JavaScript = Module("javascript", {
|
|||||||
|
|
||||||
context[JavaScript.EVAL_TMP] = tmp;
|
context[JavaScript.EVAL_TMP] = tmp;
|
||||||
try {
|
try {
|
||||||
return cache[key] = dactyl.usereval(arg, context);
|
return cache[key] = dactyl.userEval(arg, context);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
this.context.message = "Error: " + e;
|
this.context.message = "Error: " + e;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
const Map = Class("Map", {
|
const Map = Class("Map", {
|
||||||
init: function (modes, keys, description, action, extraInfo) {
|
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.id = ++Map.id;
|
||||||
this.modes = modes;
|
this.modes = modes;
|
||||||
@@ -392,7 +392,7 @@ const Mappings = Module("mappings", {
|
|||||||
else {
|
else {
|
||||||
if (args["-javascript"]) {
|
if (args["-javascript"]) {
|
||||||
rhs = ["-javascript", rhs];
|
rhs = ["-javascript", rhs];
|
||||||
var action = dactyl.userfunc("count", rhs);
|
var action = dactyl.userFunc("count", rhs);
|
||||||
}
|
}
|
||||||
else if (args["-ex"]) {
|
else if (args["-ex"]) {
|
||||||
rhs = ["-ex", rhs];
|
rhs = ["-ex", rhs];
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ const Marks = Module("marks", {
|
|||||||
this._urlMarks = storage.newMap("url-marks", { privateData: true, replacer: replacer, store: true });
|
this._urlMarks = storage.newMap("url-marks", { privateData: true, replacer: replacer, store: true });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if(isarray(Iterator(this._localMarks).next()[1]))
|
if(isArray(Iterator(this._localMarks).next()[1]))
|
||||||
this._localMarks.clear();
|
this._localMarks.clear();
|
||||||
}
|
}
|
||||||
catch(e) {}
|
catch(e) {}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const ModuleBase = Class("ModuleBase", {
|
|||||||
*/
|
*/
|
||||||
requires: [],
|
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);
|
window.removeEventListener("load", onLoad, false);
|
||||||
|
|
||||||
Module.list.forEach(function (module) {
|
Module.list.forEach(function (module) {
|
||||||
modules.__defineGetter__(module.classname, function () {
|
modules.__defineGetter__(module.className, function () {
|
||||||
delete modules[module.classname];
|
delete modules[module.className];
|
||||||
return load(module.classname, null, Components.stack.caller);
|
return load(module.className, null, Components.stack.caller);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,11 +91,11 @@ window.addEventListener("load", function onLoad() {
|
|||||||
|
|
||||||
function init(module) {
|
function init(module) {
|
||||||
function init(func, mod)
|
function init(func, mod)
|
||||||
function () defmodule.time(module.classname || module.constructor.classname, mod,
|
function () defineModule.time(module.className || module.constructor.className, mod,
|
||||||
func, module,
|
func, module,
|
||||||
dactyl, modules, window);
|
dactyl, modules, window);
|
||||||
|
|
||||||
set.add(loaded, module.constructor.classname);
|
set.add(loaded, module.constructor.className);
|
||||||
for (let [mod, func] in Iterator(module.INIT)) {
|
for (let [mod, func] in Iterator(module.INIT)) {
|
||||||
if (mod in loaded)
|
if (mod in loaded)
|
||||||
init(func, mod)();
|
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) {
|
function load(module, prereq, frame) {
|
||||||
if (isstring(module)) {
|
if (isString(module)) {
|
||||||
if (!Module.constructors.hasOwnProperty(module))
|
if (!Module.constructors.hasOwnProperty(module))
|
||||||
modules.load(module);
|
modules.load(module);
|
||||||
module = Module.constructors[module];
|
module = Module.constructors[module];
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (module.classname in loaded)
|
if (module.className in loaded)
|
||||||
return;
|
return;
|
||||||
if (module.classname in seen)
|
if (module.className in seen)
|
||||||
throw Error("Module dependency loop.");
|
throw Error("Module dependency loop.");
|
||||||
set.add(seen, module.classname);
|
set.add(seen, module.className);
|
||||||
|
|
||||||
for (let dep in values(module.requires))
|
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)
|
if (frame && frame.filename)
|
||||||
defmodule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
|
defineModule.loadLog.push(" from: " + frame.filename + ":" + frame.lineNumber);
|
||||||
|
|
||||||
delete modules[module.classname];
|
delete modules[module.className];
|
||||||
modules[module.classname] = defmodule.time(module.classname, "init", module);
|
modules[module.className] = defineModule.time(module.className, "init", module);
|
||||||
|
|
||||||
init(modules[module.classname]);
|
init(modules[module.className]);
|
||||||
for (let [, fn] in iter(deferredInit[module.classname] || []))
|
for (let [, fn] in iter(deferredInit[module.className] || []))
|
||||||
fn();
|
fn();
|
||||||
}
|
}
|
||||||
catch (e) {
|
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);
|
Module.list.forEach(load);
|
||||||
deferredInit["load"].forEach(call);
|
deferredInit["load"].forEach(call);
|
||||||
modules.times = update({}, defmodule.times);
|
modules.times = update({}, defineModule.times);
|
||||||
|
|
||||||
dump("Loaded in " + (Date.now() - start) + "ms");
|
dump("Loaded in " + (Date.now() - start) + "ms");
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
@@ -1123,7 +1123,7 @@ const Options = Module("options", {
|
|||||||
|
|
||||||
if (context.filter.indexOf("=") == -1) {
|
if (context.filter.indexOf("=") == -1) {
|
||||||
if (false && prefix)
|
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);
|
return completion.option(context, opt.scope, prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1152,7 +1152,7 @@ const Options = Module("options", {
|
|||||||
completion.optionValue(optcontext, opt.name, opt.operator);
|
completion.optionValue(optcontext, opt.name, opt.operator);
|
||||||
|
|
||||||
// Fill in the current values if we're removing
|
// 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)]);
|
let have = set([i.text for (i in context.allItems)]);
|
||||||
context = context.fork("current-values", 0);
|
context = context.fork("current-values", 0);
|
||||||
context.anchored = optcontext.anchored;
|
context.anchored = optcontext.anchored;
|
||||||
@@ -1326,7 +1326,7 @@ const Options = Module("options", {
|
|||||||
context.completions = options;
|
context.completions = options;
|
||||||
if (prefix == "inv")
|
if (prefix == "inv")
|
||||||
context.keys.text = function (opt)
|
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;
|
: opt.names;
|
||||||
if (scope)
|
if (scope)
|
||||||
context.filters.push(function ({ item }) item.scope & scope);
|
context.filters.push(function ({ item }) item.scope & scope);
|
||||||
@@ -1377,7 +1377,7 @@ const Options = Module("options", {
|
|||||||
context.title = ["Option Value"];
|
context.title = ["Option Value"];
|
||||||
// Not Vim compatible, but is a significant enough improvement
|
// Not Vim compatible, but is a significant enough improvement
|
||||||
// that it's worth breaking compatibility.
|
// that it's worth breaking compatibility.
|
||||||
if (isarray(newValues)) {
|
if (isArray(newValues)) {
|
||||||
context.filters.push(function (i) newValues.indexOf(i.text) == -1);
|
context.filters.push(function (i) newValues.indexOf(i.text) == -1);
|
||||||
if (op == "+")
|
if (op == "+")
|
||||||
context.filters.push(function (i) curValues.indexOf(i.text) == -1);
|
context.filters.push(function (i) curValues.indexOf(i.text) == -1);
|
||||||
|
|||||||
@@ -82,11 +82,11 @@ if (!Object.keys)
|
|||||||
let use = {};
|
let use = {};
|
||||||
let loaded = {};
|
let loaded = {};
|
||||||
let currentModule;
|
let currentModule;
|
||||||
function defmodule(name, params) {
|
function defineModule(name, params) {
|
||||||
let module = Cu.getGlobalForObject ? Cu.getGlobalForObject(params) : params.__parent__;
|
let module = Cu.getGlobalForObject ? Cu.getGlobalForObject(params) : params.__parent__;
|
||||||
module.NAME = name;
|
module.NAME = name;
|
||||||
module.EXPORTED_SYMBOLS = params.exports || [];
|
module.EXPORTED_SYMBOLS = params.exports || [];
|
||||||
defmodule.loadLog.push("defmodule " + name);
|
defineModule.loadLog.push("defineModule " + name);
|
||||||
for(let [, mod] in Iterator(params.require || []))
|
for(let [, mod] in Iterator(params.require || []))
|
||||||
require(module, mod);
|
require(module, mod);
|
||||||
|
|
||||||
@@ -100,25 +100,25 @@ function defmodule(name, params) {
|
|||||||
currentModule = module;
|
currentModule = module;
|
||||||
}
|
}
|
||||||
|
|
||||||
defmodule.loadLog = [];
|
defineModule.loadLog = [];
|
||||||
Object.defineProperty(defmodule.loadLog, "push", { value: function (val) { dump(val + "\n"); this[this.length] = val; } });
|
Object.defineProperty(defineModule.loadLog, "push", { value: function (val) { dump(val + "\n"); this[this.length] = val; } });
|
||||||
defmodule.modules = [];
|
defineModule.modules = [];
|
||||||
defmodule.times = { all: 0 };
|
defineModule.times = { all: 0 };
|
||||||
defmodule.time = function time(major, minor, func, self) {
|
defineModule.time = function time(major, minor, func, self) {
|
||||||
let time = Date.now();
|
let time = Date.now();
|
||||||
let res = func.apply(self, Array.slice(arguments, 4));
|
let res = func.apply(self, Array.slice(arguments, 4));
|
||||||
let delta = Date.now() - time;
|
let delta = Date.now() - time;
|
||||||
defmodule.times.all += delta;
|
defineModule.times.all += delta;
|
||||||
defmodule.times[major] = (defmodule.times[major] || 0) + delta;
|
defineModule.times[major] = (defineModule.times[major] || 0) + delta;
|
||||||
if (minor) {
|
if (minor) {
|
||||||
defmodule.times[":" + minor] = (defmodule.times[":" + minor] || 0) + delta;
|
defineModule.times[":" + minor] = (defineModule.times[":" + minor] || 0) + delta;
|
||||||
defmodule.times[major + ":" + minor] = (defmodule.times[major + ":" + minor] || 0) + delta;
|
defineModule.times[major + ":" + minor] = (defineModule.times[major + ":" + minor] || 0) + delta;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
function endmodule() {
|
function endModule() {
|
||||||
defmodule.loadLog.push("endmodule " + currentModule.NAME);
|
defineModule.loadLog.push("endModule " + currentModule.NAME);
|
||||||
loaded[currentModule.NAME] = 1;
|
loaded[currentModule.NAME] = 1;
|
||||||
for(let [, mod] in Iterator(use[currentModule.NAME] || []))
|
for(let [, mod] in Iterator(use[currentModule.NAME] || []))
|
||||||
require(mod, currentModule.NAME, "use");
|
require(mod, currentModule.NAME, "use");
|
||||||
@@ -126,7 +126,7 @@ function endmodule() {
|
|||||||
|
|
||||||
function require(obj, name, from) {
|
function require(obj, name, from) {
|
||||||
try {
|
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);
|
Cu.import("resource://dactyl/" + name + ".jsm", obj);
|
||||||
}
|
}
|
||||||
catch (e) {
|
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
|
// sed -n 's/^(const|function) ([a-zA-Z0-9_]+).*/ "\2",/p' base.jsm | sort | fmt
|
||||||
exports: [
|
exports: [
|
||||||
"Cc", "Ci", "Class", "Cr", "Cu", "Module", "Object", "Runnable",
|
"Cc", "Ci", "Class", "Cr", "Cu", "Module", "Object", "Runnable",
|
||||||
"Struct", "StructBase", "Timer", "UTF8", "XPCOMUtils", "array",
|
"Struct", "StructBase", "Timer", "UTF8", "XPCOMUtils", "array",
|
||||||
"call", "callable", "curry", "debuggerProperties", "defmodule",
|
"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"
|
||||||
],
|
],
|
||||||
@@ -231,7 +231,7 @@ function values(obj) {
|
|||||||
* @param {function} fn The callback.
|
* @param {function} fn The callback.
|
||||||
* @param {object} self The this object for 'fn'.
|
* @param {object} self The this object for 'fn'.
|
||||||
*/
|
*/
|
||||||
function foreach(iter, fn, self) {
|
function forEach(iter, fn, self) {
|
||||||
for (let val in iter)
|
for (let val in iter)
|
||||||
fn.call(self, val);
|
fn.call(self, val);
|
||||||
}
|
}
|
||||||
@@ -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 () {
|
||||||
@@ -382,7 +382,7 @@ function iter(obj) {
|
|||||||
* @param {function} src
|
* @param {function} src
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
function issubclass(targ, src) {
|
function isSubclass(targ, src) {
|
||||||
return src === targ ||
|
return src === targ ||
|
||||||
targ && typeof targ === "function" && targ.prototype instanceof src;
|
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
|
* 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,
|
||||||
@@ -416,7 +416,7 @@ function isinstance(targ, src) {
|
|||||||
if (targ instanceof src[i])
|
if (targ instanceof src[i])
|
||||||
return true;
|
return true;
|
||||||
var type = types[typeof targ];
|
var type = types[typeof targ];
|
||||||
if (type && issubclass(src[i], type))
|
if (type && isSubclass(src[i], type))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ function isinstance(targ, src) {
|
|||||||
/**
|
/**
|
||||||
* Returns true if obj is a non-null object.
|
* 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
|
* 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
|
* any window, frame, namespace, or execution context, which
|
||||||
* is not the case when using (obj instanceof Array).
|
* is not the case when using (obj instanceof Array).
|
||||||
*/
|
*/
|
||||||
const isarray = Array.isArray ||
|
const isArray = Array.isArray ||
|
||||||
function isarray(val) objproto.toString.call(val) == "[object Array]";
|
function isArray(val) objproto.toString.call(val) == "[object Array]";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if and only if its sole argument is an
|
* 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
|
* functions containing the 'yield' statement and generator
|
||||||
* statements such as (x for (x in obj)).
|
* 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,
|
* 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
|
* namespace, or execution context, which is not the case when
|
||||||
* using (obj instanceof String) or (typeof obj == "string").
|
* 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
|
* Returns true if and only if its sole argument may be called
|
||||||
@@ -631,7 +631,7 @@ function extend(subclass, superclass, overrides) {
|
|||||||
function Class() {
|
function Class() {
|
||||||
|
|
||||||
var args = Array.slice(arguments);
|
var args = Array.slice(arguments);
|
||||||
if (isstring(args[0]))
|
if (isString(args[0]))
|
||||||
var name = args.shift();
|
var name = args.shift();
|
||||||
var superclass = Class;
|
var superclass = Class;
|
||||||
if (callable(args[0]))
|
if (callable(args[0]))
|
||||||
@@ -657,8 +657,8 @@ function Class() {
|
|||||||
var res = self.init.apply(self, arguments);
|
var res = self.init.apply(self, arguments);
|
||||||
return res !== undefined ? res : self;
|
return res !== undefined ? res : self;
|
||||||
})]]>,
|
})]]>,
|
||||||
"constructor", (name || superclass.classname).replace(/\W/g, "_")));
|
"constructor", (name || superclass.className).replace(/\W/g, "_")));
|
||||||
Constructor.classname = name || superclass.classname || superclass.name;
|
Constructor.className = name || superclass.className || superclass.name;
|
||||||
|
|
||||||
if ("init" in superclass.prototype)
|
if ("init" in superclass.prototype)
|
||||||
Constructor.__proto__ = superclass;
|
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 });
|
Object.defineProperty(obj, prop, { configurable: true, enumerable: true, value: value, writable: true });
|
||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
Class.toString = function () "[class " + this.classname + "]";
|
Class.toString = function () "[class " + this.className + "]";
|
||||||
Class.prototype = {
|
Class.prototype = {
|
||||||
/**
|
/**
|
||||||
* Initializes new instances of this class. Called automatically
|
* Initializes new instances of this class. Called automatically
|
||||||
@@ -694,7 +694,7 @@ Class.prototype = {
|
|||||||
*/
|
*/
|
||||||
init: function () {},
|
init: function () {},
|
||||||
|
|
||||||
toString: function () "[instance " + this.constructor.classname + "]",
|
toString: function () "[instance " + this.constructor.className + "]",
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes 'callback' after 'timeout' milliseconds. The value of
|
* Executes 'callback' after 'timeout' milliseconds. The value of
|
||||||
@@ -727,10 +727,10 @@ function Module(name, prototype) {
|
|||||||
let init = callable(prototype) ? 4 : 3;
|
let init = callable(prototype) ? 4 : 3;
|
||||||
const module = Class.apply(Class, Array.slice(arguments, 0, init));
|
const module = Class.apply(Class, Array.slice(arguments, 0, init));
|
||||||
let instance = module();
|
let instance = module();
|
||||||
module.classname = name.toLowerCase();
|
module.className = name.toLowerCase();
|
||||||
instance.INIT = arguments[init] || {};
|
instance.INIT = arguments[init] || {};
|
||||||
currentModule[module.classname] = instance;
|
currentModule[module.className] = instance;
|
||||||
defmodule.modules.push(instance);
|
defineModule.modules.push(instance);
|
||||||
return module;
|
return module;
|
||||||
}
|
}
|
||||||
if (Cu.getGlobalForObject)
|
if (Cu.getGlobalForObject)
|
||||||
@@ -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);
|
||||||
@@ -900,7 +900,7 @@ const array = Class("array", Array, {
|
|||||||
__iterator__: function () this.iteritems(),
|
__iterator__: function () this.iteritems(),
|
||||||
__noSuchMethod__: function (meth, args) {
|
__noSuchMethod__: function (meth, args) {
|
||||||
var res = array[meth].apply(null, [this.array].concat(args));
|
var res = array[meth].apply(null, [this.array].concat(args));
|
||||||
if (isarray(res))
|
if (isArray(res))
|
||||||
return array(res);
|
return array(res);
|
||||||
return 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);}
|
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("bookmarkcache", {
|
defineModule("bookmarkcache", {
|
||||||
exports: ["Bookmark", "BookmarkCache", "Keyword", "bookmarkcache"],
|
exports: ["Bookmark", "BookmarkCache", "Keyword", "bookmarkcache"],
|
||||||
require: ["services", "storage", "util"]
|
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:
|
// vim: set fdm=marker sw=4 sts=4 et ft=javascript:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("highlight", {
|
defineModule("highlight", {
|
||||||
exports: ["Highlight", "Highlights", "highlight"],
|
exports: ["Highlight", "Highlights", "highlight"],
|
||||||
require: ["services", "styles"],
|
require: ["services", "styles"],
|
||||||
use: ["template", "util"]
|
use: ["template", "util"]
|
||||||
@@ -66,7 +66,7 @@ const Highlights = Module("Highlight", {
|
|||||||
_create: function (agent, args) {
|
_create: function (agent, args) {
|
||||||
let obj = Highlight.apply(Highlight, args);
|
let obj = Highlight.apply(Highlight, args);
|
||||||
|
|
||||||
if (!isarray(obj[2]))
|
if (!isArray(obj[2]))
|
||||||
obj[2] = obj[2].split(",");
|
obj[2] = obj[2].split(",");
|
||||||
obj[5] = agent;
|
obj[5] = agent;
|
||||||
|
|
||||||
@@ -337,6 +337,6 @@ const Highlights = Module("Highlight", {
|
|||||||
|
|
||||||
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||||
|
|
||||||
endmodule();
|
endModule();
|
||||||
|
|
||||||
// vim:se fdm=marker sw=4 ts=4 et ft=javascript:
|
// vim:se fdm=marker sw=4 ts=4 et ft=javascript:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
// - finish 1.9.0 support if we're going to support sanitizing in Xulmus
|
// - finish 1.9.0 support if we're going to support sanitizing in Xulmus
|
||||||
|
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("sanitizer", {
|
defineModule("sanitizer", {
|
||||||
exports: ["Range", "Sanitizer", "sanitizer"],
|
exports: ["Range", "Sanitizer", "sanitizer"],
|
||||||
require: ["services", "storage", "util"]
|
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);}
|
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("services", {
|
defineModule("services", {
|
||||||
exports: ["Services", "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);}
|
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
const myObject = Object;
|
const myObject = Object;
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("storage", {
|
defineModule("storage", {
|
||||||
exports: ["File", "storage"],
|
exports: ["File", "storage"],
|
||||||
require: ["services", "util"]
|
require: ["services", "util"]
|
||||||
});
|
});
|
||||||
@@ -169,7 +169,7 @@ const Storage = Module("Storage", {
|
|||||||
alwaysReload: {},
|
alwaysReload: {},
|
||||||
|
|
||||||
newObject: function newObject(key, constructor, params) {
|
newObject: function newObject(key, constructor, params) {
|
||||||
if (params == null || !isobject(params))
|
if (params == null || !isObject(params))
|
||||||
throw Error("Invalid argument type");
|
throw Error("Invalid argument type");
|
||||||
|
|
||||||
if (!(key in keys) || params.reload || this.alwaysReload[key]) {
|
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")
|
replacePathSep: function (path) path.replace("/", File.PATH_SEP, "g")
|
||||||
});
|
});
|
||||||
|
|
||||||
endmodule();
|
endModule();
|
||||||
|
|
||||||
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("styles", {
|
defineModule("styles", {
|
||||||
exports: ["Style", "Styles", "styles"],
|
exports: ["Style", "Styles", "styles"],
|
||||||
require: ["services", "util"],
|
require: ["services", "util"],
|
||||||
use: ["template"]
|
use: ["template"]
|
||||||
@@ -100,7 +100,7 @@ const Styles = Module("Styles", {
|
|||||||
let sheets = system ? this.systemSheets : this.userSheets;
|
let sheets = system ? this.systemSheets : this.userSheets;
|
||||||
let names = system ? this.systemNames : this.userNames;
|
let names = system ? this.systemNames : this.userNames;
|
||||||
|
|
||||||
if (!isarray(filter))
|
if (!isArray(filter))
|
||||||
filter = filter.split(",");
|
filter = filter.split(",");
|
||||||
if (name && name in names) {
|
if (name && name in names) {
|
||||||
var sheet = names[name];
|
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);}
|
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("template", {
|
defineModule("template", {
|
||||||
exports: ["Template", "template"],
|
exports: ["Template", "template"],
|
||||||
require: ["util"]
|
require: ["util"]
|
||||||
});
|
});
|
||||||
@@ -308,6 +308,6 @@ const Template = Module("Template", {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
endmodule();
|
endModule();
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
|
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Components.utils.import("resource://dactyl/base.jsm");
|
Components.utils.import("resource://dactyl/base.jsm");
|
||||||
defmodule("util", {
|
defineModule("util", {
|
||||||
exports: ["Math", "NS", "Util", "XHTML", "XUL", "util"],
|
exports: ["Math", "NS", "Util", "XHTML", "XUL", "util"],
|
||||||
require: ["services"],
|
require: ["services"],
|
||||||
use: ["highlight", "template"]
|
use: ["highlight", "template"]
|
||||||
@@ -116,7 +116,7 @@ const Util = Module("Util", {
|
|||||||
* @returns {Object}
|
* @returns {Object}
|
||||||
*/
|
*/
|
||||||
cloneObject: function cloneObject(obj) {
|
cloneObject: function cloneObject(obj) {
|
||||||
if (isarray(obj))
|
if (isArray(obj))
|
||||||
return obj.slice();
|
return obj.slice();
|
||||||
let newObj = {};
|
let newObj = {};
|
||||||
for (let [k, v] in Iterator(obj))
|
for (let [k, v] in Iterator(obj))
|
||||||
@@ -280,7 +280,7 @@ const Util = Module("Util", {
|
|||||||
doc = util.activeWindow.content.document;
|
doc = util.activeWindow.content.document;
|
||||||
if (!elem)
|
if (!elem)
|
||||||
elem = doc;
|
elem = doc;
|
||||||
if (isarray(expression))
|
if (isArray(expression))
|
||||||
expression = util.makeXPath(expression);
|
expression = util.makeXPath(expression);
|
||||||
|
|
||||||
let result = doc.evaluate(expression, elem,
|
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"
|
// 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;
|
||||||
@@ -593,7 +593,7 @@ const Util = Module("Util", {
|
|||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
if (!hasValue) {
|
if (!hasValue) {
|
||||||
if (isarray(i) && i.length == 2)
|
if (isArray(i) && i.length == 2)
|
||||||
[i, value] = i;
|
[i, value] = i;
|
||||||
else
|
else
|
||||||
var noVal = true;
|
var noVal = true;
|
||||||
@@ -853,6 +853,6 @@ var Math = update(Object.create(GlobalMath), {
|
|||||||
|
|
||||||
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
// catch(e){dump(e.fileName+":"+e.lineNumber+": "+e+"\n" + e.stack);}
|
||||||
|
|
||||||
endmodule();
|
endModule();
|
||||||
|
|
||||||
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
|
// vim: set fdm=marker sw=4 ts=4 et ft=javascript:
|
||||||
|
|||||||
Reference in New Issue
Block a user