mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-22 21:07:59 +01:00
declare some loop counters in followDocumentRelation and whitespace fixes
This commit is contained in:
@@ -48,7 +48,7 @@ vimperator.Bookmarks = function () //{{{
|
|||||||
var keywords = null;
|
var keywords = null;
|
||||||
|
|
||||||
if (vimperator.options["preload"])
|
if (vimperator.options["preload"])
|
||||||
setTimeout(function () { load(); } , 100);
|
setTimeout(function () { load(); }, 100);
|
||||||
|
|
||||||
function load()
|
function load()
|
||||||
{
|
{
|
||||||
@@ -344,7 +344,7 @@ vimperator.History = function () //{{{
|
|||||||
var history = null;
|
var history = null;
|
||||||
|
|
||||||
if (vimperator.options["preload"])
|
if (vimperator.options["preload"])
|
||||||
setTimeout(function () { load(); } , 100);
|
setTimeout(function () { load(); }, 100);
|
||||||
|
|
||||||
function load()
|
function load()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -177,8 +177,10 @@ vimperator.Buffer = function () //{{{
|
|||||||
elem = doc;
|
elem = doc;
|
||||||
|
|
||||||
var result = doc.evaluate(expression, elem,
|
var result = doc.evaluate(expression, elem,
|
||||||
function lookupNamespaceURI(prefix) {
|
function lookupNamespaceURI(prefix)
|
||||||
switch (prefix) {
|
{
|
||||||
|
switch (prefix)
|
||||||
|
{
|
||||||
case "xhtml":
|
case "xhtml":
|
||||||
return "http://www.w3.org/1999/xhtml";
|
return "http://www.w3.org/1999/xhtml";
|
||||||
default:
|
default:
|
||||||
@@ -725,8 +727,8 @@ vimperator.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) { return a.toLowerCase() > b.toLowerCase() ? 1 : -1; });
|
||||||
for (var i=0; i < tmpSort.length; i++)
|
for (var i = 0; i < tmpSort.length; i++)
|
||||||
pageMeta.push([tmpDict[tmpSort[i]][0], vimperator.util.highlightURL(tmpDict[tmpSort[i]][1], false)]);
|
pageMeta.push([tmpDict[tmpSort[i]][0], vimperator.util.highlightURL(tmpDict[tmpSort[i]][1], false)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -791,15 +793,15 @@ vimperator.Buffer = function () //{{{
|
|||||||
}
|
}
|
||||||
|
|
||||||
relText = new RegExp(relText, "i");
|
relText = new RegExp(relText, "i");
|
||||||
var elems = window.content.document.getElementsByTagName('a');
|
var elems = window.content.document.getElementsByTagName("a");
|
||||||
for (pattern = 0; pattern < regexps.length; pattern++)
|
for (var pattern = 0; pattern < regexps.length; pattern++)
|
||||||
{
|
{
|
||||||
patternText = new RegExp(regexps[pattern], "i");
|
patternText = new RegExp(regexps[pattern], "i");
|
||||||
for (i = 0; i < elems.length; i++)
|
for (var i = 0; i < elems.length; i++)
|
||||||
{
|
{
|
||||||
if (patternText.test(elems[i].text) || relText.test(elems[i].rel) )
|
if (patternText.test(elems[i].text) || relText.test(elems[i].rel) )
|
||||||
{
|
{
|
||||||
vimperator.buffer.followLink(elems[i],vimperator.CURRENT_TAB);
|
vimperator.buffer.followLink(elems[i], vimperator.CURRENT_TAB);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -620,7 +620,7 @@ vimperator.Commands = function () //{{{
|
|||||||
" -keyword=keyword<br/>",
|
" -keyword=keyword<br/>",
|
||||||
args: [[["-title", "-t"], OPTION_STRING],
|
args: [[["-title", "-t"], OPTION_STRING],
|
||||||
[["-tags", "-T"], OPTION_LIST],
|
[["-tags", "-T"], OPTION_LIST],
|
||||||
[["-keyword", "-k"], OPTION_STRING, function (arg) { return /\w/.test(arg); } ]]
|
[["-keyword", "-k"], OPTION_STRING, function (arg) { return /\w/.test(arg); }]]
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
addDefaultCommand(new vimperator.Command(["bmarks"],
|
addDefaultCommand(new vimperator.Command(["bmarks"],
|
||||||
@@ -709,7 +709,7 @@ vimperator.Commands = function () //{{{
|
|||||||
usage: ["com[mand][!] [{attr}...] {cmd} {rep}"],
|
usage: ["com[mand][!] [{attr}...] {cmd} {rep}"],
|
||||||
short_help: "Temporarily used for testing args parser",
|
short_help: "Temporarily used for testing args parser",
|
||||||
help: "",
|
help: "",
|
||||||
args: [[["-nargs"], OPTION_STRING, function (arg) { return /^(0|1|\*|\?|\+)$/.test(arg); } ],
|
args: [[["-nargs"], OPTION_STRING, function (arg) { return /^(0|1|\*|\?|\+)$/.test(arg); }],
|
||||||
[["-bang"], OPTION_NOARG],
|
[["-bang"], OPTION_NOARG],
|
||||||
[["-bar"], OPTION_NOARG]]
|
[["-bar"], OPTION_NOARG]]
|
||||||
}
|
}
|
||||||
@@ -975,7 +975,8 @@ vimperator.Commands = function () //{{{
|
|||||||
if (matches && matches[2])
|
if (matches && matches[2])
|
||||||
{
|
{
|
||||||
vimperator.commandline.inputMultiline(new RegExp("^" + matches[2] + "$", "m"),
|
vimperator.commandline.inputMultiline(new RegExp("^" + matches[2] + "$", "m"),
|
||||||
function (code) {
|
function (code)
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
eval(matches[1] + "\n" + code);
|
eval(matches[1] + "\n" + code);
|
||||||
@@ -1045,14 +1046,21 @@ vimperator.Commands = function () //{{{
|
|||||||
{
|
{
|
||||||
var reference = vimperator.variableReference(matches[2]);
|
var reference = vimperator.variableReference(matches[2]);
|
||||||
if (!reference[0] && matches[3])
|
if (!reference[0] && matches[3])
|
||||||
return vimperator.echoerr("E121: Undefined variable: " + matches[2]);
|
{
|
||||||
|
vimperator.echoerr("E121: Undefined variable: " + matches[2]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var expr = vimperator.eval(matches[4]);
|
var expr = vimperator.eval(matches[4]);
|
||||||
if (typeof expr === undefined)
|
if (typeof expr === undefined)
|
||||||
return vimperator.echoerr("E15: Invalid expression: " + matches[4]);
|
{
|
||||||
|
vimperator.echoerr("E15: Invalid expression: " + matches[4]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!reference[0]) {
|
if (!reference[0])
|
||||||
|
{
|
||||||
if (reference[2] == "g")
|
if (reference[2] == "g")
|
||||||
reference[0] = vimperator.globalVariables;
|
reference[0] = vimperator.globalVariables;
|
||||||
else
|
else
|
||||||
@@ -1078,7 +1086,10 @@ vimperator.Commands = function () //{{{
|
|||||||
{
|
{
|
||||||
var reference = vimperator.variableReference(matches[1]);
|
var reference = vimperator.variableReference(matches[1]);
|
||||||
if (!reference[0])
|
if (!reference[0])
|
||||||
return vimperator.echoerr("E121: Undefined variable: " + matches[1]);
|
{
|
||||||
|
vimperator.echoerr("E121: Undefined variable: " + matches[1]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var value = reference[0][reference[1]];
|
var value = reference[0][reference[1]];
|
||||||
if (typeof value == "number")
|
if (typeof value == "number")
|
||||||
@@ -2164,7 +2175,10 @@ vimperator.Commands = function () //{{{
|
|||||||
function (args, special)
|
function (args, special)
|
||||||
{
|
{
|
||||||
if (!args)
|
if (!args)
|
||||||
return vimperator.echoerr("E471: Argument required");
|
{
|
||||||
|
vimperator.echoerr("E471: Argument required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var names = args.split(/ /);
|
var names = args.split(/ /);
|
||||||
if (typeof names == "string") names = [names];
|
if (typeof names == "string") names = [names];
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ vimperator.Editor = function () //{{{
|
|||||||
{
|
{
|
||||||
var rangeStart = elt.selectionStart; // caret position
|
var rangeStart = elt.selectionStart; // caret position
|
||||||
var rangeEnd = elt.selectionEnd;
|
var rangeEnd = elt.selectionEnd;
|
||||||
var tempStr1 = elt.value.substring(0,rangeStart);
|
var tempStr1 = elt.value.substring(0, rangeStart);
|
||||||
var tempStr2 = readFromClipboard();
|
var tempStr2 = readFromClipboard();
|
||||||
var tempStr3 = elt.value.substring(rangeEnd);
|
var tempStr3 = elt.value.substring(rangeEnd);
|
||||||
elt.value = tempStr1 + tempStr2 + tempStr3;
|
elt.value = tempStr1 + tempStr2 + tempStr3;
|
||||||
@@ -383,11 +383,11 @@ vimperator.Editor = function () //{{{
|
|||||||
// blink the textbox after returning
|
// blink the textbox after returning
|
||||||
var timeout = 100;
|
var timeout = 100;
|
||||||
textBox.style.backgroundColor = tmpBg;
|
textBox.style.backgroundColor = tmpBg;
|
||||||
setTimeout( function () {
|
setTimeout(function () {
|
||||||
textBox.style.backgroundColor = oldBg;
|
textBox.style.backgroundColor = oldBg;
|
||||||
setTimeout( function () {
|
setTimeout(function () {
|
||||||
textBox.style.backgroundColor = tmpBg;
|
textBox.style.backgroundColor = tmpBg;
|
||||||
setTimeout( function () {
|
setTimeout(function () {
|
||||||
textBox.style.backgroundColor = oldBg;
|
textBox.style.backgroundColor = oldBg;
|
||||||
}, timeout);
|
}, timeout);
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ vimperator.help = function (section, easter) //{{{
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
vimperator.open("about:blank");
|
vimperator.open("about:blank");
|
||||||
setTimeout(function () { vimperator.help(section, false, null, {recursive: true}); }, 250);
|
setTimeout(function () { vimperator.help(section, false, null, { recursive: true }); }, 250);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
doc.write(fulldoc);
|
doc.write(fulldoc);
|
||||||
|
|||||||
@@ -418,7 +418,7 @@ vimperator.Hints = function () //{{{
|
|||||||
var first_href = valid_hints[0].getAttribute("href") || null;
|
var first_href = valid_hints[0].getAttribute("href") || null;
|
||||||
if (first_href)
|
if (first_href)
|
||||||
{
|
{
|
||||||
if (valid_hints.some( function (e) { return e.getAttribute("href") != first_href; } ))
|
if (valid_hints.some(function (e) { return e.getAttribute("href") != first_href; }))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (valid_hints.length > 1)
|
else if (valid_hints.length > 1)
|
||||||
@@ -458,7 +458,7 @@ vimperator.Hints = function () //{{{
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setTimeout( function () {
|
setTimeout(function () {
|
||||||
if (vimperator.mode == vimperator.modes.HINTS)
|
if (vimperator.mode == vimperator.modes.HINTS)
|
||||||
vimperator.modes.reset(false);
|
vimperator.modes.reset(false);
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ vimperator.Mappings = function () //{{{
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["]n"],
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["]n"],
|
||||||
function (count) {vimperator.buffer.followDocumentRelation("next");},
|
function (count) { vimperator.buffer.followDocumentRelation("next"); },
|
||||||
{
|
{
|
||||||
short_help: "go to 'next' or '>' if it exists. Beep otherwise.",
|
short_help: "go to 'next' or '>' if it exists. Beep otherwise.",
|
||||||
help: "Opens link labeled with next or >. Useful when browsing forums or documentation. Change nextpattern to modify its behaviour. It follows relations between files too.",
|
help: "Opens link labeled with next or >. Useful when browsing forums or documentation. Change nextpattern to modify its behaviour. It follows relations between files too.",
|
||||||
@@ -423,7 +423,7 @@ vimperator.Mappings = function () //{{{
|
|||||||
}
|
}
|
||||||
));
|
));
|
||||||
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["]p"],
|
addDefaultMap(new vimperator.Map([vimperator.modes.NORMAL], ["]p"],
|
||||||
function (count) {vimperator.buffer.followDocumentRelation("previous");},
|
function (count) { vimperator.buffer.followDocumentRelation("previous"); },
|
||||||
{
|
{
|
||||||
short_help: "go to 'prev', 'previous' or '<' if it exists. Beep otherwise.",
|
short_help: "go to 'prev', 'previous' or '<' if it exists. Beep otherwise.",
|
||||||
help: "Opens link labeled with prev, previous or <. Useful when browsing forums or documentation. Change nextpattern to modify its behaviour. It follows relations between files too.",
|
help: "Opens link labeled with prev, previous or <. Useful when browsing forums or documentation. Change nextpattern to modify its behaviour. It follows relations between files too.",
|
||||||
|
|||||||
@@ -464,7 +464,6 @@ vimperator.Options = function () //{{{
|
|||||||
short_help: "Set the default search engine",
|
short_help: "Set the default search engine",
|
||||||
help: "The default search engine is used in the <code class=\"command\">:[tab]open [arg]</code> command " +
|
help: "The default search engine is used in the <code class=\"command\">:[tab]open [arg]</code> command " +
|
||||||
"if [arg] neither looks like a URL or like a specified search engine/keyword.",
|
"if [arg] neither looks like a URL or like a specified search engine/keyword.",
|
||||||
completer: function () { return [["foo", "bar"], ["shit", "blub"]]; },
|
|
||||||
default_value: "google"
|
default_value: "google"
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -709,9 +709,8 @@ const vimperator = (function () //{{{
|
|||||||
var mainThread = threadManager.mainThread;
|
var mainThread = threadManager.mainThread;
|
||||||
|
|
||||||
var then = new Date().getTime(), now = then;
|
var then = new Date().getTime(), now = then;
|
||||||
for (; now - then < ms; now = new Date().getTime()) {
|
for (; now - then < ms; now = new Date().getTime())
|
||||||
mainThread.processNextEvent(true);
|
mainThread.processNextEvent(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
get windows()
|
get windows()
|
||||||
|
|||||||
Reference in New Issue
Block a user