1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-23 19:32:27 +01:00

Simplify hint code.

This commit is contained in:
Kris Maglione
2008-10-29 01:05:43 +00:00
parent 0677166d6b
commit ab30527ccf

View File

@@ -625,34 +625,15 @@ function Hints() //{{{
mappings.add(myModes, ["f"], mappings.add(myModes, ["f"],
"Start QuickHint mode", "Start QuickHint mode",
function () function () { hints.show(modes.QUICK_HINT, "o") });
{
commandline.input("Follow hint:", null, { onChange: onInput });
modes.extended = modes.HINTS | modes.QUICK_HINT;
hints.show(modes.QUICK_HINT);
});
mappings.add(myModes, ["F"], mappings.add(myModes, ["F"],
"Start QuickHint mode, but open link in a new tab", "Start QuickHint mode, but open link in a new tab",
function () function () { hints.show(modes.QUICK_HINT, "t") });
{
commandline.input("Follow hint in a new tab:", null, { onChange: onInput });
modes.extended = modes.HINTS | modes.QUICK_HINT;
hints.show(modes.QUICK_HINT, "t");
});
mappings.add(myModes, [";"], mappings.add(myModes, [";"],
"Start an extended hint mode", "Start an extended hint mode",
function (arg) function (arg) { hints.show(modes.EXTENDED_HINT, arg) },
{
let prompt = hintDescriptions[arg];
if (!prompt)
return liberator.beep();
commandline.input(prompt, null, { onChange: onInput });
modes.extended = modes.HINTS | modes.EXTENDED_HINT;
hints.show(modes.EXTENDED_HINT, arg);
},
{ flags: Mappings.flags.ARGUMENT }); { flags: Mappings.flags.ARGUMENT });
/////////////////////////////////////////////////////////////////////////////}}} /////////////////////////////////////////////////////////////////////////////}}}
@@ -663,11 +644,14 @@ function Hints() //{{{
show: function (mode, minor, filter, win) show: function (mode, minor, filter, win)
{ {
if (mode == modes.EXTENDED_HINT && !/^[;?asoOtbTvVwWyY]$/.test(minor)) let prompt = hintDescriptions[minor];
if (!prompt)
{ {
liberator.beep(); liberator.beep();
return; return;
} }
commandline.input(prompt, null, { onChange: onInput });
modes.extended = modes.HINTS | mode;
submode = minor || "o"; // open is the default mode submode = minor || "o"; // open is the default mode
hintString = filter || ""; hintString = filter || "";