1
0
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:
Doug Kearns
2007-11-16 15:00:11 +00:00
parent ca7b146774
commit 51332e41a9
9 changed files with 44 additions and 30 deletions

View File

@@ -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:
@@ -791,11 +793,11 @@ 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) )
{ {

View File

@@ -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];

View File

@@ -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"
} }
)); ));

View File

@@ -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()