diff --git a/content/bookmarks.js b/content/bookmarks.js index cc9e7563..6c9cb994 100644 --- a/content/bookmarks.js +++ b/content/bookmarks.js @@ -665,7 +665,7 @@ vimperator.Marks = function() //{{{ } else { - var pattern = new RegExp("[" + filter.replace(/\s+/g, '') + "]"); + var pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]"); for (var mark in url_marks) { if (pattern.test(mark)) @@ -800,7 +800,7 @@ vimperator.QuickMarks = function() //{{{ this.remove = function(filter) { - var pattern = new RegExp("[" + filter.replace(/\s+/g, '') + "]"); + var pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]"); for (var qmark in qmarks) { diff --git a/content/buffers.js b/content/buffers.js index a40e1c7c..7ebebb31 100644 --- a/content/buffers.js +++ b/content/buffers.js @@ -154,8 +154,8 @@ vimperator.Buffer = function() //{{{ var result = doc.evaluate(expression, elem, function lookupNamespaceURI(prefix) { switch (prefix) { - case 'xhtml': - return 'http://www.w3.org/1999/xhtml'; + case "xhtml": + return "http://www.w3.org/1999/xhtml"; default: return null; } diff --git a/content/commands.js b/content/commands.js index cde5fda5..5c736b9a 100644 --- a/content/commands.js +++ b/content/commands.js @@ -102,8 +102,8 @@ vimperator.Command.prototype.hasName = function(name) // true if the candidate matches unambiguously function matchAbbreviation(name, format) { - var minimum = format.indexOf('['); // minumum number of characters for a command name match - var fullname = format.replace(/\[(\w+)\]$/, '$1'); // full command name + var minimum = format.indexOf("["); // minumum number of characters for a command name match + var fullname = format.replace(/\[(\w+)\]$/, "$1"); // full command name if (fullname.indexOf(name) == 0 && name.length >= minimum) return true; else @@ -189,7 +189,7 @@ vimperator.Commands = function() //{{{ this.parseCommand = function(str, tag) { // remove comments - str.replace(/\s*".*$/, ''); + str.replace(/\s*".*$/, ""); if (tag) // we already have a multiline heredoc construct { @@ -220,7 +220,7 @@ vimperator.Commands = function() //{{{ matches[4] = tag[1]; } else - matches[3] = ''; + matches[3] = ""; return matches; } @@ -734,7 +734,7 @@ vimperator.Commands = function() //{{{ else { if (!reference[0]) { - if (reference[2] == 'g') + if (reference[2] == "g") reference[0] = vimperator.globalVariables; else return; // for now @@ -742,11 +742,11 @@ vimperator.Commands = function() //{{{ if (match[3]) { - if (match[3] == '+') + if (match[3] == "+") reference[0][reference[1]] += expr; - else if (match[3] == '-') + else if (match[3] == "-") reference[0][reference[1]] -= expr; - else if (match[3] == '.') + else if (match[3] == ".") reference[0][reference[1]] += expr.toString(); } else @@ -762,13 +762,13 @@ vimperator.Commands = function() //{{{ return vimperator.echoerr("E121: Undefined variable: " + match[1]); var value = reference[0][reference[1]]; - if (typeof value == 'number') - var prefix = '#'; - else if (typeof value == 'function') - var prefix = '*'; + if (typeof value == "number") + var prefix = "#"; + else if (typeof value == "function") + var prefix = "*"; else - var prefix = ''; - vimperator.echo(reference[1] + '\t\t' + prefix + value); + var prefix = ""; + vimperator.echo(reference[1] + "\t\t" + prefix + value); } }, { @@ -798,8 +798,8 @@ vimperator.Commands = function() //{{{ if (leader_reg.test(lhs)) { - var leader_ref = vimperator.variableReference('mapleader'); - var leader = leader_ref[0] ? leader_ref[0][leader_ref[1]] : '\\'; + var leader_ref = vimperator.variableReference("mapleader"); + var leader = leader_ref[0] ? leader_ref[0][leader_ref[1]] : "\\"; lhs = lhs.replace(leader_reg, leader); } @@ -877,7 +877,7 @@ vimperator.Commands = function() //{{{ return; } - var filter = args.replace(/[^a-zA-Z]/g, ''); + var filter = args.replace(/[^a-zA-Z]/g, ""); vimperator.marks.list(filter); }, { @@ -1142,7 +1142,7 @@ vimperator.Commands = function() //{{{ return; } - var filter = args.replace(/[^a-zA-Z0-9]/g, ''); + var filter = args.replace(/[^a-zA-Z0-9]/g, ""); vimperator.quickmarks.list(filter); }, { @@ -1449,7 +1449,7 @@ vimperator.Commands = function() //{{{ { if (menu.childNodes[i].label == args) { - eval(menu.childNodes[i].getAttribute('oncommand')); + eval(menu.childNodes[i].getAttribute("oncommand")); break; } } @@ -1765,7 +1765,7 @@ vimperator.Commands = function() //{{{ return vimperator.echoerr("E471: Argument required"); var names = args.split(/ /); - if (typeof names == 'string') names = [names]; + if (typeof names == "string") names = [names]; var length = names.length; for (var i = 0, name = names[i]; i < length; name = names[++i]) { diff --git a/content/completion.js b/content/completion.js index 9534900d..384ea1cd 100644 --- a/content/completion.js +++ b/content/completion.js @@ -171,7 +171,7 @@ vimperator.Completion = function() // {{{ get_longest_substring: function() //{{{ { if (g_substrings.length == 0) - return ''; + return ""; var longest = g_substrings[0]; for (var i = 1; i < g_substrings.length; i++) @@ -198,13 +198,13 @@ vimperator.Completion = function() // {{{ // join all completion arrays together for (var i = 0; i < cpt.length; i++) { - if (cpt[i] == 's') + if (cpt[i] == "s") completions = completions.concat(this.get_search_completions(filter)); - else if (cpt[i] == 'b') + else if (cpt[i] == "b") completions = completions.concat(this.get_bookmark_completions(filter)); - else if (cpt[i] == 'h') + else if (cpt[i] == "h") completions = completions.concat(this.get_history_completions(filter)); - else if (cpt[i] == 'f') + else if (cpt[i] == "f") completions = completions.concat(this.get_file_completions(filter, true)); } @@ -402,7 +402,7 @@ vimperator.Completion = function() // {{{ { try { - title = getBrowser().getBrowserAtIndex(i).contentDocument.getElementsByTagName('title')[0].text; + title = getBrowser().getBrowserAtIndex(i).contentDocument.getElementsByTagName("title")[0].text; } catch (e) { diff --git a/content/events.js b/content/events.js index be815d61..6e6fc0d4 100644 --- a/content/events.js +++ b/content/events.js @@ -598,7 +598,7 @@ vimperator.Events = function() //{{{ } var count_str = vimperator.input.buffer.match(/^[0-9]*/)[0]; - var candidate_command = (vimperator.input.buffer + key).replace(count_str, ''); + var candidate_command = (vimperator.input.buffer + key).replace(count_str, ""); var map; // counts must be at the start of a complete mapping (10j -> go 10 lines down) diff --git a/content/find.js b/content/find.js index 712d8e91..4cebdf33 100644 --- a/content/find.js +++ b/content/find.js @@ -99,7 +99,7 @@ vimperator.Search = function() //{{{ pattern = pattern.replace(/(\\)?\\[cC]/g, function($0, $1) { return $1 ? $0 : ""; }); // remove any modifer escape \ - pattern = pattern.replace(/\\(\\[cCuU])/g, '$1'); + pattern = pattern.replace(/\\(\\[cCuU])/g, "$1"); search_string = pattern; } @@ -247,7 +247,7 @@ vimperator.Search = function() //{{{ { for (var i = 0; i < win.frames.length; i++) arguments.callee(win.frames[i]); - var spans = vimperator.buffer.evaluateXPath('//span[@id="__firefox-findbar-search-id"]', win.document); + var spans = vimperator.buffer.evaluateXPath("//span[@id='__firefox-findbar-search-id']", win.document); for (var i = 0; i < spans.snapshotLength; i++) spans.snapshotItem(i).setAttribute("style", vimperator.options["hlsearchstyle"]); })(window.content); diff --git a/content/help.js b/content/help.js index c10fdf78..30650b02 100644 --- a/content/help.js +++ b/content/help.js @@ -104,7 +104,7 @@ vimperator.help = function(section, easter) //{{{ // add more space between entries ret += separator; } - ret = ret.replace(new RegExp(separator + '$'), ''); // FIXME: far too tasty! + ret = ret.replace(new RegExp(separator + "$"), ""); // FIXME: far too tasty! return ret; } @@ -121,7 +121,7 @@ vimperator.help = function(section, easter) //{{{ } else { - if (typeof command.default_value == 'string' && command.default_value.length == 0) + if (typeof command.default_value == "string" && command.default_value.length == 0) ret += "''"; else ret += command.default_value; @@ -181,14 +181,14 @@ vimperator.help = function(section, easter) //{{{ '
You found it, Arthur!
commandsWhat is the meaning of life, the universe and everything?
' +
'Douglas Adams, the only person who knew what this question really was about is
' +
'now dead, unfortunately. So now you might wonder what the meaning of death
' +
@@ -268,9 +268,9 @@ vimperator.help = function(section, easter) //{{{
if (!element)
{
var firstChar = section.charAt(0);
- if (firstChar != ':' && firstChar != "'")
+ if (firstChar != ":" && firstChar != "'")
{
- element = findSectionElement(':' + section);
+ element = findSectionElement(":" + section);
if (!element)
element = findSectionElement("'" + section + "'");
}
diff --git a/content/hints.js b/content/hints.js
index 93f2d9f7..d6dc04c3 100644
--- a/content/hints.js
+++ b/content/hints.js
@@ -24,7 +24,7 @@
vimperator.Hints = function() //{{{
{
- const HINT_PREFIX = 'hah_hint_'; // prefix for the hint id
+ const HINT_PREFIX = "hah_hint_"; // prefix for the hint id
this.hintedElements = function() { return hintedElems; };
this.currentState = function() { return state;};
@@ -145,15 +145,15 @@ vimperator.Hints = function() //{{{
var elem, i;
- hintElemSpan = doc.createElement('SPAN');
+ hintElemSpan = doc.createElement("SPAN");
hintElemSpan.style.cssText = vimperator.options["hintstyle"];
- hintElemSpan.setAttribute('name', 'hah_hint');
+ hintElemSpan.setAttribute("name", "hah_hint");
- var hintContainer = doc.getElementById('hah_hints');
+ var hintContainer = doc.getElementById("hah_hints");
if (hintContainer == null)
{
genHintContainer(doc);
- hintContainer = doc.getElementById('hah_hints');
+ hintContainer = doc.getElementById("hah_hints");
if (!hintContainer)
return false;
}
@@ -192,7 +192,7 @@ vimperator.Hints = function() //{{{
hintContainer.appendChild(hintElem);
}
- hintElem.style.display = 'none';
+ hintElem.style.display = "none";
hintElem.style.top = elem.absoTop + "px";
hintElem.style.left = elem.absoLeft + "px";
hintElem.refElem = elem;
@@ -223,7 +223,7 @@ vimperator.Hints = function() //{{{
// FIXME: this.disableHahMode(win);
vimperator.setMode(vimperator.modes.NORMAL);
isHahModeEnabled = false;
- linkNumString = '';
+ linkNumString = "";
hintedElems = [];
return;
@@ -231,7 +231,7 @@ vimperator.Hints = function() //{{{
var doc = win.document;
var hintElem = null;
- var hintContainer = doc.getElementById('hah_hints');
+ var hintContainer = doc.getElementById("hah_hints");
var hints = hintContainer.childNodes;
var i, j;
@@ -239,8 +239,8 @@ vimperator.Hints = function() //{{{
{
hintText = formatHint(offset+i);
hintElem = hints[i];
- hintElem.style.display = 'inline';
- //hintElem.style.position = 'absolute';
+ hintElem.style.display = "inline";
+ //hintElem.style.position = "absolute";
hintElem.innerHTML = hintText;
hintElem.id = HINT_PREFIX + hintText;
}
@@ -267,7 +267,7 @@ vimperator.Hints = function() //{{{
{
elem = res.snapshotItem(i);
setHintStyle(elem, vimperator.options["hintstyle"]);
- elem.style.display = 'none';
+ elem.style.display = "none";
}
for (i = 0; i < win.frames.length; i++)
@@ -337,7 +337,7 @@ vimperator.Hints = function() //{{{
var str = hintNum.toString(hintCharacters.length); // turn hintNum into a base(length) number
// map the number onto the chars in the numbers string
- var result = '';
+ var result = "";
// make all links the same length
var hintLength = 1;
var tmp = linkCount;
@@ -405,7 +405,7 @@ vimperator.Hints = function() //{{{
vimperator.setMode(vimperator.modes.HINTS, mode);
state = 0;
linkCount = 0;
- linkNumString = '';
+ linkNumString = "";
isHahModeEnabled = true;
createHints();
@@ -431,7 +431,7 @@ vimperator.Hints = function() //{{{
vimperator.setMode(vimperator.modes.NORMAL);
isHahModeEnabled = false;
- linkNumString = '';
+ linkNumString = "";
hintedElems = [];
removeHints(win);
@@ -440,7 +440,7 @@ vimperator.Hints = function() //{{{
this.resetHintedElements = function()
{
- linkNumString = '';
+ linkNumString = "";
state = 0;
while (hintedElems.length > 0)
@@ -486,11 +486,11 @@ vimperator.Hints = function() //{{{
var elemTagName = elem.localName.toLowerCase();
elem.focus();
- if (elemTagName == 'frame' || elemTagName == 'iframe')
+ if (elemTagName == "frame" || elemTagName == "iframe")
return 0;
// for imagemap
- if (elemTagName == 'area')
+ if (elemTagName == "area")
{
var coords = elem.getAttribute("coords").split(",");
x = Number(coords[0]);
@@ -499,12 +499,12 @@ vimperator.Hints = function() //{{{
var doc = window.content.document;
var view = window.document.defaultView;
- var evt = doc.createEvent('MouseEvents');
- evt.initMouseEvent('mousedown', true, true, view, 1, x + 1, y + 1, 0, 0, /*ctrl*/ new_tab, /*event.altKey*/0, /*event.shiftKey*/ new_window, /*event.metaKey*/ new_tab, 0, null);
+ var evt = doc.createEvent("MouseEvents");
+ evt.initMouseEvent("mousedown", true, true, view, 1, x + 1, y + 1, 0, 0, /*ctrl*/ new_tab, /*event.altKey*/0, /*event.shiftKey*/ new_window, /*event.metaKey*/ new_tab, 0, null);
elem.dispatchEvent(evt);
- var evt = doc.createEvent('MouseEvents');
- evt.initMouseEvent('click', true, true, view, 1, x + 1, y + 1, 0, 0, /*ctrl*/ new_tab, /*event.altKey*/0, /*event.shiftKey*/ new_window, /*event.metaKey*/ new_tab, 0, null);
+ var evt = doc.createEvent("MouseEvents");
+ evt.initMouseEvent("click", true, true, view, 1, x + 1, y + 1, 0, 0, /*ctrl*/ new_tab, /*event.altKey*/0, /*event.shiftKey*/ new_window, /*event.metaKey*/ new_tab, 0, null);
elem.dispatchEvent(evt);
// for 'pure' open calls without a new tab or window it doesn't
@@ -525,7 +525,7 @@ vimperator.Hints = function() //{{{
for (var i = 0; i < elems.length; i++)
{
tmp = elems[i].refElem.href;
- if (typeof(tmp) != 'undefined' && tmp.length > 0)
+ if (typeof(tmp) != "undefined" && tmp.length > 0)
{
if (i > 0)
loc += "\n";
@@ -548,7 +548,7 @@ vimperator.Hints = function() //{{{
for (var i = 0; i < elems.length; i++)
{
tmp = elems[i].refElem.textContent;
- if (typeof(tmp) != 'undefined' && tmp.length > 0)
+ if (typeof(tmp) != "undefined" && tmp.length > 0)
{
if (i > 0)
loc += "\n";
@@ -590,7 +590,7 @@ vimperator.Hints = function() //{{{
var doc = window.document;
var elemTagName = elem.localName.toLowerCase();
- if (elemTagName == 'frame' || elemTagName == 'iframe')
+ if (elemTagName == "frame" || elemTagName == "iframe")
{
elem.contentWindow.focus();
return;
@@ -600,18 +600,18 @@ vimperator.Hints = function() //{{{
// elem.focus();
//}
- var evt = doc.createEvent('MouseEvents');
+ var evt = doc.createEvent("MouseEvents");
var x = 0;
var y = 0;
// for imagemap
- if (elemTagName == 'area')
+ if (elemTagName == "area")
{
var coords = elem.getAttribute("coords").split(",");
x = Number(coords[0]);
y = Number(coords[1]);
}
- evt.initMouseEvent('mouseover', true, true, doc.defaultView, 1, x, y, 0, 0, 0, 0, 0, 0, 0, null);
+ evt.initMouseEvent("mouseover", true, true, doc.defaultView, 1, x, y, 0, 0, 0, 0, 0, 0, 0, null);
elem.dispatchEvent(evt);
}
@@ -635,7 +635,7 @@ vimperator.Hints = function() //{{{
if (num != null && hintCharacters.toUpperCase().indexOf(num) > -1)
{
var oldLinkNumString = linkNumString;
- linkNumString += '' + num;
+ linkNumString += "" + num;
// update reference to currently selected node;
var elem = getHintById(linkNumString);
changeHintFocus(linkNumString, oldLinkNumString);
@@ -644,7 +644,7 @@ vimperator.Hints = function() //{{{
if (elem)
{
hintedElems.push(elem);
- linkNumString = '';
+ linkNumString = "";
state = 1;
return hintedElems.length;
}
@@ -666,10 +666,10 @@ vimperator.Hints = function() //{{{
function genHintContainer(doc)
{
- if (doc.getElementsByTagName('HINTS').length > 0)
+ if (doc.getElementsByTagName("HINTS").length > 0)
return;
- hints = doc.createElement('HINTS');
+ hints = doc.createElement("HINTS");
hints.id = "hah_hints";
hints.valid_hint_count = 0; // initially 0 elements are usable as hints
@@ -703,7 +703,7 @@ vimperator.Hints = function() //{{{
{
state = 0;
linkCount = 0;
- linkNumString = '';
+ linkNumString = "";
isHahModeEnabled = true;
setTimeout( function() {
diff --git a/content/io.js b/content/io.js
index 54d58e27..9161155e 100644
--- a/content/io.js
+++ b/content/io.js
@@ -49,7 +49,7 @@ vimperator.IO = function()
// TODO: proper pathname separator translation like Vim
if (WINDOWS)
- path = path.replace('/', '\\', 'g');
+ path = path.replace("/", "\\", "g");
// expand "~" to VIMPERATOR_HOME or HOME (USERPROFILE or HOMEDRIVE\HOMEPATH on Windows if HOME is not set)
if (/^~/.test(path))
diff --git a/content/mappings.js b/content/mappings.js
index b0d0ec9e..1a50321d 100644
--- a/content/mappings.js
+++ b/content/mappings.js
@@ -499,7 +499,7 @@ vimperator.Mappings = function() //{{{
flags: vimperator.Mappings.flags.COUNT
}
));
- addDefaultMap(new vimperator.Map(vimperator.modes.NORMAL, ['