mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-23 09:48:00 +01:00
use 'lambda' notation where appropriate
This commit is contained in:
@@ -193,10 +193,9 @@ liberator.Addressbook = function () //{{{
|
|||||||
{
|
{
|
||||||
// Now we have to create a new message
|
// Now we have to create a new message
|
||||||
var args = {};
|
var args = {};
|
||||||
args.to = addresses.map(function (address)
|
args.to = addresses.map(
|
||||||
{
|
function (address) "\"" + address[0].replace(/"/g, "") + " <" + address[1] + ">\""
|
||||||
return "\"" + address[0].replace(/"/g, "") + " <" + address[1] + ">\"";
|
).join(", ");
|
||||||
}).join(", ");
|
|
||||||
|
|
||||||
liberator.mail.composeNewMail(args);
|
liberator.mail.composeNewMail(args);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,10 +191,7 @@ liberator.Bookmarks = function () //{{{
|
|||||||
"Set the default search engine",
|
"Set the default search engine",
|
||||||
"string", "google",
|
"string", "google",
|
||||||
{
|
{
|
||||||
completer: function (filter)
|
completer: function (filter) liberator.completion.url("", "s")[1],
|
||||||
{
|
|
||||||
return liberator.completion.url("", "s")[1];
|
|
||||||
},
|
|
||||||
validator: function (value)
|
validator: function (value)
|
||||||
{
|
{
|
||||||
return liberator.completion.url("", "s")[1].some(function (s) s[0] == value);
|
return liberator.completion.url("", "s")[1].some(function (s) s[0] == value);
|
||||||
@@ -290,7 +287,7 @@ liberator.Bookmarks = function () //{{{
|
|||||||
liberator.bookmarks.list(args.arguments.join(" "), args["-tags"] || [], special);
|
liberator.bookmarks.list(args.arguments.join(" "), args["-tags"] || [], special);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return [0, liberator.bookmarks.get(filter)]; },
|
completer: function (filter) [0, liberator.bookmarks.get(filter)],
|
||||||
options: [[["-tags", "-T"], liberator.commands.OPTION_LIST]]
|
options: [[["-tags", "-T"], liberator.commands.OPTION_LIST]]
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -306,7 +303,7 @@ liberator.Bookmarks = function () //{{{
|
|||||||
liberator.echo(deletedCount + " bookmark(s) with url `" + url + "' deleted", liberator.commandline.FORCE_SINGLELINE);
|
liberator.echo(deletedCount + " bookmark(s) with url `" + url + "' deleted", liberator.commandline.FORCE_SINGLELINE);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return [0, liberator.bookmarks.get(filter)]; }
|
completer: function (filter) [0, liberator.bookmarks.get(filter)]
|
||||||
});
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
@@ -431,7 +428,7 @@ liberator.Bookmarks = function () //{{{
|
|||||||
var newAlias = alias;
|
var newAlias = alias;
|
||||||
for (let j = 1; j <= 10; j++) // <=10 is intentional
|
for (let j = 1; j <= 10; j++) // <=10 is intentional
|
||||||
{
|
{
|
||||||
if (!searchEngines.some(function (item) { return (item[0] == newAlias); }))
|
if (!searchEngines.some(function (item) (item[0] == newAlias)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
newAlias = alias + j;
|
newAlias = alias + j;
|
||||||
@@ -551,7 +548,7 @@ liberator.History = function () //{{{
|
|||||||
var cachedHistory = []; // add pages here after loading the initial Places history
|
var cachedHistory = []; // add pages here after loading the initial Places history
|
||||||
|
|
||||||
if (liberator.options["preload"])
|
if (liberator.options["preload"])
|
||||||
setTimeout(function () { load(); }, 100);
|
setTimeout(function () load(), 100);
|
||||||
|
|
||||||
function load()
|
function load()
|
||||||
{
|
{
|
||||||
@@ -704,7 +701,9 @@ liberator.History = function () //{{{
|
|||||||
liberator.commands.add(["hist[ory]", "hs"],
|
liberator.commands.add(["hist[ory]", "hs"],
|
||||||
"Show recently visited URLs",
|
"Show recently visited URLs",
|
||||||
function (args, special) { liberator.history.list(args, special); },
|
function (args, special) { liberator.history.list(args, special); },
|
||||||
{ completer: function (filter) { return [0, liberator.history.get(filter)]; } });
|
{
|
||||||
|
completer: function (filter) [0, liberator.history.get(filter)]
|
||||||
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
@@ -735,7 +734,7 @@ liberator.History = function () //{{{
|
|||||||
cachedHistory = [];
|
cachedHistory = [];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cachedHistory = cachedHistory.filter(function (elem) { return elem[0] != url; });
|
cachedHistory = cachedHistory.filter(function (elem) elem[0] != url);
|
||||||
|
|
||||||
cachedHistory.unshift([url, title || "[No title]"]);
|
cachedHistory.unshift([url, title || "[No title]"]);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ liberator.Buffer = function () //{{{
|
|||||||
window.fullScreen = value;
|
window.fullScreen = value;
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
getter: function () { return window.fullScreen; }
|
getter: function () window.fullScreen
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["nextpattern"],
|
liberator.options.add(["nextpattern"],
|
||||||
@@ -175,21 +175,21 @@ liberator.Buffer = function () //{{{
|
|||||||
["m", "Meta tags"]
|
["m", "Meta tags"]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
validator: function (value) { return !(/[^gfm]/.test(value) || value.length > 3 || value.length < 1); }
|
validator: function (value) !(/[^gfm]/.test(value) || value.length > 3 || value.length < 1)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["scroll", "scr"],
|
liberator.options.add(["scroll", "scr"],
|
||||||
"Number of lines to scroll with <C-u> and <C-d> commands",
|
"Number of lines to scroll with <C-u> and <C-d> commands",
|
||||||
"number", 0,
|
"number", 0,
|
||||||
{
|
{
|
||||||
validator: function (value) { return value >= 0; }
|
validator: function (value) value >= 0
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["showstatuslinks", "ssli"],
|
liberator.options.add(["showstatuslinks", "ssli"],
|
||||||
"Show the destination of the link under the cursor in the status bar",
|
"Show the destination of the link under the cursor in the status bar",
|
||||||
"number", 1,
|
"number", 1,
|
||||||
{
|
{
|
||||||
validator: function (value) { return (value >= 0 && value <= 2); },
|
validator: function (value) value >= 0 && value <= 2,
|
||||||
completer: function (filter)
|
completer: function (filter)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -509,7 +509,7 @@ liberator.Buffer = function () //{{{
|
|||||||
"Select the author style sheet to apply",
|
"Select the author style sheet to apply",
|
||||||
function (args)
|
function (args)
|
||||||
{
|
{
|
||||||
var titles = liberator.buffer.alternateStyleSheets.map(function (stylesheet) { return stylesheet.title; });
|
var titles = liberator.buffer.alternateStyleSheets.map(function (stylesheet) stylesheet.title);
|
||||||
|
|
||||||
if (args && titles.indexOf(args) == -1)
|
if (args && titles.indexOf(args) == -1)
|
||||||
{
|
{
|
||||||
@@ -523,7 +523,7 @@ liberator.Buffer = function () //{{{
|
|||||||
stylesheetSwitchAll(window.content, args);
|
stylesheetSwitchAll(window.content, args);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.stylesheet(filter); }
|
completer: function (filter) liberator.completion.stylesheet(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["re[load]"],
|
liberator.commands.add(["re[load]"],
|
||||||
@@ -611,9 +611,9 @@ liberator.Buffer = function () //{{{
|
|||||||
{
|
{
|
||||||
var stylesheets = getAllStyleSheets(window.content);
|
var stylesheets = getAllStyleSheets(window.content);
|
||||||
|
|
||||||
stylesheets = stylesheets.filter(function (stylesheet) {
|
stylesheets = stylesheets.filter(
|
||||||
return /^(screen|all|)$/i.test(stylesheet.media.mediaText) && !/^\s*$/.test(stylesheet.title);
|
function (stylesheet) /^(screen|all|)$/i.test(stylesheet.media.mediaText) && !/^\s*$/.test(stylesheet.title)
|
||||||
});
|
);
|
||||||
|
|
||||||
return stylesheets;
|
return stylesheets;
|
||||||
},
|
},
|
||||||
@@ -1011,8 +1011,7 @@ liberator.Buffer = function () //{{{
|
|||||||
var frames = [];
|
var frames = [];
|
||||||
|
|
||||||
// find all frames - depth-first search
|
// find all frames - depth-first search
|
||||||
(function (frame)
|
(function (frame) {
|
||||||
{
|
|
||||||
if (frame.document.body.localName.toLowerCase() == "body")
|
if (frame.document.body.localName.toLowerCase() == "body")
|
||||||
frames.push(frame);
|
frames.push(frame);
|
||||||
Array.forEach(frame.frames, arguments.callee);
|
Array.forEach(frame.frames, arguments.callee);
|
||||||
@@ -1025,9 +1024,9 @@ liberator.Buffer = function () //{{{
|
|||||||
// TODO: find a better way to do this - walking the tree is too slow
|
// TODO: find a better way to do this - walking the tree is too slow
|
||||||
var start = document.commandDispatcher.focusedWindow;
|
var start = document.commandDispatcher.focusedWindow;
|
||||||
frames = frames.filter(function (frame) {
|
frames = frames.filter(function (frame) {
|
||||||
frame.focus();
|
frame.focus();
|
||||||
if (document.commandDispatcher.focusedWindow == frame)
|
if (document.commandDispatcher.focusedWindow == frame)
|
||||||
return frame;
|
return frame;
|
||||||
});
|
});
|
||||||
start.focus();
|
start.focus();
|
||||||
|
|
||||||
@@ -1089,7 +1088,7 @@ liberator.Buffer = function () //{{{
|
|||||||
doc.body.appendChild(indicator);
|
doc.body.appendChild(indicator);
|
||||||
|
|
||||||
// remove the frame indicator
|
// remove the frame indicator
|
||||||
setTimeout(function () { doc.body.removeChild(indicator); }, 500);
|
setTimeout(function () doc.body.removeChild(indicator), 500);
|
||||||
},
|
},
|
||||||
|
|
||||||
// similar to pageInfo
|
// similar to pageInfo
|
||||||
@@ -1301,7 +1300,7 @@ liberator.Buffer = function () //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sort: ignore-case
|
// sort: ignore-case
|
||||||
tmpSort.sort(function (a, b) { return a.toLowerCase() > b.toLowerCase() ? 1 : -1; });
|
tmpSort.sort(function (a, b) a.toLowerCase() > b.toLowerCase() ? 1 : -1);
|
||||||
for (let i = 0; i < tmpSort.length; i++)
|
for (let i = 0; i < tmpSort.length; i++)
|
||||||
pageMeta.push([tmpDict[tmpSort[i]][0], liberator.util.highlightURL(tmpDict[tmpSort[i]][1], false)]);
|
pageMeta.push([tmpDict[tmpSort[i]][0], liberator.util.highlightURL(tmpDict[tmpSort[i]][1], false)]);
|
||||||
}
|
}
|
||||||
@@ -1745,8 +1744,8 @@ liberator.Marks = function () //{{{
|
|||||||
if (filter.length > 0)
|
if (filter.length > 0)
|
||||||
{
|
{
|
||||||
marks = marks.filter(function (mark) {
|
marks = marks.filter(function (mark) {
|
||||||
if (filter.indexOf(mark[0]) > -1)
|
if (filter.indexOf(mark[0]) > -1)
|
||||||
return mark;
|
return mark;
|
||||||
});
|
});
|
||||||
if (marks.length == 0)
|
if (marks.length == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ liberator.Commands = function () //{{{
|
|||||||
|
|
||||||
__iterator__: function ()
|
__iterator__: function ()
|
||||||
{
|
{
|
||||||
var sorted = exCommands.sort(function (cmd1, cmd2) { return cmd1.name > cmd2.name; });
|
var sorted = exCommands.sort(function (cmd1, cmd2) cmd1.name > cmd2.name);
|
||||||
for (let i = 0; i < sorted.length; i++)
|
for (let i = 0; i < sorted.length; i++)
|
||||||
yield sorted[i];
|
yield sorted[i];
|
||||||
},
|
},
|
||||||
@@ -713,19 +713,14 @@ liberator.Commands = function () //{{{
|
|||||||
/*options: [[["-nargs"], OPTION_STRING, function (arg) { return /^(0|1|\*|\?|\+)$/.test(arg); }],
|
/*options: [[["-nargs"], OPTION_STRING, function (arg) { return /^(0|1|\*|\?|\+)$/.test(arg); }],
|
||||||
[["-bang"], OPTION_NOARG],
|
[["-bang"], OPTION_NOARG],
|
||||||
[["-bar"], OPTION_NOARG]] */
|
[["-bar"], OPTION_NOARG]] */
|
||||||
completer: function (filter)
|
completer: function (filter) liberator.completion.userCommand(filter)
|
||||||
{
|
|
||||||
return liberator.completion.userCommand(filter);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
commandManager.add(["comc[lear]"],
|
commandManager.add(["comc[lear]"],
|
||||||
"Delete all user-defined commands",
|
"Delete all user-defined commands",
|
||||||
function ()
|
function ()
|
||||||
{
|
{
|
||||||
liberator.commands.getUserCommands().forEach(function (cmd) {
|
liberator.commands.getUserCommands().forEach(function (cmd) liberator.commands.removeUserCommand(cmd.name));
|
||||||
liberator.commands.removeUserCommand(cmd.name);
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
{ argCount: "0" });
|
{ argCount: "0" });
|
||||||
|
|
||||||
@@ -749,10 +744,7 @@ liberator.Commands = function () //{{{
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
argCount: "1",
|
argCount: "1",
|
||||||
completer: function (filter)
|
completer: function (filter) liberator.completion.userCommand(filter)
|
||||||
{
|
|
||||||
return liberator.completion.userCommand(filter);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//}}}
|
//}}}
|
||||||
|
|||||||
@@ -79,9 +79,7 @@ liberator.Completion = function () //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
substrings = substrings.filter(function ($_) {
|
substrings = substrings.filter(function ($_) complist[j].indexOf($_) >= 0);
|
||||||
return complist[j].indexOf($_) >= 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -119,9 +117,7 @@ liberator.Completion = function () //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
substrings = substrings.filter(function ($_) {
|
substrings = substrings.filter(function ($_) complist[j].indexOf($_) == 0);
|
||||||
return complist[j].indexOf($_) == 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -199,7 +195,7 @@ liberator.Completion = function () //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!filter)
|
if (!filter)
|
||||||
return [0, items.map(function ($_) { return [$_[0][0], $_[1]]; })];
|
return [0, items.map(function ($_) [$_[0][0], $_[1]])];
|
||||||
|
|
||||||
return [0, buildLongestCommonSubstring(items, filter)];
|
return [0, buildLongestCommonSubstring(items, filter)];
|
||||||
},
|
},
|
||||||
@@ -365,8 +361,7 @@ liberator.Completion = function () //{{{
|
|||||||
.getService(Components.interfaces.nsIBrowserSearchService);
|
.getService(Components.interfaces.nsIBrowserSearchService);
|
||||||
|
|
||||||
var completions = [];
|
var completions = [];
|
||||||
engineList.forEach (function (name)
|
engineList.forEach(function (name) {
|
||||||
{
|
|
||||||
var query = filter;
|
var query = filter;
|
||||||
var queryURI;
|
var queryURI;
|
||||||
var engine = ss.getEngineByAlias(name);
|
var engine = ss.getEngineByAlias(name);
|
||||||
@@ -390,8 +385,7 @@ liberator.Completion = function () //{{{
|
|||||||
if (!results)
|
if (!results)
|
||||||
return [0, []];
|
return [0, []];
|
||||||
|
|
||||||
results.forEach(function (item)
|
results.forEach(function (item) {
|
||||||
{
|
|
||||||
// make sure we receive strings, otherwise a man-in-the-middle attack
|
// make sure we receive strings, otherwise a man-in-the-middle attack
|
||||||
// could return objects which toString() method could be called to
|
// could return objects which toString() method could be called to
|
||||||
// execute untrusted code
|
// execute untrusted code
|
||||||
@@ -407,9 +401,9 @@ liberator.Completion = function () //{{{
|
|||||||
|
|
||||||
stylesheet: function (filter)
|
stylesheet: function (filter)
|
||||||
{
|
{
|
||||||
var completions = liberator.buffer.alternateStyleSheets.map(function (stylesheet) {
|
var completions = liberator.buffer.alternateStyleSheets.map(
|
||||||
return [stylesheet.title, stylesheet.href || "inline"];
|
function (stylesheet) [stylesheet.title, stylesheet.href || "inline"]
|
||||||
});
|
);
|
||||||
|
|
||||||
// unify split style sheets
|
// unify split style sheets
|
||||||
completions.forEach(function (stylesheet) {
|
completions.forEach(function (stylesheet) {
|
||||||
@@ -491,7 +485,7 @@ liberator.Completion = function () //{{{
|
|||||||
userCommand: function (filter)
|
userCommand: function (filter)
|
||||||
{
|
{
|
||||||
var commands = liberator.commands.getUserCommands();
|
var commands = liberator.commands.getUserCommands();
|
||||||
commands = commands.map(function (command) { return [command.name, ""]; });
|
commands = commands.map(function (command) [command.name, ""]);
|
||||||
return [0, this.filter(commands, filter)];
|
return [0, this.filter(commands, filter)];
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -559,9 +553,9 @@ liberator.Completion = function () //{{{
|
|||||||
{
|
{
|
||||||
// no direct match of filter in the url, but still accept this item
|
// no direct match of filter in the url, but still accept this item
|
||||||
// if _all_ tokens of filter match either the url or the title
|
// if _all_ tokens of filter match either the url or the title
|
||||||
if (filter.split(/\s+/).every(function (token) {
|
if (filter.split(/\s+/).every(
|
||||||
return (url.indexOf(token) > -1 || title.indexOf(token) > -1);
|
function (token) url.indexOf(token) > -1 || title.indexOf(token) > -1
|
||||||
}))
|
))
|
||||||
additionalCompletions.push(elem);
|
additionalCompletions.push(elem);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
@@ -583,9 +577,7 @@ liberator.Completion = function () //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
substrings = substrings.filter(function ($_) {
|
substrings = substrings.filter(function ($_) url.indexOf($_) >= 0);
|
||||||
return url.indexOf($_) >= 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
filtered.push(elem);
|
filtered.push(elem);
|
||||||
@@ -608,7 +600,7 @@ liberator.Completion = function () //{{{
|
|||||||
itemsStr = itemsStr.toLowerCase();
|
itemsStr = itemsStr.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter.split(/\s+/).every(function (str) { return itemsStr.indexOf(str) > -1; }))
|
if (filter.split(/\s+/).every(function (str) itemsStr.indexOf(str) > -1))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -225,12 +225,10 @@ liberator.AutoCommands = function () //{{{
|
|||||||
|
|
||||||
trigger: function (auEvent, url)
|
trigger: function (auEvent, url)
|
||||||
{
|
{
|
||||||
if (liberator.options["eventignore"].split(",").some(function (event) {
|
let events = liberator.options["eventignore"].split(",");
|
||||||
return event == "all" || event == auEvent;
|
|
||||||
}))
|
if (events.some(function (event) event == "all" || event == auEvent))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (autoCommands[auEvent])
|
if (autoCommands[auEvent])
|
||||||
{
|
{
|
||||||
@@ -286,7 +284,7 @@ liberator.Events = function () //{{{
|
|||||||
liberator.tabs.updateSelectionHistory();
|
liberator.tabs.updateSelectionHistory();
|
||||||
|
|
||||||
if (liberator.options["focuscontent"])
|
if (liberator.options["focuscontent"])
|
||||||
setTimeout(function () { liberator.focusContent(true); }, 10); // just make sure, that no widget has focus
|
setTimeout(function () liberator.focusContent(true), 10); // just make sure, that no widget has focus
|
||||||
}, false);
|
}, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -642,7 +640,7 @@ liberator.Events = function () //{{{
|
|||||||
liberator.events.deleteMacros(args);
|
liberator.events.deleteMacros(args);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.macro(filter); }
|
completer: function (filter) liberator.completion.macro(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["macros"],
|
liberator.commands.add(["macros"],
|
||||||
@@ -660,7 +658,7 @@ liberator.Events = function () //{{{
|
|||||||
liberator.echo(str, liberator.commandline.FORCE_MULTILINE);
|
liberator.echo(str, liberator.commandline.FORCE_MULTILINE);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.macro(filter); }
|
completer: function (filter) liberator.completion.macro(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["pl[ay]"],
|
liberator.commands.add(["pl[ay]"],
|
||||||
@@ -673,7 +671,7 @@ liberator.Events = function () //{{{
|
|||||||
liberator.events.playMacro(args);
|
liberator.events.playMacro(args);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.macro(filter); }
|
completer: function (filter) liberator.completion.macro(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
@@ -1036,8 +1034,7 @@ liberator.Events = function () //{{{
|
|||||||
{
|
{
|
||||||
// FIXME: currently this hack is disabled to make macros work
|
// FIXME: currently this hack is disabled to make macros work
|
||||||
// this.wantsModeReset = true;
|
// this.wantsModeReset = true;
|
||||||
// setTimeout(function ()
|
// setTimeout(function () {
|
||||||
// {
|
|
||||||
// liberator.dump("cur: " + liberator.mode + "\n");
|
// liberator.dump("cur: " + liberator.mode + "\n");
|
||||||
// if (liberator.events.wantsModeReset)
|
// if (liberator.events.wantsModeReset)
|
||||||
// {
|
// {
|
||||||
@@ -1450,7 +1447,7 @@ liberator.Events = function () //{{{
|
|||||||
// is not the focused frame
|
// is not the focused frame
|
||||||
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow)
|
if (document.commandDispatcher.focusedWindow == webProgress.DOMWindow)
|
||||||
{
|
{
|
||||||
setTimeout (function () { liberator.modes.reset(false); },
|
setTimeout(function () liberator.modes.reset(false),
|
||||||
liberator.mode == liberator.modes.HINTS ? 500 : 0);
|
liberator.mode == liberator.modes.HINTS ? 500 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1489,7 +1486,7 @@ liberator.Events = function () //{{{
|
|||||||
liberator.autocommands.trigger("LocationChange", liberator.buffer.URL);
|
liberator.autocommands.trigger("LocationChange", liberator.buffer.URL);
|
||||||
|
|
||||||
// if this is not delayed we get the position of the old buffer
|
// if this is not delayed we get the position of the old buffer
|
||||||
setTimeout(function () { liberator.statusline.updateBufferPosition(); }, 100);
|
setTimeout(function () liberator.statusline.updateBufferPosition(), 100);
|
||||||
},
|
},
|
||||||
// called at the very end of a page load
|
// called at the very end of a page load
|
||||||
asyncUpdateUI: function ()
|
asyncUpdateUI: function ()
|
||||||
|
|||||||
@@ -346,7 +346,7 @@ liberator.Search = function () //{{{
|
|||||||
found = fastFind.find(searchString, linksOnly) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
|
found = fastFind.find(searchString, linksOnly) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
|
||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
setTimeout(function () { liberator.echoerr("E486: Pattern not found: " + searchPattern); }, 0);
|
setTimeout(function () liberator.echoerr("E486: Pattern not found: " + searchPattern), 0);
|
||||||
|
|
||||||
return found;
|
return found;
|
||||||
},
|
},
|
||||||
@@ -417,7 +417,7 @@ liberator.Search = function () //{{{
|
|||||||
// TODO: move to find() when reverse incremental searching is kludged in
|
// TODO: move to find() when reverse incremental searching is kludged in
|
||||||
// need to find again for reverse searching
|
// need to find again for reverse searching
|
||||||
if (backwards)
|
if (backwards)
|
||||||
setTimeout(function () { liberator.search.findAgain(false); }, 0);
|
setTimeout(function () liberator.search.findAgain(false), 0);
|
||||||
|
|
||||||
if (liberator.options["hlsearch"])
|
if (liberator.options["hlsearch"])
|
||||||
this.highlight(searchString);
|
this.highlight(searchString);
|
||||||
|
|||||||
@@ -292,8 +292,8 @@ liberator.Hints = function () //{{{
|
|||||||
// }
|
// }
|
||||||
// }, 100);
|
// }, 100);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
firstElem.style.backgroundColor = firstElemBgColor;
|
firstElem.style.backgroundColor = firstElemBgColor;
|
||||||
firstElem.style.color = firstElemColor;
|
firstElem.style.color = firstElemColor;
|
||||||
}, timeout);
|
}, timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,8 +340,8 @@ liberator.Hints = function () //{{{
|
|||||||
case "V": liberator.buffer.viewSource(loc, true); break;
|
case "V": liberator.buffer.viewSource(loc, true); break;
|
||||||
case "w": liberator.buffer.followLink(elem, liberator.NEW_WINDOW); break;
|
case "w": liberator.buffer.followLink(elem, liberator.NEW_WINDOW); break;
|
||||||
case "W": liberator.commandline.open(":", "winopen " + loc, liberator.modes.EX); break;
|
case "W": liberator.commandline.open(":", "winopen " + loc, liberator.modes.EX); break;
|
||||||
case "y": setTimeout(function () { liberator.util.copyToClipboard(loc, true); }, timeout + 50); break;
|
case "y": setTimeout(function () liberator.util.copyToClipboard(loc, true), timeout + 50); break;
|
||||||
case "Y": setTimeout(function () { liberator.util.copyToClipboard(elem.textContent || "", true); }, timeout + 50); break;
|
case "Y": setTimeout(function () liberator.util.copyToClipboard(elem.textContent || "", true), timeout + 50); break;
|
||||||
default:
|
default:
|
||||||
liberator.echoerr("INTERNAL ERROR: unknown submode: " + submode);
|
liberator.echoerr("INTERNAL ERROR: unknown submode: " + submode);
|
||||||
}
|
}
|
||||||
@@ -568,7 +568,7 @@ liberator.Hints = function () //{{{
|
|||||||
"Automatically follow non unique numerical hint",
|
"Automatically follow non unique numerical hint",
|
||||||
"number", 0,
|
"number", 0,
|
||||||
{
|
{
|
||||||
validator: function (value) { return value >= 0; }
|
validator: function (value) value >= 0
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["linkfgcolor", "lfc"],
|
liberator.options.add(["linkfgcolor", "lfc"],
|
||||||
@@ -591,11 +591,10 @@ liberator.Hints = function () //{{{
|
|||||||
"How links are matched",
|
"How links are matched",
|
||||||
"string", "contains",
|
"string", "contains",
|
||||||
{
|
{
|
||||||
validator: function (value) { return /^(?:contains|wordstartswith|firstletters|custom)$/.test(value); },
|
validator: function (value) /^(?:contains|wordstartswith|firstletters|custom)$/.test(value),
|
||||||
completer: function (filter)
|
completer: function (filter)
|
||||||
{
|
{
|
||||||
return ["contains", "wordstartswith", "firstletters", "custom"]
|
return ["contains", "wordstartswith", "firstletters", "custom"].map(function (m) [m, ""]);
|
||||||
.map(function (m){ return [m, ""]; });
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -807,7 +806,7 @@ liberator.Hints = function () //{{{
|
|||||||
{
|
{
|
||||||
var timeout = liberator.options["hinttimeout"];
|
var timeout = liberator.options["hinttimeout"];
|
||||||
if (timeout > 0)
|
if (timeout > 0)
|
||||||
activeTimeout = setTimeout(function () { processHints(true); }, timeout);
|
activeTimeout = setTimeout(function () processHints(true), timeout);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ liberator.IO = function () //{{{
|
|||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
{
|
{
|
||||||
shell = "cmd.exe";
|
shell = "cmd.exe";
|
||||||
// TODO: does setting 'shell' to "something containing sh"
|
// TODO: setting 'shell' to "something containing sh" updates
|
||||||
// automatically update 'shellcmdflag' on Windows in Vim?
|
// 'shellcmdflag' appropriately at startup on Windows in Vim
|
||||||
shellcmdflag = "/c";
|
shellcmdflag = "/c";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -107,10 +107,7 @@ liberator.IO = function () //{{{
|
|||||||
"Shell to use for executing :! and :run commands",
|
"Shell to use for executing :! and :run commands",
|
||||||
"string", shell,
|
"string", shell,
|
||||||
{
|
{
|
||||||
setter: function (value)
|
setter: function (value) liberator.io.expandPath(value)
|
||||||
{
|
|
||||||
return liberator.io.expandPath(value);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["shellcmdflag", "shcf"],
|
liberator.options.add(["shellcmdflag", "shcf"],
|
||||||
@@ -155,9 +152,9 @@ liberator.IO = function () //{{{
|
|||||||
var directories = liberator.options["cdpath"].replace(/^,$|^,,|,,$/, "").split(",");
|
var directories = liberator.options["cdpath"].replace(/^,$|^,,|,,$/, "").split(",");
|
||||||
|
|
||||||
// empty 'cdpath' items mean the current directory
|
// empty 'cdpath' items mean the current directory
|
||||||
directories = directories.map(function (directory) {
|
directories = directories.map(
|
||||||
return directory == "" ? liberator.io.getCurrentDirectory() : directory;
|
function (directory) directory == "" ? liberator.io.getCurrentDirectory() : directory
|
||||||
});
|
);
|
||||||
|
|
||||||
var directoryFound = false;
|
var directoryFound = false;
|
||||||
|
|
||||||
@@ -183,7 +180,7 @@ liberator.IO = function () //{{{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.file(filter, true); }
|
completer: function (filter) liberator.completion.file(filter, true)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["fini[sh]"],
|
liberator.commands.add(["fini[sh]"],
|
||||||
@@ -326,7 +323,7 @@ liberator.IO = function () //{{{
|
|||||||
liberator.io.source(args, special);
|
liberator.io.source(args, special);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.file(filter, true); }
|
completer: function (filter) liberator.completion.file(filter, true)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["!", "run"],
|
liberator.commands.add(["!", "run"],
|
||||||
|
|||||||
@@ -55,8 +55,7 @@ const liberator = (function () //{{{
|
|||||||
|
|
||||||
for (let option in guioptions)
|
for (let option in guioptions)
|
||||||
{
|
{
|
||||||
guioptions[option].forEach(function (elem)
|
guioptions[option].forEach(function (elem) {
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
document.getElementById(elem).collapsed = (value.indexOf(option.toString()) < 0);
|
document.getElementById(elem).collapsed = (value.indexOf(option.toString()) < 0);
|
||||||
@@ -98,7 +97,7 @@ const liberator = (function () //{{{
|
|||||||
"Define which type of messages are logged",
|
"Define which type of messages are logged",
|
||||||
"number", 0,
|
"number", 0,
|
||||||
{
|
{
|
||||||
validator: function (value) { return (value >= 0 && value <= 9); }
|
validator: function (value) value >= 0 && value <= 9
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["visualbell", "vb"],
|
liberator.options.add(["visualbell", "vb"],
|
||||||
@@ -220,7 +219,7 @@ const liberator = (function () //{{{
|
|||||||
var item = args.string;
|
var item = args.string;
|
||||||
var items = getMenuItems();
|
var items = getMenuItems();
|
||||||
|
|
||||||
if (!items.some(function (i) { return i.fullMenuPath == item; }))
|
if (!items.some(function (i) i.fullMenuPath == item))
|
||||||
{
|
{
|
||||||
liberator.echoerr("E334: Menu not found: " + item);
|
liberator.echoerr("E334: Menu not found: " + item);
|
||||||
return;
|
return;
|
||||||
@@ -236,9 +235,9 @@ const liberator = (function () //{{{
|
|||||||
argCount: "+", // NOTE: single arg may contain unescaped whitespace
|
argCount: "+", // NOTE: single arg may contain unescaped whitespace
|
||||||
completer: function (filter)
|
completer: function (filter)
|
||||||
{
|
{
|
||||||
var completions = getMenuItems().map(function (item) {
|
var completions = getMenuItems().map(
|
||||||
return [item.fullMenuPath, item.label];
|
function (item) [item.fullMenuPath, item.label]
|
||||||
});
|
);
|
||||||
return [0, liberator.completion.filter(completions, filter)];
|
return [0, liberator.completion.filter(completions, filter)];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -302,7 +301,7 @@ const liberator = (function () //{{{
|
|||||||
liberator.help(args);
|
liberator.help(args);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return getHelpCompletions(filter); }
|
completer: function (filter) getHelpCompletions(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["javas[cript]", "js"],
|
liberator.commands.add(["javas[cript]", "js"],
|
||||||
@@ -349,7 +348,7 @@ const liberator = (function () //{{{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.javascript(filter); }
|
completer: function (filter) liberator.completion.javascript(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["norm[al]"],
|
liberator.commands.add(["norm[al]"],
|
||||||
@@ -545,8 +544,7 @@ const liberator = (function () //{{{
|
|||||||
var guioptions = liberator.config.guioptions || {};
|
var guioptions = liberator.config.guioptions || {};
|
||||||
for (let option in guioptions)
|
for (let option in guioptions)
|
||||||
{
|
{
|
||||||
guioptions[option].forEach(function (elem)
|
guioptions[option].forEach(function (elem) {
|
||||||
{
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
document.getElementById(elem).collapsed = true;
|
document.getElementById(elem).collapsed = true;
|
||||||
@@ -625,7 +623,7 @@ const liberator = (function () //{{{
|
|||||||
popup.height = box.height;
|
popup.height = box.height;
|
||||||
popup.width = box.width;
|
popup.width = box.width;
|
||||||
popup.openPopup(win, "overlap", 0, 0, false, false);
|
popup.openPopup(win, "overlap", 0, 0, false, false);
|
||||||
setTimeout(function () { popup.hidePopup(); }, 50);
|
setTimeout(function () popup.hidePopup(), 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -793,7 +791,7 @@ const liberator = (function () //{{{
|
|||||||
has: function (feature)
|
has: function (feature)
|
||||||
{
|
{
|
||||||
var features = liberator.config.features || [];
|
var features = liberator.config.features || [];
|
||||||
return features.some (function (feat) { return feat == feature; });
|
return features.some(function (feat) feat == feature);
|
||||||
},
|
},
|
||||||
|
|
||||||
help: function (topic)
|
help: function (topic)
|
||||||
|
|||||||
@@ -139,12 +139,12 @@ liberator.Mail = function () //{{{
|
|||||||
if (copy)
|
if (copy)
|
||||||
{
|
{
|
||||||
MsgCopyMessage(folders[0]);
|
MsgCopyMessage(folders[0]);
|
||||||
setTimeout(function () { liberator.echo(count + " message(s) copied to " + folders[0].prettyName); }, 100);
|
setTimeout(function () liberator.echo(count + " message(s) copied to " + folders[0].prettyName), 100);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MsgMoveMessage(folders[0]);
|
MsgMoveMessage(folders[0]);
|
||||||
setTimeout(function () { liberator.echo(count + " message(s) moved to " + folders[0].prettyName); }, 100);
|
setTimeout(function () liberator.echo(count + " message(s) moved to " + folders[0].prettyName), 100);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -207,7 +207,7 @@ liberator.Mail = function () //{{{
|
|||||||
"Set the layout of the mail window",
|
"Set the layout of the mail window",
|
||||||
"string", "inherit",
|
"string", "inherit",
|
||||||
{
|
{
|
||||||
validator: function (value) { return /^(classic|wide|vertical|inherit)$/.test(value); },
|
validator: function (value) /^(classic|wide|vertical|inherit)$/.test(value),
|
||||||
setter: function (value)
|
setter: function (value)
|
||||||
{
|
{
|
||||||
switch (value)
|
switch (value)
|
||||||
@@ -276,32 +276,32 @@ liberator.Mail = function () //{{{
|
|||||||
|
|
||||||
liberator.mappings.add(modes, ["j", "<Right>"],
|
liberator.mappings.add(modes, ["j", "<Right>"],
|
||||||
"Select next message",
|
"Select next message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return true; }, false, false, false, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) true, false, false, false, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["gj"],
|
liberator.mappings.add(modes, ["gj"],
|
||||||
"Select next message, including closed threads",
|
"Select next message, including closed threads",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return true; }, false, true, false, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) true, false, true, false, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["J", "<Tab>"],
|
liberator.mappings.add(modes, ["J", "<Tab>"],
|
||||||
"Select next unread message",
|
"Select next unread message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return !msg.isRead; }, true, true, false, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) !msg.isRead, true, true, false, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["k", "<Left>"],
|
liberator.mappings.add(modes, ["k", "<Left>"],
|
||||||
"Select previous message",
|
"Select previous message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return true; }, false, false, true, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) true, false, false, true, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["gk"],
|
liberator.mappings.add(modes, ["gk"],
|
||||||
"Select previous message",
|
"Select previous message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return true; }, false, true, true, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) true, false, true, true, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["K"],
|
liberator.mappings.add(modes, ["K"],
|
||||||
"Select previous unread message",
|
"Select previous unread message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return !msg.isRead; }, true, true, true, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) !msg.isRead, true, true, true, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["*"],
|
liberator.mappings.add(modes, ["*"],
|
||||||
@@ -311,7 +311,7 @@ liberator.Mail = function () //{{{
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
|
var author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
|
||||||
liberator.mail.selectMessage(function (msg) { return msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0; }, true, true, false, count);
|
liberator.mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, count);
|
||||||
}
|
}
|
||||||
catch (e) { liberator.beep(); }
|
catch (e) { liberator.beep(); }
|
||||||
},
|
},
|
||||||
@@ -324,7 +324,7 @@ liberator.Mail = function () //{{{
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
|
var author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
|
||||||
liberator.mail.selectMessage(function (msg) { return msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0; }, true, true, true, count);
|
liberator.mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, count);
|
||||||
}
|
}
|
||||||
catch (e) { liberator.beep(); }
|
catch (e) { liberator.beep(); }
|
||||||
},
|
},
|
||||||
@@ -376,12 +376,12 @@ liberator.Mail = function () //{{{
|
|||||||
|
|
||||||
liberator.mappings.add([liberator.modes.MESSAGE], ["<Left>"],
|
liberator.mappings.add([liberator.modes.MESSAGE], ["<Left>"],
|
||||||
"Select previous message",
|
"Select previous message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return true; }, false, false, true, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) true, false, false, true, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add([liberator.modes.MESSAGE], ["<Right>"],
|
liberator.mappings.add([liberator.modes.MESSAGE], ["<Right>"],
|
||||||
"Select next message",
|
"Select next message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return true; }, false, false, false, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) true, false, false, false, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
// UNDO/REDO
|
// UNDO/REDO
|
||||||
@@ -432,22 +432,22 @@ liberator.Mail = function () //{{{
|
|||||||
|
|
||||||
liberator.mappings.add(modes, ["]s"],
|
liberator.mappings.add(modes, ["]s"],
|
||||||
"Select next starred message",
|
"Select next starred message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return msg.isFlagged; }, true, true, false, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) msg.isFlagged, true, true, false, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["[s"],
|
liberator.mappings.add(modes, ["[s"],
|
||||||
"Select previous starred message",
|
"Select previous starred message",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return msg.isFlagged; }, true, true, true, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) msg.isFlagged, true, true, true, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["]a"],
|
liberator.mappings.add(modes, ["]a"],
|
||||||
"Select next message with an attachment",
|
"Select next message with an attachment",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return gDBView.db.HasAttachments(msg.messageKey); }, true, true, false, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
liberator.mappings.add(modes, ["[a"],
|
liberator.mappings.add(modes, ["[a"],
|
||||||
"Select previous message with an attachment",
|
"Select previous message with an attachment",
|
||||||
function (count) { liberator.mail.selectMessage(function (msg) { return gDBView.db.HasAttachments(msg.messageKey); }, true, true, true, count); },
|
function (count) { liberator.mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, count); },
|
||||||
{ flags: liberator.Mappings.flags.COUNT });
|
{ flags: liberator.Mappings.flags.COUNT });
|
||||||
|
|
||||||
// FOLDER SWITCHING
|
// FOLDER SWITCHING
|
||||||
@@ -591,9 +591,7 @@ liberator.Mail = function () //{{{
|
|||||||
"Mark all messages as read",
|
"Mark all messages as read",
|
||||||
function ()
|
function ()
|
||||||
{
|
{
|
||||||
liberator.mail.getFolders("", false).forEach(function (folder) {
|
liberator.mail.getFolders("", false).forEach(function (folder) folder.markAllMessagesRead());
|
||||||
folder.markAllMessagesRead();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// DISPLAY OPTIONS
|
// DISPLAY OPTIONS
|
||||||
@@ -675,7 +673,7 @@ liberator.Mail = function () //{{{
|
|||||||
SelectFolder(folder.URI);
|
SelectFolder(folder.URI);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return getFolderCompletions(filter); }
|
completer: function (filter) getFolderCompletions(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["m[essage]"],
|
liberator.commands.add(["m[essage]"],
|
||||||
@@ -697,7 +695,7 @@ liberator.Mail = function () //{{{
|
|||||||
addresses = addresses.concat(mailargs.cc);
|
addresses = addresses.concat(mailargs.cc);
|
||||||
|
|
||||||
// TODO: is there a better way to check for validity?
|
// TODO: is there a better way to check for validity?
|
||||||
if (addresses.some(function (recipient) { return !(/\S@\S+\.\S/.test(recipient)); }))
|
if (addresses.some(function (recipient) !(/\S@\S+\.\S/.test(recipient))))
|
||||||
{
|
{
|
||||||
liberator.echoerr("Exxx: Invalid e-mail address");
|
liberator.echoerr("Exxx: Invalid e-mail address");
|
||||||
return;
|
return;
|
||||||
@@ -717,14 +715,14 @@ liberator.Mail = function () //{{{
|
|||||||
"Copy selected messages",
|
"Copy selected messages",
|
||||||
function (args, special) { moveOrCopy(true, args); },
|
function (args, special) { moveOrCopy(true, args); },
|
||||||
{
|
{
|
||||||
completer: function (filter) { return getFolderCompletions(filter); }
|
completer: function (filter) getFolderCompletions(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["move[to]"],
|
liberator.commands.add(["move[to]"],
|
||||||
"Move selected messages",
|
"Move selected messages",
|
||||||
function (args, special) { moveOrCopy(false, args); },
|
function (args, special) { moveOrCopy(false, args); },
|
||||||
{
|
{
|
||||||
completer: function (filter) { return getFolderCompletions(filter); }
|
completer: function (filter) getFolderCompletions(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["empty[trash]"],
|
liberator.commands.add(["empty[trash]"],
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ liberator.Mappings = function () //{{{
|
|||||||
function addMap(map, userMap)
|
function addMap(map, userMap)
|
||||||
{
|
{
|
||||||
var where = userMap ? user : main;
|
var where = userMap ? user : main;
|
||||||
map.modes.forEach(function (mode) { where[mode].push(map); });
|
map.modes.forEach(function (mode) where[mode].push(map));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMap(mode, cmd, stack)
|
function getMap(mode, cmd, stack)
|
||||||
@@ -204,10 +204,7 @@ liberator.Mappings = function () //{{{
|
|||||||
"Map a key sequence" + modeDescription,
|
"Map a key sequence" + modeDescription,
|
||||||
function (args) { map(args, modes, false); },
|
function (args) { map(args, modes, false); },
|
||||||
{
|
{
|
||||||
completer: function (filter)
|
completer: function (filter) liberator.completion.userMapping(filter, modes)
|
||||||
{
|
|
||||||
return liberator.completion.userMapping(filter, modes);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add([ch + "no[remap]"],
|
liberator.commands.add([ch + "no[remap]"],
|
||||||
@@ -246,10 +243,7 @@ liberator.Mappings = function () //{{{
|
|||||||
liberator.echoerr("E31: No such mapping");
|
liberator.echoerr("E31: No such mapping");
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter)
|
completer: function (filter) liberator.completion.userMapping(filter, modes)
|
||||||
{
|
|
||||||
return liberator.completion.userMapping(filter, modes);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,12 +285,12 @@ liberator.Mappings = function () //{{{
|
|||||||
|
|
||||||
add: function (modes, keys, description, action, extra)
|
add: function (modes, keys, description, action, extra)
|
||||||
{
|
{
|
||||||
addMap (new liberator.Map(modes, keys, description, action, extra), false);
|
addMap(new liberator.Map(modes, keys, description, action, extra), false);
|
||||||
},
|
},
|
||||||
|
|
||||||
addUserMap: function (modes, keys, description, action, extra)
|
addUserMap: function (modes, keys, description, action, extra)
|
||||||
{
|
{
|
||||||
keys = keys.map(function (key) { return expandLeader(key); });
|
keys = keys.map(function (key) expandLeader(key));
|
||||||
var map = new liberator.Map(modes, keys, description || "User defined mapping", action, extra);
|
var map = new liberator.Map(modes, keys, description || "User defined mapping", action, extra);
|
||||||
|
|
||||||
// remove all old mappings to this key sequence
|
// remove all old mappings to this key sequence
|
||||||
@@ -306,7 +300,7 @@ liberator.Mappings = function () //{{{
|
|||||||
removeMap(map.modes[j], map.names[i]);
|
removeMap(map.modes[j], map.names[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
addMap (map, true);
|
addMap(map, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
get: function (mode, cmd)
|
get: function (mode, cmd)
|
||||||
@@ -353,7 +347,7 @@ liberator.Mappings = function () //{{{
|
|||||||
// returns whether the user added a custom user map
|
// returns whether the user added a custom user map
|
||||||
hasMap: function (mode, cmd)
|
hasMap: function (mode, cmd)
|
||||||
{
|
{
|
||||||
return user[mode].some(function (map) { return map.hasName(cmd); });
|
return user[mode].some(function (map) map.hasName(cmd));
|
||||||
},
|
},
|
||||||
|
|
||||||
remove: function (mode, cmd)
|
remove: function (mode, cmd)
|
||||||
|
|||||||
@@ -901,8 +901,7 @@ liberator.Options = function () //{{{
|
|||||||
" Options ---</th></tr>";
|
" Options ---</th></tr>";
|
||||||
var name, value, defaultValue;
|
var name, value, defaultValue;
|
||||||
|
|
||||||
prefArray.forEach(function (pref)
|
prefArray.forEach(function (pref) {
|
||||||
{
|
|
||||||
var userValue = prefService.prefHasUserValue(pref);
|
var userValue = prefService.prefHasUserValue(pref);
|
||||||
if ((!onlyNonDefault || userValue) && pref.indexOf(filter) >= 0)
|
if ((!onlyNonDefault || userValue) && pref.indexOf(filter) >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ liberator.Tabs = function () //{{{
|
|||||||
|
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
validator: function (value) { return (value >= 0 && value <= 2); },
|
validator: function (value) (value >= 0 && value <= 2),
|
||||||
completer: function (filter)
|
completer: function (filter)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@@ -170,7 +170,9 @@ liberator.Tabs = function () //{{{
|
|||||||
},
|
},
|
||||||
validator: function (value)
|
validator: function (value)
|
||||||
{
|
{
|
||||||
return value.split(",").every(function (item) { return /^(homepage|quickmark|tabopen|paste|)$/.test(item); });
|
return value.split(",").every(
|
||||||
|
function (item) /^(homepage|quickmark|tabopen|paste|)$/.test(item)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -191,7 +193,9 @@ liberator.Tabs = function () //{{{
|
|||||||
},
|
},
|
||||||
validator: function (value)
|
validator: function (value)
|
||||||
{
|
{
|
||||||
return value == "all" || value.split(",").every(function (item) { return /^(addons|downloads|help|javascript|prefs|)$/.test(item); });
|
return value == "all" || value.split(",").every(
|
||||||
|
function (item) /^(addons|downloads|help|javascript|prefs|)$/.test(item)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -222,7 +226,7 @@ liberator.Tabs = function () //{{{
|
|||||||
["4", "Open in the same tab unless it has a specific requested size"]
|
["4", "Open in the same tab unless it has a specific requested size"]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
validator: function (value) { return (value >= 0 && value <= 4); }
|
validator: function (value) value >= 0 && value <= 4
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,7 +343,9 @@ liberator.Tabs = function () //{{{
|
|||||||
else // just remove the current tab
|
else // just remove the current tab
|
||||||
liberator.tabs.remove(getBrowser().mCurrentTab, count > 0 ? count : 1, special, 0);
|
liberator.tabs.remove(getBrowser().mCurrentTab, count > 0 ? count : 1, special, 0);
|
||||||
},
|
},
|
||||||
{ completer: function (filter) { return liberator.completion.buffer(filter); } });
|
{
|
||||||
|
completer: function (filter) liberator.completion.buffer(filter)
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: this should open in a new tab positioned directly after the current one, not at the end
|
// TODO: this should open in a new tab positioned directly after the current one, not at the end
|
||||||
liberator.commands.add(["tab"],
|
liberator.commands.add(["tab"],
|
||||||
@@ -351,7 +357,7 @@ liberator.Tabs = function () //{{{
|
|||||||
liberator.forceNewTab = false;
|
liberator.forceNewTab = false;
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.ex(filter); }
|
completer: function (filter) liberator.completion.ex(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["tabl[ast]", "bl[ast]"],
|
liberator.commands.add(["tabl[ast]", "bl[ast]"],
|
||||||
@@ -456,7 +462,9 @@ liberator.Tabs = function () //{{{
|
|||||||
liberator.tabs.switchTo(args, special);
|
liberator.tabs.switchTo(args, special);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ completer: function (filter) { return liberator.completion.buffer(filter); } });
|
{
|
||||||
|
completer: function (filter) liberator.completion.buffer(filter)
|
||||||
|
});
|
||||||
|
|
||||||
liberator.commands.add(["buffers", "files", "ls", "tabs"],
|
liberator.commands.add(["buffers", "files", "ls", "tabs"],
|
||||||
"Show a list of all buffers",
|
"Show a list of all buffers",
|
||||||
@@ -521,7 +529,9 @@ liberator.Tabs = function () //{{{
|
|||||||
else
|
else
|
||||||
liberator.open("about:blank", where);
|
liberator.open("about:blank", where);
|
||||||
},
|
},
|
||||||
{ completer: function (filter) { return liberator.completion.url(filter); } });
|
{
|
||||||
|
completer: function (filter) liberator.completion.url(filter)
|
||||||
|
});
|
||||||
|
|
||||||
liberator.commands.add(["tabde[tach]"],
|
liberator.commands.add(["tabde[tach]"],
|
||||||
"Detach current tab to its own window",
|
"Detach current tab to its own window",
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
["S", "Suggest engines"]
|
["S", "Suggest engines"]
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
validator: function (value) { return !/[^sfbhSl]/.test(value); }
|
validator: function (value) !/[^sfbhSl]/.test(value)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.options.add(["suggestengines"],
|
liberator.options.add(["suggestengines"],
|
||||||
@@ -311,8 +311,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
{
|
{
|
||||||
var ss = Components.classes["@mozilla.org/browser/search-service;1"]
|
var ss = Components.classes["@mozilla.org/browser/search-service;1"]
|
||||||
.getService(Components.interfaces.nsIBrowserSearchService);
|
.getService(Components.interfaces.nsIBrowserSearchService);
|
||||||
return value.split(",").every(function (item)
|
return value.split(",").every(function (item) {
|
||||||
{
|
|
||||||
var e = ss.getEngineByAlias(item);
|
var e = ss.getEngineByAlias(item);
|
||||||
return (e && e.supportsResponseType("application/x-suggestions+json")) ? true : false;
|
return (e && e.supportsResponseType("application/x-suggestions+json")) ? true : false;
|
||||||
});
|
});
|
||||||
@@ -329,7 +328,9 @@ liberator.CommandLine = function () //{{{
|
|||||||
{
|
{
|
||||||
validator: function (value)
|
validator: function (value)
|
||||||
{
|
{
|
||||||
return value.split(",").every(function (item) { return /^(full|longest|list|list:full|list:longest|)$/.test(item); });
|
return value.split(",").every(
|
||||||
|
function (item) /^(full|longest|list|list:full|list:longest|)$/.test(item)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
completer: function (filter)
|
completer: function (filter)
|
||||||
{
|
{
|
||||||
@@ -376,7 +377,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
},
|
},
|
||||||
validator: function (value)
|
validator: function (value)
|
||||||
{
|
{
|
||||||
return value.split(",").every(function (item) { return /^(sort|auto|)$/.test(item); });
|
return value.split(",").every(function (item) /^(sort|auto|)$/.test(item));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -416,7 +417,9 @@ liberator.CommandLine = function () //{{{
|
|||||||
if (res != null)
|
if (res != null)
|
||||||
liberator.echo(res);
|
liberator.echo(res);
|
||||||
},
|
},
|
||||||
{ completer: function (filter) { return liberator.completion.javascript(filter); } });
|
{
|
||||||
|
completer: function (filter) liberator.completion.javascript(filter)
|
||||||
|
});
|
||||||
|
|
||||||
liberator.commands.add(["echoe[rr]"],
|
liberator.commands.add(["echoe[rr]"],
|
||||||
"Display an error string at the bottom of the window",
|
"Display an error string at the bottom of the window",
|
||||||
@@ -426,7 +429,9 @@ liberator.CommandLine = function () //{{{
|
|||||||
if (res != null)
|
if (res != null)
|
||||||
liberator.echoerr(res);
|
liberator.echoerr(res);
|
||||||
},
|
},
|
||||||
{ completer: function (filter) { return liberator.completion.javascript(filter); } });
|
{
|
||||||
|
completer: function (filter) liberator.completion.javascript(filter)
|
||||||
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
////////////////////// PUBLIC SECTION //////////////////////////////////////////
|
||||||
@@ -575,9 +580,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
multilineInputWidget.value = "";
|
multilineInputWidget.value = "";
|
||||||
autosizeMultilineInputWidget();
|
autosizeMultilineInputWidget();
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () multilineInputWidget.focus(), 10);
|
||||||
multilineInputWidget.focus();
|
|
||||||
}, 10);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onEvent: function (event)
|
onEvent: function (event)
|
||||||
@@ -827,7 +830,7 @@ liberator.CommandLine = function () //{{{
|
|||||||
else if (event.type == "blur")
|
else if (event.type == "blur")
|
||||||
{
|
{
|
||||||
if (liberator.modes.extended & liberator.modes.INPUT_MULTILINE)
|
if (liberator.modes.extended & liberator.modes.INPUT_MULTILINE)
|
||||||
setTimeout(function () { multilineInputWidget.inputField.focus(); }, 0);
|
setTimeout(function () multilineInputWidget.inputField.focus(), 0);
|
||||||
}
|
}
|
||||||
else if (event.type == "input")
|
else if (event.type == "input")
|
||||||
{
|
{
|
||||||
@@ -1188,7 +1191,7 @@ liberator.ItemList = function (id) //{{{
|
|||||||
|
|
||||||
var height = getHeight();
|
var height = getHeight();
|
||||||
if (height == 0) // sometimes we don't have the correct size at this point
|
if (height == 0) // sometimes we don't have the correct size at this point
|
||||||
setTimeout(function () { container.height = getHeight(); }, 10);
|
setTimeout(function () container.height = getHeight(), 10);
|
||||||
else
|
else
|
||||||
container.height = height;
|
container.height = height;
|
||||||
}
|
}
|
||||||
@@ -1399,7 +1402,7 @@ liberator.StatusLine = function () //{{{
|
|||||||
|
|
||||||
return value;
|
return value;
|
||||||
},
|
},
|
||||||
validator: function (value) { return (value >= 0 && value <= 2); },
|
validator: function (value) value >= 0 && value <= 2,
|
||||||
completer: function (filter)
|
completer: function (filter)
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ liberator.config = { //{{{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.url(filter); }
|
completer: function (filter) liberator.completion.url(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
liberator.commands.add(["redr[aw]"],
|
liberator.commands.add(["redr[aw]"],
|
||||||
@@ -359,7 +359,7 @@ liberator.config = { //{{{
|
|||||||
liberator.open("about:blank", liberator.NEW_WINDOW);
|
liberator.open("about:blank", liberator.NEW_WINDOW);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
completer: function (filter) { return liberator.completion.url(filter); }
|
completer: function (filter) liberator.completion.url(filter)
|
||||||
});
|
});
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////}}}
|
/////////////////////////////////////////////////////////////////////////////}}}
|
||||||
|
|||||||
Reference in New Issue
Block a user