mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-02-22 07:45:45 +01:00
Import minor changes from groups branch.
This commit is contained in:
@@ -245,7 +245,7 @@ var AutoCommands = Module("autocommands", {
|
||||
};
|
||||
},
|
||||
javascript: function () {
|
||||
JavaScript.setCompleter(this.get, [function () Iterator(config.autocommands)]);
|
||||
JavaScript.setCompleter(autocommands.get, [function () Iterator(config.autocommands)]);
|
||||
},
|
||||
options: function () {
|
||||
options.add(["eventignore", "ei"],
|
||||
|
||||
@@ -262,7 +262,7 @@ var Buffer = Module("buffer", {
|
||||
dactylLoadCount: 0,
|
||||
|
||||
// XXX: function may later be needed to detect a canceled synchronous openURL()
|
||||
onStateChange: function onStateChange(webProgress, request, flags, status) {
|
||||
onStateChange: util.wrapCallback(function onStateChange(webProgress, request, flags, status) {
|
||||
onStateChange.superapply(this, arguments);
|
||||
// STATE_IS_DOCUMENT | STATE_IS_WINDOW is important, because we also
|
||||
// receive statechange events for loading images and other parts of the web page
|
||||
@@ -286,9 +286,9 @@ var Buffer = Module("buffer", {
|
||||
statusline.updateUrl();
|
||||
}
|
||||
}
|
||||
},
|
||||
}),
|
||||
// for notifying the user about secure web pages
|
||||
onSecurityChange: function onSecurityChange(webProgress, request, state) {
|
||||
onSecurityChange: util.wrapCallback(function onSecurityChange(webProgress, request, state) {
|
||||
onSecurityChange.superapply(this, arguments);
|
||||
if (state & Ci.nsIWebProgressListener.STATE_IS_BROKEN)
|
||||
statusline.security = "broken";
|
||||
@@ -300,19 +300,19 @@ var Buffer = Module("buffer", {
|
||||
statusline.security = "insecure";
|
||||
if (webProgress && webProgress.DOMWindow)
|
||||
webProgress.DOMWindow.document.dactylSecurity = statusline.security;
|
||||
},
|
||||
onStatusChange: function onStatusChange(webProgress, request, status, message) {
|
||||
}),
|
||||
onStatusChange: util.wrapCallback(function onStatusChange(webProgress, request, status, message) {
|
||||
onStatusChange.superapply(this, arguments);
|
||||
statusline.updateUrl(message);
|
||||
},
|
||||
onProgressChange: function onProgressChange(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) {
|
||||
}),
|
||||
onProgressChange: util.wrapCallback(function onProgressChange(webProgress, request, curSelfProgress, maxSelfProgress, curTotalProgress, maxTotalProgress) {
|
||||
onProgressChange.superapply(this, arguments);
|
||||
if (webProgress.DOMWindow)
|
||||
if (webProgress && webProgress.DOMWindow)
|
||||
webProgress.DOMWindow.dactylProgress = curTotalProgress / maxTotalProgress;
|
||||
statusline.progress = curTotalProgress / maxTotalProgress;
|
||||
},
|
||||
}),
|
||||
// happens when the users switches tabs
|
||||
onLocationChange: function onLocationChange(webProgress, request, uri) {
|
||||
onLocationChange: util.wrapCallback(function onLocationChange(webProgress, request, uri) {
|
||||
onLocationChange.superapply(this, arguments);
|
||||
|
||||
delete mappings.hives;
|
||||
@@ -352,13 +352,13 @@ var Buffer = Module("buffer", {
|
||||
if (loaded.commandline)
|
||||
commandline.clear();
|
||||
}, 500);
|
||||
},
|
||||
}),
|
||||
// called at the very end of a page load
|
||||
asyncUpdateUI: function asyncUpdateUI() {
|
||||
asyncUpdateUI: util.wrapCallback(function asyncUpdateUI() {
|
||||
asyncUpdateUI.superapply(this, arguments);
|
||||
util.timeout(function () { statusline.updateUrl(); }, 100);
|
||||
},
|
||||
setOverLink: function setOverLink(link, b) {
|
||||
}),
|
||||
setOverLink: util.wrapCallback(function setOverLink(link, b) {
|
||||
setOverLink.superapply(this, arguments);
|
||||
switch (options["showstatuslinks"]) {
|
||||
case "status":
|
||||
@@ -371,7 +371,7 @@ var Buffer = Module("buffer", {
|
||||
commandline.clear();
|
||||
break;
|
||||
}
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -352,8 +352,8 @@ var CommandMode = Class("CommandMode", {
|
||||
if (this.history)
|
||||
this.history.save();
|
||||
|
||||
commandline.hideCompletions();
|
||||
this.resetCompletions();
|
||||
commandline.hideCompletions();
|
||||
|
||||
modes.delay(function () {
|
||||
if (!this.keepCommand || commandline.silent || commandline.quiet)
|
||||
@@ -504,11 +504,6 @@ var CommandLine = Module("commandline", {
|
||||
}, message));
|
||||
}
|
||||
}; //}}}
|
||||
|
||||
this._silent = false;
|
||||
this._quiet = false;
|
||||
this._lastEcho = null;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -546,12 +541,14 @@ var CommandLine = Module("commandline", {
|
||||
|
||||
get completionContext() this._completions.context,
|
||||
|
||||
_silent: false,
|
||||
get silent() this._silent,
|
||||
set silent(val) {
|
||||
this._silent = val;
|
||||
this.quiet = this.quiet;
|
||||
},
|
||||
|
||||
_quite: false,
|
||||
get quiet() this._quiet,
|
||||
set quiet(val) {
|
||||
this._quiet = val;
|
||||
@@ -665,6 +662,8 @@ var CommandLine = Module("commandline", {
|
||||
}
|
||||
},
|
||||
|
||||
_lastEcho: null,
|
||||
|
||||
/**
|
||||
* Output the given string onto the command line. With no flags, the
|
||||
* message will be shown in the status line if it's short enough to
|
||||
|
||||
@@ -12,7 +12,6 @@ default xml namespace = XHTML;
|
||||
XML.ignoreWhitespace = false;
|
||||
XML.prettyPrinting = false;
|
||||
|
||||
var plugins = { __proto__: modules };
|
||||
var userContext = { __proto__: modules };
|
||||
var _userContext = newContext(userContext);
|
||||
|
||||
@@ -53,7 +52,6 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
|
||||
destroy: function () {
|
||||
autocommands.trigger("LeavePre", {});
|
||||
storage.saveAll();
|
||||
dactyl.triggerObserver("shutdown", null);
|
||||
util.dump("All dactyl modules destroyed\n");
|
||||
autocommands.trigger("Leave", {});
|
||||
@@ -337,7 +335,7 @@ var Dactyl = Module("dactyl", XPCOM(Ci.nsISupportsWeakReference, ModuleBase), {
|
||||
dactyl.reportError(str);
|
||||
if (typeof str == "object" && "echoerr" in str)
|
||||
str = str.echoerr;
|
||||
else if (isinstance(str, ["Error"]))
|
||||
else if (isinstance(str, ["Error"]) && str.fileName)
|
||||
str = <>{str.fileName.replace(/^.* -> /, "")}: {str.lineNumber}: {str}</>;
|
||||
|
||||
if (options["errorbells"])
|
||||
|
||||
@@ -862,7 +862,7 @@ var Mappings = Module("mappings", {
|
||||
};
|
||||
},
|
||||
javascript: function () {
|
||||
JavaScript.setCompleter(this.get,
|
||||
JavaScript.setCompleter(mappings.get,
|
||||
[
|
||||
null,
|
||||
function (context, obj, args) {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
//
|
||||
// This work is licensed for reuse under an MIT license. Details are
|
||||
// given in the LICENSE.txt file included with this file.
|
||||
"use strict";
|
||||
|
||||
var MOW = Module("mow", {
|
||||
init: function () {
|
||||
@@ -71,7 +72,6 @@ var MOW = Module("mow", {
|
||||
if (!commandline.commandVisible)
|
||||
commandline.hide();
|
||||
|
||||
this._startHints = false;
|
||||
if (modes.main != modes.OUTPUT_MULTILINE) {
|
||||
modes.push(modes.OUTPUT_MULTILINE, null, {
|
||||
onKeyPress: this.closure.onKeyPress,
|
||||
@@ -170,6 +170,7 @@ var MOW = Module("mow", {
|
||||
event.preventDefault();
|
||||
}
|
||||
},
|
||||
|
||||
contextEvents: {
|
||||
popupshowing: function (event) {
|
||||
let menu = commandline.widgets.contextMenu;
|
||||
@@ -261,8 +262,7 @@ var MOW = Module("mow", {
|
||||
if (!value && elem && elem.contentWindow == document.commandDispatcher.focusedWindow)
|
||||
document.commandDispatcher.focusedWindow = content;
|
||||
}
|
||||
}),
|
||||
|
||||
})
|
||||
}, {
|
||||
}, {
|
||||
mappings: function () {
|
||||
@@ -277,7 +277,7 @@ var MOW = Module("mow", {
|
||||
mow.echo(mow.lastOutput, "Normal");
|
||||
});
|
||||
|
||||
bind = function bind(keys, description, action, test, default_) {
|
||||
let bind = function bind(keys, description, action, test, default_) {
|
||||
mappings.add([modes.OUTPUT_MULTILINE],
|
||||
keys, description,
|
||||
function (command) {
|
||||
|
||||
@@ -1295,7 +1295,7 @@ var Options = Module("options", {
|
||||
};
|
||||
},
|
||||
javascript: function () {
|
||||
JavaScript.setCompleter(this.get, [function () ([o.name, o.description] for (o in options))]);
|
||||
JavaScript.setCompleter(options.get, [function () ([o.name, o.description] for (o in options))]);
|
||||
},
|
||||
sanitizer: function () {
|
||||
sanitizer.addItem("options", {
|
||||
|
||||
Reference in New Issue
Block a user