mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-21 01:27:59 +01:00
Make the silly ':hi Bell display:none;' hack function again.
This commit is contained in:
@@ -1583,19 +1583,11 @@ const CommandLine = Module("commandline", {
|
|||||||
if (!arg)
|
if (!arg)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
try {
|
|
||||||
arg = dactyl.userEval(arg);
|
arg = dactyl.userEval(arg);
|
||||||
}
|
if (isObject(arg))
|
||||||
catch (e) {
|
|
||||||
dactyl.echoerr(e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof arg === "object")
|
|
||||||
arg = util.objectToString(arg, useColor);
|
arg = util.objectToString(arg, useColor);
|
||||||
else
|
else
|
||||||
arg = String(arg);
|
arg = String(arg);
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@@ -1620,9 +1612,7 @@ const CommandLine = Module("commandline", {
|
|||||||
commands.add([command.name],
|
commands.add([command.name],
|
||||||
command.description,
|
command.description,
|
||||||
function (args) {
|
function (args) {
|
||||||
let str = CommandLine.echoArgumentToString(args[0] || "", true);
|
command.action(CommandLine.echoArgumentToString(args[0] || "", true));
|
||||||
if (str != null)
|
|
||||||
command.action(str);
|
|
||||||
}, {
|
}, {
|
||||||
completer: function (context) completion.javascript(context),
|
completer: function (context) completion.javascript(context),
|
||||||
literal: 0
|
literal: 0
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ const Command = Class("Command", {
|
|||||||
if (args.bang && !this.bang)
|
if (args.bang && !this.bang)
|
||||||
throw FailedAssertion("E477: No ! allowed");
|
throw FailedAssertion("E477: No ! allowed");
|
||||||
|
|
||||||
dactyl.trapErrors(function exec(command) {
|
return !dactyl.trapErrors(function exec(command) {
|
||||||
if (this.always)
|
if (this.always)
|
||||||
this.always(args, modifiers);
|
this.always(args, modifiers);
|
||||||
if (!io.sourcing || !io.sourcing.noExecute)
|
if (!io.sourcing || !io.sourcing.noExecute)
|
||||||
|
|||||||
@@ -143,10 +143,10 @@ const Dactyl = Module("dactyl", {
|
|||||||
let strut = document.getElementById("dactyl-bell-strut");
|
let strut = document.getElementById("dactyl-bell-strut");
|
||||||
if (!bell) {
|
if (!bell) {
|
||||||
bell = document.documentElement.insertBefore(
|
bell = document.documentElement.insertBefore(
|
||||||
util.xmlToDom(<hbox xmlns={XUL} style="display: none" id="dactyl-bell" highlight="Bell"/>, document),
|
util.xmlToDom(<hbox xmlns={XUL} style="display: none" highlight="Bell" id="dactyl-bell"/>, document),
|
||||||
document.documentElement.firstChild);
|
document.documentElement.firstChild);
|
||||||
strut = document.documentElement.appendChild(
|
strut = document.documentElement.appendChild(
|
||||||
util.xmlToDom(<hbox xmlns={XUL} style="display: none" id="dactyl-bell-strut"/>, document));
|
util.xmlToDom(<hbox xmlns={XUL} style="display: none" highlight="Bell" id="dactyl-bell-strut"/>, document));
|
||||||
}
|
}
|
||||||
|
|
||||||
bell.style.height = window.innerHeight + "px";
|
bell.style.height = window.innerHeight + "px";
|
||||||
@@ -335,12 +335,14 @@ const Dactyl = Module("dactyl", {
|
|||||||
|
|
||||||
if (!silent)
|
if (!silent)
|
||||||
commandline.command = str.replace(/^\s*:\s*/, "");
|
commandline.command = str.replace(/^\s*:\s*/, "");
|
||||||
|
let res = true;
|
||||||
for (let [command, args] in commands.parseCommands(str.replace(/^'(.*)'$/, "$1"))) {
|
for (let [command, args] in commands.parseCommands(str.replace(/^'(.*)'$/, "$1"))) {
|
||||||
if (command === null)
|
if (command === null)
|
||||||
throw FailedAssertion("E492: Not a " + config.appName + " command: " + args.commandString);
|
throw FailedAssertion("E492: Not a " + config.appName + " command: " + args.commandString);
|
||||||
|
|
||||||
command.execute(args, modifiers);
|
res = res && command.execute(args, modifiers);
|
||||||
}
|
}
|
||||||
|
return res;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1006,7 +1008,7 @@ const Dactyl = Module("dactyl", {
|
|||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
dactyl.reportError(e, true);
|
dactyl.reportError(e, true);
|
||||||
return undefined;
|
return e;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1711,18 +1713,11 @@ const Dactyl = Module("dactyl", {
|
|||||||
commands.add(["javas[cript]", "js"],
|
commands.add(["javas[cript]", "js"],
|
||||||
"Evaluate a JavaScript string",
|
"Evaluate a JavaScript string",
|
||||||
function (args) {
|
function (args) {
|
||||||
if (args.bang) { // open JavaScript console
|
if (args.bang) // open JavaScript console
|
||||||
dactyl.open("chrome://global/content/console.xul",
|
dactyl.open("chrome://global/content/console.xul",
|
||||||
{ from: "javascript" });
|
{ from: "javascript" });
|
||||||
}
|
else
|
||||||
else {
|
|
||||||
try {
|
|
||||||
dactyl.userEval(args[0]);
|
dactyl.userEval(args[0]);
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
dactyl.echoerr(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, {
|
}, {
|
||||||
bang: true,
|
bang: true,
|
||||||
completer: function (context) completion.javascript(context),
|
completer: function (context) completion.javascript(context),
|
||||||
|
|||||||
@@ -569,7 +569,6 @@ const Tabs = Module("tabs", {
|
|||||||
subCommand: 0
|
subCommand: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO: this should open in a new tab positioned directly after the current one, not at the end
|
|
||||||
commands.add(["tab"],
|
commands.add(["tab"],
|
||||||
"Execute a command and tell it to output in a new tab",
|
"Execute a command and tell it to output in a new tab",
|
||||||
function (args) {
|
function (args) {
|
||||||
@@ -589,7 +588,8 @@ const Tabs = Module("tabs", {
|
|||||||
function (args) {
|
function (args) {
|
||||||
for (let i = 0; i < tabs.count; i++) {
|
for (let i = 0; i < tabs.count; i++) {
|
||||||
tabs.select(i);
|
tabs.select(i);
|
||||||
dactyl.execute(args[0] || "", null, true);
|
if (!dactyl.execute(args[0] || "", null, true))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
argCount: "1",
|
argCount: "1",
|
||||||
|
|||||||
Reference in New Issue
Block a user