1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-22 16:47:59 +01:00

use camel case for all indentifiers

This commit is contained in:
Doug Kearns
2007-11-19 03:52:36 +00:00
parent 332c30ed97
commit fa1229294c
17 changed files with 1154 additions and 1151 deletions

View File

@@ -33,15 +33,15 @@ vimperator.Bookmarks = function () //{{{
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
const history_service = Components.classes["@mozilla.org/browser/nav-history-service;1"]
const historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
.getService(Components.interfaces.nsINavHistoryService);
const bookmarks_service = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]
const bookmarksService = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]
.getService(Components.interfaces.nsINavBookmarksService);
const tagging_service = Components.classes["@mozilla.org/browser/tagging-service;1"]
const taggingService = Components.classes["@mozilla.org/browser/tagging-service;1"]
.getService(Components.interfaces.nsITaggingService);
const search_service = Components.classes["@mozilla.org/browser/search-service;1"]
const searchService = Components.classes["@mozilla.org/browser/search-service;1"]
.getService(Components.interfaces.nsIBrowserSearchService);
const io_service = Components.classes["@mozilla.org/network/io-service;1"]
const ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var bookmarks = null;
@@ -55,18 +55,18 @@ vimperator.Bookmarks = function () //{{{
// update our bookmark cache
bookmarks = []; // also clear our bookmark cache
keywords = [];
var root = bookmarks_service.bookmarksRoot;
var root = bookmarksService.bookmarksRoot;
var folders = [root];
var query = history_service.getNewQuery();
var options = history_service.getNewQueryOptions();
var query = historyService.getNewQuery();
var options = historyService.getNewQueryOptions();
// query.searchTerms = "test";
while (folders.length > 0)
{
//comment out the next line for now; the bug hasn't been fixed; final version should include the next line
//options.setGroupingMode(options.GROUP_BY_FOLDER);
query.setFolders(folders, 1);
var result = history_service.executeQuery(query, options);
var result = historyService.executeQuery(query, options);
//result.sortingMode = options.SORT_BY_DATE_DESCENDING;
result.sortingMode = options.SORT_BY_VISITCOUNT_DESCENDING;
var rootNode = result.root;
@@ -81,11 +81,11 @@ vimperator.Bookmarks = function () //{{{
folders.push(node.itemId);
else if (node.type == node.RESULT_TYPE_URI) // bookmark
{
var kw = bookmarks_service.getKeywordForBookmark(node.itemId);
var kw = bookmarksService.getKeywordForBookmark(node.itemId);
if (kw)
keywords.push([kw, node.title, node.uri]);
var tags = tagging_service.getTagsForURI(io_service.newURI(node.uri, null, null));
var tags = taggingService.getTagsForURI(ioService.newURI(node.uri, null, null));
bookmarks.push([node.uri, node.title, kw, tags]);
}
}
@@ -101,12 +101,12 @@ vimperator.Bookmarks = function () //{{{
return {
// if "bypass_cache" is true, it will force a reload of the bookmarks database
// if "bypassCache" is true, it will force a reload of the bookmarks database
// on my PC, it takes about 1ms for each bookmark to load, so loading 1000 bookmarks
// takes about 1 sec
get: function (filter, tags, bypass_cache)
get: function (filter, tags, bypassCache)
{
if (!bookmarks || bypass_cache)
if (!bookmarks || bypassCache)
load();
return vimperator.completion.filterURLArray(bookmarks, filter, tags);
@@ -123,19 +123,19 @@ vimperator.Bookmarks = function () //{{{
try
{
var uri = io_service.newURI(url, null, null);
var id = bookmarks_service.insertBookmark(bookmarks_service.bookmarksRoot, uri, -1, title);
var uri = ioService.newURI(url, null, null);
var id = bookmarksService.insertBookmark(bookmarksService.bookmarksRoot, uri, -1, title);
if (!id)
return false;
if (keyword)
{
bookmarks_service.setKeywordForBookmark(id, keyword);
bookmarksService.setKeywordForBookmark(id, keyword);
keywords.unshift([keyword, title, url]);
}
if (tags)
tagging_service.tagURI(uri, tags);
taggingService.tagURI(uri, tags);
}
catch (e)
{
@@ -178,12 +178,12 @@ vimperator.Bookmarks = function () //{{{
var i = 0;
try
{
var uri = io_service.newURI(url, null, null);
var uri = ioService.newURI(url, null, null);
var count = {};
var bmarks = bookmarks_service.getBookmarkIdsForURI(uri, count);
var bmarks = bookmarksService.getBookmarkIdsForURI(uri, count);
for (; i < bmarks.length; i++)
bookmarks_service.removeItem(bmarks[i]);
bookmarksService.removeItem(bmarks[i]);
}
catch (e)
{
@@ -203,33 +203,33 @@ vimperator.Bookmarks = function () //{{{
// also ensures that each search engine has a Vimperator-friendly alias
getSearchEngines: function ()
{
var search_engines = [];
var firefox_engines = search_service.getVisibleEngines({ });
for (var i in firefox_engines)
var searchEngines = [];
var firefoxEngines = searchService.getVisibleEngines({ });
for (var i in firefoxEngines)
{
var alias = firefox_engines[i].alias;
var alias = firefoxEngines[i].alias;
if (!alias || !/^[a-z0-9_-]+$/.test(alias))
alias = firefox_engines[i].name.replace(/^\W*([a-zA-Z_-]+).*/, "$1").toLowerCase();
alias = firefoxEngines[i].name.replace(/^\W*([a-zA-Z_-]+).*/, "$1").toLowerCase();
if (!alias)
alias = "search"; // for search engines which we can't find a suitable alias
// make sure we can use search engines which would have the same alias (add numbers at the end)
var newalias = alias;
var newAlias = alias;
for (var j = 1; j <= 10; j++) // <=10 is intentional
{
if (!search_engines.some(function (item) { return (item[0] == newalias); }))
if (!searchEngines.some(function (item) { return (item[0] == newAlias); }))
break;
newalias = alias + j;
newAlias = alias + j;
}
// only write when it changed, writes are really slow
if (firefox_engines[i].alias != newalias)
firefox_engines[i].alias = newalias;
if (firefoxEngines[i].alias != newAlias)
firefoxEngines[i].alias = newAlias;
search_engines.push([firefox_engines[i].alias, firefox_engines[i].description]);
searchEngines.push([firefoxEngines[i].alias, firefoxEngines[i].description]);
}
return search_engines;
return searchEngines;
},
// TODO: add filtering
@@ -243,29 +243,29 @@ vimperator.Bookmarks = function () //{{{
return keywords;
},
// if @param engine_name is null, it uses the default search engine
// if @param engineName is null, it uses the default search engine
// @returns the url for the search string
// if the search also requires a postdata, [url, postdata] is returned
getSearchURL: function (text, engine_name)
// if the search also requires a postData, [url, postData] is returned
getSearchURL: function (text, engineName)
{
var url = null;
var postdata = null;
if (!engine_name)
engine_name = vimperator.options["defsearch"];
var postData = null;
if (!engineName)
engineName = vimperator.options["defsearch"];
// we need to make sure our custom alias have been set, even if the user
// did not :open <tab> once before
this.getSearchEngines();
// first checks the search engines for a match
var engine = search_service.getEngineByAlias(engine_name);
var engine = searchService.getEngineByAlias(engineName);
if (engine)
{
if (text)
{
var submission = engine.getSubmission(text, null);
url = submission.uri.spec;
postdata = submission.postData;
postData = submission.postData;
}
else
url = engine.searchForm;
@@ -277,7 +277,7 @@ vimperator.Bookmarks = function () //{{{
for (var i in keywords)
{
if (keywords[i][0] == engine_name)
if (keywords[i][0] == engineName)
{
if (text == null)
text = "";
@@ -287,9 +287,9 @@ vimperator.Bookmarks = function () //{{{
}
}
// if we came here, the engine_name is neither a search engine or URL
if (postdata)
return [url, postdata];
// if we came here, the engineName is neither a search engine or URL
if (postData)
return [url, postData];
else
return url; // can be null
},
@@ -359,7 +359,7 @@ vimperator.History = function () //{{{
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
const history_service = Components.classes["@mozilla.org/browser/nav-history-service;1"]
const historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
.getService(Components.interfaces.nsINavHistoryService);
var history = null;
@@ -373,11 +373,11 @@ vimperator.History = function () //{{{
// no query parameters will get all history
// XXX default sorting is... ?
var options = history_service.getNewQueryOptions();
var query = history_service.getNewQuery();
var options = historyService.getNewQueryOptions();
var query = historyService.getNewQuery();
// execute the query
var result = history_service.executeQuery(query, options);
var result = historyService.executeQuery(query, options);
var rootNode = result.root;
rootNode.containerOpen = true;
// iterate over the immediate children of this folder
@@ -513,24 +513,24 @@ vimperator.Marks = function () //{{{
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
var local_marks = {};
var url_marks = {};
var pending_jumps = [];
var appcontent = document.getElementById("appcontent");
var localMarks = {};
var urlMarks = {};
var pendingJumps = [];
var appContent = document.getElementById("appcontent");
if (appcontent)
appcontent.addEventListener("load", onPageLoad, true);
if (appContent)
appContent.addEventListener("load", onPageLoad, true);
function onPageLoad(event)
{
var win = event.originalTarget.defaultView;
for (var i = 0, length = pending_jumps.length; i < length; i++)
for (var i = 0, length = pendingJumps.length; i < length; i++)
{
var mark = pending_jumps[i];
var mark = pendingJumps[i];
if (win.location.href == mark.location)
{
win.scrollTo(mark.position.x * win.scrollMaxX, mark.position.y * win.scrollMaxY);
pending_jumps.splice(i, 1);
pendingJumps.splice(i, 1);
return;
}
}
@@ -538,17 +538,17 @@ vimperator.Marks = function () //{{{
function removeLocalMark(mark)
{
if (mark in local_marks)
if (mark in localMarks)
{
var win = window.content;
for (var i = 0; i < local_marks[mark].length; i++)
for (var i = 0; i < localMarks[mark].length; i++)
{
if (local_marks[mark][i].location == win.location.href)
if (localMarks[mark][i].location == win.location.href)
{
vimperator.log("Deleting local mark: " + mark + " | " + local_marks[mark][i].location + " | (" + local_marks[mark][i].position.x + ", " + local_marks[mark][i].position.y + ") | tab: " + vimperator.tabs.index(local_marks[mark][i].tab), 5);
local_marks[mark].splice(i, 1);
if (local_marks[mark].length == 0)
delete local_marks[mark];
vimperator.log("Deleting local mark: " + mark + " | " + localMarks[mark][i].location + " | (" + localMarks[mark][i].position.x + ", " + localMarks[mark][i].position.y + ") | tab: " + vimperator.tabs.index(localMarks[mark][i].tab), 5);
localMarks[mark].splice(i, 1);
if (localMarks[mark].length == 0)
delete localMarks[mark];
break;
}
}
@@ -557,10 +557,10 @@ vimperator.Marks = function () //{{{
function removeURLMark(mark)
{
if (mark in url_marks)
if (mark in urlMarks)
{
vimperator.log("Deleting URL mark: " + mark + " | " + url_marks[mark].location + " | (" + url_marks[mark].position.x + ", " + url_marks[mark].position.y + ") | tab: " + vimperator.tabs.index(url_marks[mark].tab), 5);
delete url_marks[mark];
vimperator.log("Deleting URL mark: " + mark + " | " + urlMarks[mark].location + " | (" + urlMarks[mark].position.x + ", " + urlMarks[mark].position.y + ") | tab: " + vimperator.tabs.index(urlMarks[mark].tab), 5);
delete urlMarks[mark];
}
}
@@ -579,12 +579,12 @@ vimperator.Marks = function () //{{{
// local marks
var lmarks = [];
for (var mark in local_marks)
for (var mark in localMarks)
{
for (var i = 0; i < local_marks[mark].length; i++)
for (var i = 0; i < localMarks[mark].length; i++)
{
if (local_marks[mark][i].location == window.content.location.href)
lmarks.push([mark, local_marks[mark][i]]);
if (localMarks[mark][i].location == window.content.location.href)
lmarks.push([mark, localMarks[mark][i]]);
}
}
lmarks.sort();
@@ -592,8 +592,8 @@ vimperator.Marks = function () //{{{
// URL marks
var umarks = [];
for (var mark in url_marks)
umarks.push([mark, url_marks[mark]]);
for (var mark in urlMarks)
umarks.push([mark, urlMarks[mark]]);
// FIXME: why does umarks.sort() cause a "Component is not available =
// NS_ERROR_NOT_AVAILABLE" exception when used here?
umarks.sort(function (a, b) {
@@ -632,16 +632,16 @@ vimperator.Marks = function () //{{{
if (isURLMark(mark))
{
vimperator.log("Adding URL mark: " + mark + " | " + win.location.href + " | (" + position.x + ", " + position.y + ") | tab: " + vimperator.tabs.index(vimperator.tabs.getTab()), 5);
url_marks[mark] = { location: win.location.href, position: position, tab: vimperator.tabs.getTab() };
urlMarks[mark] = { location: win.location.href, position: position, tab: vimperator.tabs.getTab() };
}
else if (isLocalMark(mark))
{
// remove any previous mark of the same name for this location
removeLocalMark(mark);
if (!local_marks[mark])
local_marks[mark] = [];
if (!localMarks[mark])
localMarks[mark] = [];
vimperator.log("Adding local mark: " + mark + " | " + win.location.href + " | (" + position.x + ", " + position.y + ")", 5);
local_marks[mark].push({ location: win.location.href, position: position });
localMarks[mark].push({ location: win.location.href, position: position });
}
},
@@ -650,18 +650,18 @@ vimperator.Marks = function () //{{{
if (special)
{
// :delmarks! only deletes a-z marks
for (var mark in local_marks)
for (var mark in localMarks)
removeLocalMark(mark);
}
else
{
var pattern = new RegExp("[" + filter.replace(/\s+/g, "") + "]");
for (var mark in url_marks)
for (var mark in urlMarks)
{
if (pattern.test(mark))
removeURLMark(mark);
}
for (var mark in local_marks)
for (var mark in localMarks)
{
if (pattern.test(mark))
removeLocalMark(mark);
@@ -675,12 +675,12 @@ vimperator.Marks = function () //{{{
if (isURLMark(mark))
{
var slice = url_marks[mark];
var slice = urlMarks[mark];
if (slice && slice.tab && slice.tab.linkedBrowser)
{
if (!slice.tab.parentNode)
{
pending_jumps.push(slice);
pendingJumps.push(slice);
// NOTE: this obviously won't work on generated pages using
// non-unique URLs, like Vimperator's help :(
vimperator.open(slice.location, vimperator.NEW_TAB);
@@ -693,7 +693,7 @@ vimperator.Marks = function () //{{{
var win = slice.tab.linkedBrowser.contentWindow;
if (win.location.href != slice.location)
{
pending_jumps.push(slice);
pendingJumps.push(slice);
win.location.href = slice.location;
return;
}
@@ -706,7 +706,7 @@ vimperator.Marks = function () //{{{
else if (isLocalMark(mark))
{
var win = window.content;
var slice = local_marks[mark] || [];
var slice = localMarks[mark] || [];
for (var i = 0; i < slice.length; i++)
{
@@ -773,12 +773,12 @@ vimperator.QuickMarks = function () //{{{
/////////////////////////////////////////////////////////////////////////////{{{
var qmarks = {};
var saved_marks = vimperator.options.getPref("quickmarks", "").split("\n");
var savedMarks = vimperator.options.getPref("quickmarks", "").split("\n");
// load the saved quickmarks -- TODO: change to sqlite
for (var i = 0; i < saved_marks.length - 1; i += 2)
for (var i = 0; i < savedMarks.length - 1; i += 2)
{
qmarks[saved_marks[i]] = saved_marks[i + 1];
qmarks[savedMarks[i]] = savedMarks[i + 1];
}
/////////////////////////////////////////////////////////////////////////////}}}
@@ -861,15 +861,15 @@ vimperator.QuickMarks = function () //{{{
destroy: function ()
{
// save the quickmarks
var saved_qmarks = "";
var savedQuickMarks = "";
for (var i in qmarks)
{
saved_qmarks += i + "\n";
saved_qmarks += qmarks[i] + "\n";
savedQuickMarks += i + "\n";
savedQuickMarks += qmarks[i] + "\n";
}
vimperator.options.setPref("quickmarks", saved_qmarks);
vimperator.options.setPref("quickmarks", savedQuickMarks);
}
};
//}}}

View File

@@ -35,10 +35,10 @@ vimperator.Buffer = function () //{{{
// used for the "B" mapping to remember the last :buffer[!] command
var lastBufferSwitchArgs = "";
var lastBufferSwitchSpecial = true;
var zoom_levels = [ 1, 10, 25, 50, 75, 90, 100,
var zoomLevels = [ 1, 10, 25, 50, 75, 90, 100,
120, 150, 200, 300, 500, 1000, 2000 ];
function setZoom(value, full_zoom)
function setZoom(value, fullZoom)
{
if (value < 1 || value > 2000)
{
@@ -46,12 +46,12 @@ vimperator.Buffer = function () //{{{
return false;
}
if (full_zoom)
if (fullZoom)
getBrowser().mCurrentBrowser.markupDocumentViewer.fullZoom = value / 100.0;
else
getBrowser().mCurrentBrowser.markupDocumentViewer.textZoom = value / 100.0;
vimperator.echo((full_zoom ? "Full zoom: " : "Text zoom: ") + value + "%");
vimperator.echo((fullZoom ? "Full zoom: " : "Text zoom: ") + value + "%");
// TODO: shouldn't this just recalculate hint coords, rather than
// unsuccessfully attempt to reshow hints? i.e. isn't it just relying
@@ -60,9 +60,9 @@ vimperator.Buffer = function () //{{{
// vimperator.hints.reshowHints();
}
function bumpZoomLevel(steps, full_zoom)
function bumpZoomLevel(steps, fullZoom)
{
if (full_zoom)
if (fullZoom)
var value = getBrowser().mCurrentBrowser.markupDocumentViewer.fullZoom * 100.0;
else
var value = getBrowser().mCurrentBrowser.markupDocumentViewer.textZoom * 100.0;
@@ -70,9 +70,9 @@ vimperator.Buffer = function () //{{{
var index = -1;
if (steps <= 0)
{
for (var i = zoom_levels.length - 1; i >= 0; i--)
for (var i = zoomLevels.length - 1; i >= 0; i--)
{
if ((zoom_levels[i] + 0.01) < value) // 0.01 for float comparison
if ((zoomLevels[i] + 0.01) < value) // 0.01 for float comparison
{
index = i + 1 + steps;
break;
@@ -81,21 +81,21 @@ vimperator.Buffer = function () //{{{
}
else
{
for (var i = 0; i < zoom_levels.length; i++)
for (var i = 0; i < zoomLevels.length; i++)
{
if ((zoom_levels[i] - 0.01) > value) // 0.01 for float comparison
if ((zoomLevels[i] - 0.01) > value) // 0.01 for float comparison
{
index = i - 1 + steps;
break;
}
}
}
if (index < 0 || index >= zoom_levels.length)
if (index < 0 || index >= zoomLevels.length)
{
vimperator.beep();
return;
}
setZoom(zoom_levels[index], full_zoom);
setZoom(zoomLevels[index], fullZoom);
}
function checkScrollYBounds(win, direction)
@@ -203,26 +203,26 @@ vimperator.Buffer = function () //{{{
offsetX = offsetX || 1;
offsetY = offsetY || 1;
var new_tab = false, new_window = false;
var newTab = false, newWindow = false;
switch (where)
{
case vimperator.NEW_TAB:
case vimperator.NEW_BACKGROUND_TAB:
new_tab = true;
newTab = true;
break;
case vimperator.NEW_WINDOW:
new_window = true;
newWindow = true;
break;
default:
vimperator.log("Invalid where argument for followLink()");
}
var evt = doc.createEvent("MouseEvents");
evt.initMouseEvent("mousedown", true, true, view, 1, offsetX, offsetY, 0, 0, /*ctrl*/ new_tab, /*event.altKey*/0, /*event.shiftKey*/ new_window, /*event.metaKey*/ new_tab, 0, null);
evt.initMouseEvent("mousedown", true, true, view, 1, offsetX, offsetY, 0, 0, /*ctrl*/ newTab, /*event.altKey*/0, /*event.shiftKey*/ newWindow, /*event.metaKey*/ newTab, 0, null);
elem.dispatchEvent(evt);
//var evt = doc.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, view, 1, offsetX, offsetY, 0, 0, /*ctrl*/ new_tab, /*event.altKey*/0, /*event.shiftKey*/ new_window, /*event.metaKey*/ new_tab, 0, null);
evt.initMouseEvent("click", true, true, view, 1, offsetX, offsetY, 0, 0, /*ctrl*/ newTab, /*event.altKey*/0, /*event.shiftKey*/ newWindow, /*event.metaKey*/ newTab, 0, null);
elem.dispatchEvent(evt);
},
@@ -235,14 +235,14 @@ vimperator.Buffer = function () //{{{
if (!selection)
{
var selection_controller = getBrowser().docShell
var selectionController = getBrowser().docShell
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsISelectionDisplay)
.QueryInterface(Components.interfaces.nsISelectionController);
selection_controller.setCaretEnabled(true);
selection_controller.wordMove(false, false);
selection_controller.wordMove(true, true);
selectionController.setCaretEnabled(true);
selectionController.wordMove(false, false);
selectionController.wordMove(true, true);
selection = window.content.getSelection().toString();
}
@@ -260,7 +260,7 @@ vimperator.Buffer = function () //{{{
}
else
{
var items = vimperator.completion.get_buffer_completions("");
var items = vimperator.completion.getBufferCompletions("");
vimperator.bufferwindow.show(items);
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
}
@@ -268,7 +268,7 @@ vimperator.Buffer = function () //{{{
else
{
// TODO: move this to vimperator.buffers.get()
var items = vimperator.completion.get_buffer_completions("");
var items = vimperator.completion.getBufferCompletions("");
var number, indicator, title, url;
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" + "<table>";
@@ -451,7 +451,7 @@ vimperator.Buffer = function () //{{{
if (!vimperator.bufferwindow.visible())
return false;
var items = vimperator.completion.get_buffer_completions("");
var items = vimperator.completion.getBufferCompletions("");
vimperator.bufferwindow.show(items);
vimperator.bufferwindow.selectItem(getBrowser().mTabContainer.selectedIndex);
},
@@ -484,7 +484,7 @@ vimperator.Buffer = function () //{{{
return vimperator.tabs.select(parseInt(match[1], 10) - 1, false); // make it zero-based
var matches = [];
var lower_buffer = buffer.toLowerCase();
var lowerBuffer = buffer.toLowerCase();
var first = vimperator.tabs.index() + (reverse ? 0 : 1);
for (var i = 0; i < getBrowser().browsers.length; i++)
{
@@ -494,7 +494,7 @@ vimperator.Buffer = function () //{{{
if (url == buffer)
return vimperator.tabs.select(index, false);
if (url.indexOf(buffer) >= 0 || title.indexOf(lower_buffer) >= 0)
if (url.indexOf(buffer) >= 0 || title.indexOf(lowerBuffer) >= 0)
matches.push(index);
}
if (matches.length == 0)
@@ -516,14 +516,14 @@ vimperator.Buffer = function () //{{{
}
},
zoomIn: function (steps, full_zoom)
zoomIn: function (steps, fullZoom)
{
bumpZoomLevel(steps, full_zoom);
bumpZoomLevel(steps, fullZoom);
},
zoomOut: function (steps, full_zoom)
zoomOut: function (steps, fullZoom)
{
bumpZoomLevel(-steps, full_zoom);
bumpZoomLevel(-steps, fullZoom);
},
pageInfo: function (verbose)

File diff suppressed because it is too large Load Diff

View File

@@ -29,11 +29,11 @@ the terms of any one of the MPL, the GPL or the LGPL.
vimperator.Completion = function () // {{{
{
// The completion substrings, used for showing the longest common match
var g_substrings = [];
var substrings = [];
// function uses smartcase
// list = [ [['com1', 'com2'], 'text'], [['com3', 'com4'], 'text'] ]
function build_longest_common_substring(list, filter) //{{{
function buildLongestCommonSubstring(list, filter) //{{{
{
var filtered = [];
var ignorecase = false;
@@ -51,19 +51,19 @@ vimperator.Completion = function () // {{{
if (item.indexOf(filter) == -1)
continue;
if (g_substrings.length == 0)
if (substrings.length == 0)
{
var last_index = item.lastIndexOf(filter);
var lastIndex = item.lastIndexOf(filter);
var length = item.length;
for (var k = item.indexOf(filter); k != -1 && k <= last_index; k = item.indexOf(filter, k + 1))
for (var k = item.indexOf(filter); k != -1 && k <= lastIndex; k = item.indexOf(filter, k + 1))
{
for (var l = k + filter.length; l <= length; l++)
g_substrings.push(list[i][0][j].substring(k, l));
substrings.push(list[i][0][j].substring(k, l));
}
}
else
{
g_substrings = g_substrings.filter(function ($_) {
substrings = substrings.filter(function ($_) {
return list[i][0][j].indexOf($_) >= 0;
});
}
@@ -75,7 +75,7 @@ vimperator.Completion = function () // {{{
} //}}}
/* this function is case sensitive and should be documented about input and output ;) */
function build_longest_starting_substring(list, filter) //{{{
function buildLongestStartingSubstring(list, filter) //{{{
{
var filtered = [];
for (var i = 0; i < list.length; i++)
@@ -85,15 +85,15 @@ vimperator.Completion = function () // {{{
if (list[i][0][j].indexOf(filter) != 0)
continue;
if (g_substrings.length == 0)
if (substrings.length == 0)
{
var length = list[i][0][j].length;
for (var k = filter.length; k <= length; k++)
g_substrings.push(list[i][0][j].substring(0, k));
substrings.push(list[i][0][j].substring(0, k));
}
else
{
g_substrings = g_substrings.filter(function ($_) {
substrings = substrings.filter(function ($_) {
return list[i][0][j].indexOf($_) == 0;
});
}
@@ -109,23 +109,23 @@ vimperator.Completion = function () // {{{
* returns the longest common substring
* used for the 'longest' setting for wildmode
*/
get_longest_substring: function () //{{{
getLongestSubstring: function () //{{{
{
if (g_substrings.length == 0)
if (substrings.length == 0)
return "";
var longest = g_substrings[0];
for (var i = 1; i < g_substrings.length; i++)
var longest = substrings[0];
for (var i = 1; i < substrings.length; i++)
{
if (g_substrings[i].length > longest.length)
longest = g_substrings[i];
if (substrings[i].length > longest.length)
longest = substrings[i];
}
return longest;
}, //}}}
dialog: function (filter) //{{{
{
g_substrings = [];
substrings = [];
var nodes = [
["about", "About Firefox"],
["addbookmark", "Add bookmarks for the current page"],
@@ -155,7 +155,7 @@ vimperator.Completion = function () // {{{
return [[node[0]], node[1]];
});
return build_longest_common_substring(mapped, filter);
return buildLongestCommonSubstring(mapped, filter);
}, //}}}
/*
@@ -165,29 +165,29 @@ vimperator.Completion = function () // {{{
* depending on the 'complete' option
* if the 'complete' argument is passed like "h", it temporarily overrides the complete option
*/
get_url_completions: function (filter, complete) //{{{
getUrlCompletions: function (filter, complete) //{{{
{
var completions = [];
g_substrings = [];
substrings = [];
var cpt = complete || vimperator.options["complete"];
// join all completion arrays together
for (var i = 0; i < cpt.length; i++)
{
if (cpt[i] == "s")
completions = completions.concat(this.get_search_completions(filter));
completions = completions.concat(this.getSearchCompletions(filter));
else if (cpt[i] == "b")
completions = completions.concat(vimperator.bookmarks.get(filter));
else if (cpt[i] == "h")
completions = completions.concat(vimperator.history.get(filter));
else if (cpt[i] == "f")
completions = completions.concat(this.get_file_completions(filter, true));
completions = completions.concat(this.getFileCompletions(filter, true));
}
return completions;
}, //}}}
get_search_completions: function (filter) //{{{
getSearchCompletions: function (filter) //{{{
{
var engines = vimperator.bookmarks.getSearchEngines().concat(vimperator.bookmarks.getKeywords());
@@ -197,16 +197,16 @@ vimperator.Completion = function () // {{{
var mapped = engines.map(function (engine) {
return [[engine[0]], engine[1]];
});
return build_longest_common_substring(mapped, filter);
return buildLongestCommonSubstring(mapped, filter);
}, //}}}
// TODO: support file:// and \ or / path separators on both platforms
get_file_completions: function (filter)
getFileCompletions: function (filter)
{
// this is now also used as part of the url completion, so the
// substrings shouldn't be cleared for that case
if (!arguments[1])
g_substrings = [];
substrings = [];
var matches = filter.match(/^(.*[\/\\])(.*?)$/);
var dir;
@@ -230,56 +230,56 @@ vimperator.Completion = function () // {{{
}
return build_longest_starting_substring(mapped, filter);
return buildLongestStartingSubstring(mapped, filter);
},
get_help_completions: function (filter) //{{{
getHelpCompletions: function (filter) //{{{
{
var help_array = [[["introduction"], "Introductory text"],
var helpArray = [[["introduction"], "Introductory text"],
[["initialization"], "Initialization and startup"],
[["mappings"], "Normal mode commands"],
[["commands"], "Ex commands"],
[["options"], "Configuration options"]]; // TODO: hardcoded until we have proper 'pages'
g_substrings = [];
substrings = [];
for (var command in vimperator.commands)
help_array.push([command.long_names.map(function ($_) { return ":" + $_; }), command.short_help]);
options = this.get_options_completions(filter, true);
help_array = help_array.concat(options.map(function ($_) {
helpArray.push([command.longNames.map(function ($_) { return ":" + $_; }), command.shortHelp]);
options = this.getOptionCompletions(filter, true);
helpArray = helpArray.concat(options.map(function ($_) {
return [
$_[0].map(function ($_) { return "'" + $_ + "'"; }),
$_[1]
];
}));
for (var map in vimperator.mappings)
help_array.push([map.names, map.short_help]);
helpArray.push([map.names, map.shortHelp]);
if (!filter) return help_array.map(function ($_) {
if (!filter) return helpArray.map(function ($_) {
return [$_[0][0], $_[1]]; // unfiltered, use the first command
});
return build_longest_common_substring(help_array, filter);
return buildLongestCommonSubstring(helpArray, filter);
}, //}}}
get_command_completions: function (filter) //{{{
getCommandCompletions: function (filter) //{{{
{
g_substrings = [];
substrings = [];
var completions = [];
if (!filter)
{
for (var command in vimperator.commands)
completions.push([command.name, command.short_help]);
completions.push([command.name, command.shortHelp]);
return completions;
}
for (var command in vimperator.commands)
completions.push([command.long_names, command.short_help]);
return build_longest_starting_substring(completions, filter);
completions.push([command.longNames, command.shortHelp]);
return buildLongestStartingSubstring(completions, filter);
}, //}}}
get_options_completions: function (filter, unfiltered) //{{{
getOptionCompletions: function (filter, unfiltered) //{{{
{
g_substrings = [];
var options_completions = [];
substrings = [];
var optionCompletions = [];
var prefix = filter.match(/^no|inv/) || "";
if (prefix)
@@ -292,7 +292,7 @@ vimperator.Completion = function () // {{{
{
if (prefix && option.type != "boolean")
continue;
options.push([option.names, option.short_help]);
options.push([option.names, option.shortHelp]);
}
return options;
}
@@ -304,7 +304,7 @@ vimperator.Completion = function () // {{{
{
if (prefix && option.type != "boolean")
continue;
options.push([prefix + option.name, option.short_help]);
options.push([prefix + option.name, option.shortHelp]);
}
return options;
}
@@ -316,15 +316,15 @@ vimperator.Completion = function () // {{{
{
if (option.hasName(filter))
{
options_completions.push([filter + "=" + option.value, ""]);
return options_completions;
optionCompletions.push([filter + "=" + option.value, ""]);
return optionCompletions;
}
}
return options_completions;
return optionCompletions;
}
// can't use b_l_s_s, since this has special requirements (the prefix)
var filter_length = filter.length;
var filterLength = filter.length;
for (var option in vimperator.options)
{
if (prefix && option.type != "boolean")
@@ -335,29 +335,29 @@ vimperator.Completion = function () // {{{
if (option.names[j].indexOf(filter) != 0)
continue;
if (g_substrings.length == 0)
if (substrings.length == 0)
{
var length = option.names[j].length;
for (var k = filter_length; k <= length; k++)
g_substrings.push(prefix + option.names[j].substring(0, k));
for (var k = filterLength; k <= length; k++)
substrings.push(prefix + option.names[j].substring(0, k));
}
else
{
g_substrings = g_substrings.filter(function ($_) {
substrings = substrings.filter(function ($_) {
return option.names[j].indexOf($_) == 0;
});
}
options_completions.push([prefix + option.names[j], option.short_help]);
optionCompletions.push([prefix + option.names[j], option.shortHelp]);
break;
}
}
return options_completions;
return optionCompletions;
}, //}}}
get_buffer_completions: function (filter) //{{{
getBufferCompletions: function (filter) //{{{
{
g_substrings = [];
substrings = [];
var items = [];
var num = getBrowser().browsers.length;
var title, url;
@@ -388,12 +388,12 @@ vimperator.Completion = function () // {{{
if (!filter) return items.map(function ($_) {
return [$_[0][0], $_[1]];
});
return build_longest_common_substring(items, filter);
return buildLongestCommonSubstring(items, filter);
}, //}}}
get_sidebar_completions: function (filter) //{{{
getSidebarCompletions: function (filter) //{{{
{
g_substrings = [];
substrings = [];
var menu = document.getElementById("viewSidebarMenu");
var nodes = [];
@@ -407,12 +407,12 @@ vimperator.Completion = function () // {{{
return [[node[0]], node[1]];
});
return build_longest_common_substring(mapped, filter);
return buildLongestCommonSubstring(mapped, filter);
}, //}}}
javascript: function (str) // {{{
{
g_substrings = [];
substrings = [];
var matches = str.match(/^(.*?)(\s*\.\s*)?(\w*)$/);
var objects = [];
var filter = matches[3] || "";
@@ -483,7 +483,7 @@ vimperator.Completion = function () // {{{
completions = [];
}
return build_longest_starting_substring(completions, filter);
return buildLongestStartingSubstring(completions, filter);
}, // }}}
// discard all entries in the 'urls' array, which don't match 'filter
@@ -494,7 +494,7 @@ vimperator.Completion = function () // {{{
var filtered = [];
// completions which don't match the url but just the description
// list them add the end of the array
var additional_completions = [];
var additionalCompletions = [];
if (urls.length == 0)
return [];
@@ -519,7 +519,7 @@ vimperator.Completion = function () // {{{
/*
* Longest Common Subsequence
* This shouldn't use build_longest_common_substring
* This shouldn't use buildLongestCommonSubstring
* for performance reasons, so as not to cycle through the urls twice
*/
outer:
@@ -553,28 +553,28 @@ vimperator.Completion = function () // {{{
if (filter.split(/\s+/).every(function (token) {
return (url.indexOf(token) > -1 || title.indexOf(token) > -1);
}))
additional_completions.push(urls[i]);
additionalCompletions.push(urls[i]);
continue;
}
// TODO: refactor out? And just build if wildmode contains longest?
if (g_substrings.length == 0) // Build the substrings
if (substrings.length == 0) // Build the substrings
{
var last_index = url.lastIndexOf(filter);
var url_length = url.length;
if (last_index >= 0 && last_index < url_length) // do not build substrings, if we don't match filter
var lastIndex = url.lastIndexOf(filter);
var urlLength = url.length;
if (lastIndex >= 0 && lastIndex < urlLength) // do not build substrings, if we don't match filter
{
for (var k = url.indexOf(filter); k != -1 && k <= last_index; k = url.indexOf(filter, k + 1))
for (var k = url.indexOf(filter); k != -1 && k <= lastIndex; k = url.indexOf(filter, k + 1))
{
for (var l = k + filter.length; l <= url_length; l++)
g_substrings.push(url.substring(k, l));
for (var l = k + filter.length; l <= urlLength; l++)
substrings.push(url.substring(k, l));
}
}
}
else
{
g_substrings = g_substrings.filter(function ($_) {
substrings = substrings.filter(function ($_) {
return url.indexOf($_) >= 0;
});
}
@@ -582,24 +582,24 @@ vimperator.Completion = function () // {{{
filtered.push(urls[i]);
}
return filtered.concat(additional_completions);
return filtered.concat(additionalCompletions);
}, //}}}
// generic helper function which checks if the given "items" array pass "filter"
// items must be an array of strings
match: function (items, filter, case_sensitive)
match: function (items, filter, caseSensitive)
{
if (typeof filter != "string" || !items)
return false;
var items_str = items.join(" ");
if (!case_sensitive)
var itemsStr = items.join(" ");
if (!caseSensitive)
{
filter = filter.toLowerCase();
items_str = items_str.toLowerCase();
itemsStr = itemsStr.toLowerCase();
}
if (filter.split(/\s+/).every(function (str) { return items_str.indexOf(str) > -1; }))
if (filter.split(/\s+/).every(function (str) { return itemsStr.indexOf(str) > -1; }))
return true;
return false;
@@ -616,7 +616,7 @@ vimperator.Completion = function () // {{{
var matches = str.match(/^(:*\d*)\w*$/);
if (matches)
{
completions = this.get_command_completions(cmd);
completions = this.getCommandCompletions(cmd);
start = matches[1].length;
}
else // dynamically get completions as specified with the command's completer function

View File

@@ -32,8 +32,8 @@ the terms of any one of the MPL, the GPL or the LGPL.
vimperator.Editor = function () //{{{
{
// store our last search with f, F, t or T
var last_findChar = null;
var last_findChar_func = null;
var lastFindChar = null;
var lastFindCharFunc = null;
var abbrev = {}; // abbrev["lhr"][0]["{i,c,!}","rhs"]
function editor()
@@ -120,7 +120,7 @@ vimperator.Editor = function () //{{{
if (typeof count != "number" || count < 1)
count = 1;
var did_command = false;
var didCommand = false;
while (count--)
{
// some commands need this try/catch workaround, because a cmd_charPrevious triggered
@@ -129,11 +129,11 @@ vimperator.Editor = function () //{{{
try
{
controller.doCommand(cmd);
did_command = true;
didCommand = true;
}
catch (e)
{
if (!did_command)
if (!didCommand)
vimperator.beep();
return false;
}
@@ -269,8 +269,8 @@ vimperator.Editor = function () //{{{
if (!editor())
return -1;
last_findChar = ch;
last_findChar_func = this.findCharForward;
lastFindChar = ch;
lastFindCharFunc = this.findCharForward;
var text = editor().value;
if (!typeof count == "number" || count < 1)
@@ -296,8 +296,8 @@ vimperator.Editor = function () //{{{
if (!editor())
return -1;
last_findChar = ch;
last_findChar_func = this.findCharBackward;
lastFindChar = ch;
lastFindCharFunc = this.findCharBackward;
var text = editor().value;
if (!typeof count == "number" || count < 1)
@@ -630,11 +630,11 @@ vimperator.Editor = function () //{{{
{
// if found, replace accordingly
var len = foundWord.length;
var abbr_text = abbrev[lhs][i][1];
text = text.substring(0, currStart - len) + abbr_text + text.substring(currStart);
var abbrText = abbrev[lhs][i][1];
text = text.substring(0, currStart - len) + abbrText + text.substring(currStart);
textbox.value = text;
textbox.selectionStart = currStart - len + abbr_text.length;
textbox.selectionEnd = currEnd - len + abbr_text.length;
textbox.selectionStart = currStart - len + abbrText.length;
textbox.selectionEnd = currEnd - len + abbrText.length;
break;
}
}

View File

@@ -78,7 +78,7 @@ vimperator.Events = function () //{{{
/////////////////////////////////////////////////////////
// track if a popup is open or the menubar is active
var active_menubar = false;
var activeMenubar = false;
function enterPopupMode(event)
{
if (event.originalTarget.localName == "tooltip" || event.originalTarget.id == "vimperator-visualbell")
@@ -89,17 +89,17 @@ vimperator.Events = function () //{{{
function exitPopupMode()
{
// gContextMenu is set to NULL by firefox, when a context menu is closed
if (!gContextMenu && !active_menubar)
if (!gContextMenu && !activeMenubar)
vimperator.modes.remove(vimperator.modes.MENU);
}
function enterMenuMode()
{
active_menubar = true;
activeMenubar = true;
vimperator.modes.add(vimperator.modes.MENU);
}
function exitMenuMode()
{
active_menubar = false;
activeMenubar = false;
vimperator.modes.remove(vimperator.modes.MENU);
}
window.addEventListener("popupshown", enterPopupMode, true);
@@ -468,14 +468,14 @@ vimperator.Events = function () //{{{
onSelectionChange: function (event)
{
var could_copy = false;
var couldCopy = false;
var controller = document.commandDispatcher.getControllerForCommand("cmd_copy");
if (controller && controller.isCommandEnabled("cmd_copy"))
could_copy = true;
couldCopy = true;
if (vimperator.mode != vimperator.modes.VISUAL)
{
if (could_copy)
if (couldCopy)
{
if ((vimperator.mode == vimperator.modes.TEXTAREA || (vimperator.modes.extended & vimperator.modes.TEXTAREA))
&& !vimperator.options["insertmode"])
@@ -486,7 +486,7 @@ vimperator.Events = function () //{{{
}
//else
//{
// if (!could_copy && vimperator.modes.extended & vimperator.modes.CARET)
// if (!couldCopy && vimperator.modes.extended & vimperator.modes.CARET)
// vimperator.mode = vimperator.modes.CARET;
//}
},
@@ -642,13 +642,13 @@ vimperator.Events = function () //{{{
}
}
var count_str = vimperator.input.buffer.match(/^[0-9]*/)[0];
var candidate_command = (vimperator.input.buffer + key).replace(count_str, "");
var countStr = vimperator.input.buffer.match(/^[0-9]*/)[0];
var candidateCommand = (vimperator.input.buffer + key).replace(countStr, "");
var map;
if (event.noremap)
map = vimperator.mappings.getDefaultMap(vimperator.mode, candidate_command);
map = vimperator.mappings.getDefaultMap(vimperator.mode, candidateCommand);
else
map = vimperator.mappings.get(vimperator.mode, candidate_command);
map = vimperator.mappings.get(vimperator.mode, candidateCommand);
// counts must be at the start of a complete mapping (10j -> go 10 lines down)
if (/^[1-9][0-9]*$/.test(vimperator.input.buffer + key))
@@ -670,7 +670,7 @@ vimperator.Events = function () //{{{
}
else if (map)
{
vimperator.input.count = parseInt(count_str, 10);
vimperator.input.count = parseInt(countStr, 10);
if (isNaN(vimperator.input.count))
vimperator.input.count = -1;
if (map.flags & vimperator.Mappings.flags.ARGUMENT)
@@ -682,7 +682,7 @@ vimperator.Events = function () //{{{
{
if (key != "<Esc>" && key != "<C-[>")
{
vimperator.input.pendingMotionMap.execute(candidate_command, vimperator.input.count, null);
vimperator.input.pendingMotionMap.execute(candidateCommand, vimperator.input.count, null);
}
vimperator.input.pendingMotionMap = null;
vimperator.input.buffer = "";
@@ -701,7 +701,7 @@ vimperator.Events = function () //{{{
stop = false;
}
}
else if (vimperator.mappings.getCandidates(vimperator.mode, candidate_command).length > 0)
else if (vimperator.mappings.getCandidates(vimperator.mode, candidateCommand).length > 0)
{
vimperator.input.buffer += key;
}
@@ -729,8 +729,8 @@ vimperator.Events = function () //{{{
event.stopPropagation();
}
var motion_map = (vimperator.input.pendingMotionMap && vimperator.input.pendingMotionMap.names[0]) || "";
vimperator.statusline.updateInputBuffer(motion_map + vimperator.input.buffer);
var motionMap = (vimperator.input.pendingMotionMap && vimperator.input.pendingMotionMap.names[0]) || "";
vimperator.statusline.updateInputBuffer(motionMap + vimperator.input.buffer);
return false;
},

View File

@@ -40,16 +40,16 @@ the terms of any one of the MPL, the GPL or the LGPL.
vimperator.Search = function () //{{{
{
// FIXME:
//var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
var found = false; // true if the last search was successful
var backwards = false; // currently searching backwards
var search_string = ""; // current search string (without modifiers)
var search_pattern = ""; // current search string (includes modifiers)
var last_search_pattern = ""; // the last searched pattern (includes modifiers)
var last_search_string = ""; // the last searched string (without modifiers)
var last_search_backwards = false; // like "backwards", but for the last search, so if you cancel a search with <esc> this is not set
var case_sensitive = false; // search string is case sensitive
var links_only = false; // search is limited to link text only
//var self = this; // needed for callbacks since "this" is the "vimperator" object in a callback
var found = false; // true if the last search was successful
var backwards = false; // currently searching backwards
var searchString = ""; // current search string (without modifiers)
var searchPattern = ""; // current search string (includes modifiers)
var lastSearchPattern = ""; // the last searched pattern (includes modifiers)
var lastSearchString = ""; // the last searched string (without modifiers)
var lastSearchBackwards = false; // like "backwards", but for the last search, so if you cancel a search with <esc> this is not set
var caseSensitive = false; // search string is case sensitive
var linksOnly = false; // search is limited to link text only
// Event handlers for search - closure is needed
vimperator.registerCallback("change", vimperator.modes.SEARCH_FORWARD, function (command) { vimperator.search.searchKeyPressed(command); });
@@ -60,7 +60,7 @@ vimperator.Search = function () //{{{
vimperator.registerCallback("submit", vimperator.modes.SEARCH_BACKWARD, function (command) { vimperator.search.searchSubmitted(command); });
vimperator.registerCallback("cancel", vimperator.modes.SEARCH_BACKWARD, function () { vimperator.search.searchCanceled(); });
// set search_string, search_pattern, case_sensitive, links_only
// set searchString, searchPattern, caseSensitive, linksOnly
function processUserPattern(pattern)
{
// strip off pattern terminator and offset
@@ -69,32 +69,32 @@ vimperator.Search = function () //{{{
else
pattern = pattern.replace(/\/.*/, "");
search_pattern = pattern;
searchPattern = pattern;
// links only search - \l wins if both modifiers specified
if (/\\l/.test(pattern))
links_only = false;
linksOnly = false;
else if (/\L/.test(pattern))
links_only = true;
linksOnly = true;
else if (vimperator.options["linksearch"])
links_only = true;
linksOnly = true;
else
links_only = false;
linksOnly = false;
// strip links-only modifiers
pattern = pattern.replace(/(\\)?\\[lL]/g, function ($0, $1) { return $1 ? $0 : ""; });
// case sensitivity - \c wins if both modifiers specified
if (/\c/.test(pattern))
case_sensitive = false;
caseSensitive = false;
else if (/\C/.test(pattern))
case_sensitive = true;
caseSensitive = true;
else if (vimperator.options["ignorecase"] && vimperator.options["smartcase"] && /[A-Z]/.test(pattern))
case_sensitive = true;
caseSensitive = true;
else if (vimperator.options["ignorecase"])
case_sensitive = false;
caseSensitive = false;
else
case_sensitive = true;
caseSensitive = true;
// strip case-sensitive modifiers
pattern = pattern.replace(/(\\)?\\[cC]/g, function ($0, $1) { return $1 ? $0 : ""; });
@@ -102,7 +102,7 @@ vimperator.Search = function () //{{{
// remove any modifer escape \
pattern = pattern.replace(/\\(\\[cClL])/g, "$1");
search_string = pattern;
searchString = pattern;
}
return {
@@ -133,11 +133,11 @@ vimperator.Search = function () //{{{
processUserPattern(str);
fastFind.caseSensitive = case_sensitive;
found = fastFind.find(search_string, links_only) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
fastFind.caseSensitive = caseSensitive;
found = fastFind.find(searchString, linksOnly) != Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND;
if (!found)
vimperator.echoerr("E486: Pattern not found: " + search_pattern);
vimperator.echoerr("E486: Pattern not found: " + searchPattern);
return found;
},
@@ -148,15 +148,15 @@ vimperator.Search = function () //{{{
// this hack is needed to make n/N work with the correct string, if
// we typed /foo<esc> after the original search. Since searchString is
// readonly we have to call find() again to update it.
if (getBrowser().fastFind.searchString != last_search_string)
this.find(last_search_string, false);
if (getBrowser().fastFind.searchString != lastSearchString)
this.find(lastSearchString, false);
var up = reverse ? !last_search_backwards : last_search_backwards;
var result = getBrowser().fastFind.findAgain(up, links_only);
var up = reverse ? !lastSearchBackwards : lastSearchBackwards;
var result = getBrowser().fastFind.findAgain(up, linksOnly);
if (result == Components.interfaces.nsITypeAheadFind.FIND_NOTFOUND)
{
vimperator.echoerr("E486: Pattern not found: " + last_search_pattern);
vimperator.echoerr("E486: Pattern not found: " + lastSearchPattern);
}
else if (result == Components.interfaces.nsITypeAheadFind.FIND_WRAPPED)
{
@@ -171,10 +171,10 @@ vimperator.Search = function () //{{{
}
else
{
vimperator.echo((up ? "?" : "/") + last_search_pattern, null, vimperator.commandline.FORCE_SINGLELINE);
vimperator.echo((up ? "?" : "/") + lastSearchPattern, null, vimperator.commandline.FORCE_SINGLELINE);
if (vimperator.options["hlsearch"])
this.highlight(last_search_string);
this.highlight(lastSearchString);
}
},
@@ -186,22 +186,22 @@ vimperator.Search = function () //{{{
},
// Called when the enter key is pressed to trigger a search
// use forced_direction if you call this function directly
searchSubmitted: function (command, forced_backward)
// use forcedBackward if you call this function directly
searchSubmitted: function (command, forcedBackward)
{
if (typeof forced_backward === "boolean")
backwards = forced_backward;
if (typeof forcedBackward === "boolean")
backwards = forcedBackward;
// use the last pattern if none specified
if (!command)
command = last_search_pattern;
command = lastSearchPattern;
this.clear();
this.find(command, backwards);
last_search_backwards = backwards;
last_search_pattern = command.replace(backwards ? /\?.*/ : /\/.*/, ""); // XXX
last_search_string = search_string;
lastSearchBackwards = backwards;
lastSearchPattern = command.replace(backwards ? /\?.*/ : /\/.*/, ""); // XXX
lastSearchString = searchString;
// TODO: move to find() when reverse incremental searching is kludged in
// need to find again for reverse searching
@@ -209,7 +209,7 @@ vimperator.Search = function () //{{{
setTimeout(function () { self.findAgain(false); }, 0);
if (vimperator.options["hlsearch"])
this.highlight(search_string);
this.highlight(searchString);
vimperator.modes.reset();
},
@@ -230,9 +230,9 @@ vimperator.Search = function () //{{{
return;
if (!text)
text = last_search_string;
text = lastSearchString;
gFindBar._setCaseSensitivity(case_sensitive);
gFindBar._setCaseSensitivity(caseSensitive);
gFindBar._highlightDoc("white", "black", text);
// TODO: seems fast enough for now...just
@@ -246,7 +246,7 @@ vimperator.Search = function () //{{{
})(window.content);
// recreate selection since _highlightDoc collapses the selection backwards
getBrowser().fastFind.findAgain(false, links_only);
getBrowser().fastFind.findAgain(false, linksOnly);
// TODO: remove highlighting from non-link matches (HTML - A/AREA with href attribute; XML - Xlink [type="simple"])
},

View File

@@ -72,10 +72,10 @@ vimperator.help = function (section, easter) //{{{
ret += '</td><td valign="top">';
// the actual help text with the first line in bold
if (command.short_help)
if (command.shortHelp)
{
ret += '<span class="shorthelp">';
ret += command.short_help; // the help description
ret += command.shortHelp; // the help description
ret += "</span><br/>";
if (func) // for options we print default values here, e.g.
{
@@ -95,9 +95,9 @@ vimperator.help = function (section, easter) //{{{
var names = command.names;
for (var j=0; j < names.length; j++)
{
var cmd_name = names[j];
cmd_name = vimperator.util.escapeHTML(cmd_name);
ret += '<code class="tag">' + beg + cmd_name + end + '</code><br/>';
var cmdName = names[j];
cmdName = vimperator.util.escapeHTML(cmdName);
ret += '<code class="tag">' + beg + cmdName + end + '</code><br/>';
}
ret += '</td></tr>';
@@ -114,17 +114,17 @@ vimperator.help = function (section, easter) //{{{
ret = command.type + ' (default: ';
if (command.type == "boolean")
{
if (command.default_value == true)
if (command.defaultValue == true)
ret += "on";
else
ret += "off";
}
else
{
if (typeof command.default_value == "string" && command.default_value.length == 0)
if (typeof command.defaultValue == "string" && command.defaultValue.length == 0)
ret += "''";
else
ret += command.default_value;
ret += command.defaultValue;
}
ret += ")<br/>";

View File

@@ -39,7 +39,7 @@ vimperator.Hints = function () //{{{
// hints[] = [elem, text, span, imgspan, elem.style.backgroundColor, elem.style.color]
var hints = [];
var valid_hints = []; // store the indices of the "hints" array with valid elements
var validHints = []; // store the indices of the "hints" array with valid elements
var escapeNumbers = false ; // escape mode for numbers. true -> treated as hint-text
var activeTimeout = null; // needed for hinttimeout > 0
@@ -57,7 +57,7 @@ vimperator.Hints = function () //{{{
hintNumber = 0;
usedTabKey = false;
hints = [];
valid_hints = [];
validHints = [];
canUpdate = false;
docs = [];
escapeNumbers = false;
@@ -78,11 +78,11 @@ vimperator.Hints = function () //{{{
// for javascript links
function openHint(where)
{
if (valid_hints.length < 1)
if (validHints.length < 1)
return false;
var x = 1, y = 1;
var elem = valid_hints[hintNumber - 1] || valid_hints[0];
var elem = validHints[hintNumber - 1] || validHints[0];
var elemTagName = elem.localName.toLowerCase();
elem.focus();
if (elemTagName == "frame" || elemTagName == "iframe")
@@ -102,10 +102,10 @@ vimperator.Hints = function () //{{{
function focusHint()
{
if (valid_hints.length < 1)
if (validHints.length < 1)
return false;
var elem = valid_hints[hintNumber - 1] || valid_hints[0];
var elem = validHints[hintNumber - 1] || validHints[0];
var doc = window.content.document;
var elemTagName = elem.localName.toLowerCase();
if (elemTagName == "frame" || elemTagName == "iframe")
@@ -135,10 +135,10 @@ vimperator.Hints = function () //{{{
function yankHint(text)
{
if (valid_hints.length < 1)
if (validHints.length < 1)
return false;
var elem = valid_hints[hintNumber - 1] || valid_hints[0];
var elem = validHints[hintNumber - 1] || validHints[0];
if (text)
var loc = elem.textContent;
else
@@ -148,12 +148,12 @@ vimperator.Hints = function () //{{{
vimperator.echo("Yanked " + loc, vimperator.commandline.FORCE_SINGLELINE);
}
function saveHint(skip_prompt)
function saveHint(skipPrompt)
{
if (valid_hints.length < 1)
if (validHints.length < 1)
return false;
var elem = valid_hints[hintNumber - 1] || valid_hints[0];
var elem = validHints[hintNumber - 1] || validHints[0];
var doc = elem.ownerDocument;
var url = makeURLAbsolute(elem.baseURI, elem.href);
var text = elem.textContent;
@@ -161,7 +161,7 @@ vimperator.Hints = function () //{{{
try
{
urlSecurityCheck(url, doc.nodePrincipal);
saveURL(url, text, null, true, skip_prompt, makeURI(url, doc.characterSet));
saveURL(url, text, null, true, skipPrompt, makeURI(url, doc.characterSet));
}
catch (e)
{
@@ -247,11 +247,11 @@ vimperator.Hints = function () //{{{
// TODO: make it aware of imgspans
function showActiveHint(newID, oldID)
{
var oldElem = valid_hints[oldID - 1];
var oldElem = validHints[oldID - 1];
if (oldElem)
oldElem.style.backgroundColor = "yellow";
var newElem = valid_hints[newID - 1];
var newElem = validHints[newID - 1];
if (newElem)
newElem.style.backgroundColor = "#88FF00";
}
@@ -267,9 +267,9 @@ vimperator.Hints = function () //{{{
var elem, tagname, text, rect, span, imgspan;
var hintnum = 1;
var find_tokens = hintString.split(/ +/);
var findTokens = hintString.split(/ +/);
var activeHint = hintNumber || 1;
valid_hints = [];
validHints = [];
for (var j = 0; j < docs.length; j++)
{
@@ -287,9 +287,9 @@ vimperator.Hints = function () //{{{
span = hints[i][2];
imgspan = hints[i][3];
for (var k = 0; k < find_tokens.length; k++)
for (var k = 0; k < findTokens.length; k++)
{
if (text.indexOf(find_tokens[k]) < 0)
if (text.indexOf(findTokens[k]) < 0)
{
span.style.display = "none";
if (imgspan)
@@ -331,7 +331,7 @@ vimperator.Hints = function () //{{{
elem.style.color = "black";
span.textContent = "" + (hintnum++);
span.style.display = "inline";
valid_hints.push(elem);
validHints.push(elem);
}
}
@@ -341,7 +341,7 @@ vimperator.Hints = function () //{{{
function removeHints(timeout)
{
var firstElem = valid_hints[0] || null;
var firstElem = validHints[0] || null;
var firstElemBgColor = "";
var firstElemColor = "";
@@ -411,7 +411,7 @@ vimperator.Hints = function () //{{{
function processHints(followFirst)
{
if (valid_hints.length == 0)
if (validHints.length == 0)
{
vimperator.beep();
return false;
@@ -419,18 +419,18 @@ vimperator.Hints = function () //{{{
if (!followFirst)
{
var first_href = valid_hints[0].getAttribute("href") || null;
if (first_href)
var firstHref = validHints[0].getAttribute("href") || null;
if (firstHref)
{
if (valid_hints.some(function (e) { return e.getAttribute("href") != first_href; }))
if (validHints.some(function (e) { return e.getAttribute("href") != firstHref; }))
return false;
}
else if (valid_hints.length > 1)
else if (validHints.length > 1)
return false;
}
var activeNum = hintNumber || 1;
var loc = valid_hints[activeNum - 1].href || "";
var loc = validHints[activeNum - 1].href || "";
switch (submode)
{
case ";": focusHint(); break;
@@ -502,13 +502,13 @@ vimperator.Hints = function () //{{{
canUpdate = true;
showHints();
if (valid_hints.length == 0)
if (validHints.length == 0)
{
vimperator.beep();
vimperator.modes.reset();
return false;
}
else if (valid_hints.length == 1)
else if (validHints.length == 1)
{
processHints(true);
return false;
@@ -554,13 +554,13 @@ vimperator.Hints = function () //{{{
var oldID = hintNumber;
if (key == "<Tab>")
{
if (++hintNumber > valid_hints.length)
if (++hintNumber > validHints.length)
hintNumber = 1;
}
else
{
if (--hintNumber < 1)
hintNumber = valid_hints.length;
hintNumber = validHints.length;
}
showActiveHint(hintNumber, oldID);
return;
@@ -638,7 +638,7 @@ vimperator.Hints = function () //{{{
}
showActiveHint(hintNumber, oldHintNumber || 1);
if (hintNumber == 0 || hintNumber > valid_hints.length)
if (hintNumber == 0 || hintNumber > validHints.length)
{
vimperator.beep();
return;
@@ -646,7 +646,7 @@ vimperator.Hints = function () //{{{
// if we write a numeric part like 3, but we have 45 hints, only follow
// the hint after a timeout, as the user might have wanted to follow link 34
if (hintNumber > 0 && hintNumber * 10 <= valid_hints.length)
if (hintNumber > 0 && hintNumber * 10 <= validHints.length)
{
var timeout = vimperator.options["hinttimeout"];
if (timeout > 0)

View File

@@ -29,7 +29,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
vimperator.IO = function ()
{
var environment_service = Components.classes["@mozilla.org/process/environment;1"]
var environmentService = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
return {
@@ -54,30 +54,30 @@ vimperator.IO = function ()
// expand "~" to VIMPERATOR_HOME or HOME (USERPROFILE or HOMEDRIVE\HOMEPATH on Windows if HOME is not set)
if (/^~/.test(path))
{
var home = environment_service.get("VIMPERATOR_HOME");
var home = environmentService.get("VIMPERATOR_HOME");
if (!home)
home = environment_service.get("HOME");
home = environmentService.get("HOME");
if (WINDOWS && !home)
home = environment_service.get("USERPROFILE") ||
environment_service.get("HOMEDRIVE") + environment_service.get("HOMEPATH");
home = environmentService.get("USERPROFILE") ||
environmentService.get("HOMEDRIVE") + environmentService.get("HOMEPATH");
path = path.replace("~", home);
}
// expand any $ENV vars
var env_vars = path.match(/\$\w+\b/g); // this is naive but so is Vim and we like to be compatible
var envVars = path.match(/\$\w+\b/g); // this is naive but so is Vim and we like to be compatible
if (env_vars)
if (envVars)
{
var expansion;
for (var i = 0; i < env_vars.length; i++)
for (var i = 0; i < envVars.length; i++)
{
expansion = environment_service.get(env_vars[i].replace("$", ""));
expansion = environmentService.get(envVars[i].replace("$", ""));
if (expansion)
path = path.replace(env_vars[i], expansion);
path = path.replace(envVars[i], expansion);
}
}
@@ -86,30 +86,30 @@ vimperator.IO = function ()
getPluginDir: function ()
{
var plugin_dir;
var pluginDir;
if (navigator.platform == "Win32")
plugin_dir = "~/vimperator/plugin";
pluginDir = "~/vimperator/plugin";
else
plugin_dir = "~/.vimperator/plugin";
pluginDir = "~/.vimperator/plugin";
plugin_dir = this.getFile(this.expandPath(plugin_dir));
pluginDir = this.getFile(this.expandPath(pluginDir));
return plugin_dir.exists() && plugin_dir.isDirectory() ? plugin_dir : null;
return pluginDir.exists() && pluginDir.isDirectory() ? pluginDir : null;
},
getRCFile: function ()
{
var rc_file1 = this.getFile(this.expandPath("~/.vimperatorrc"));
var rc_file2 = this.getFile(this.expandPath("~/_vimperatorrc"));
var rcFile1 = this.getFile(this.expandPath("~/.vimperatorrc"));
var rcFile2 = this.getFile(this.expandPath("~/_vimperatorrc"));
if (navigator.platform == "Win32")
[rc_file1, rc_file2] = [rc_file2, rc_file1]
[rcFile1, rcFile2] = [rcFile2, rcFile1]
if (rc_file1.exists() && rc_file1.isFile())
return rc_file1;
else if (rc_file2.exists() && rc_file2.isFile())
return rc_file2;
if (rcFile1.exists() && rcFile1.isFile())
return rcFile1;
else if (rcFile2.exists() && rcFile2.isFile())
return rcFile2;
else
return null;
},
@@ -133,12 +133,12 @@ vimperator.IO = function ()
createInstance(Components.interfaces.nsILocalFile);
if (navigator.platform == "Win32")
{
var dir = environment_service.get("TMP") || environment_service.get("TEMP") || "C:\\";
var dir = environmentService.get("TMP") || environmentService.get("TEMP") || "C:\\";
file.initWithPath(dir + "\\vimperator.tmp");
}
else
{
var dir = environment_service.get("TMP") || environment_service.get("TEMP") || "/tmp/";
var dir = environmentService.get("TMP") || environmentService.get("TEMP") || "/tmp/";
file.initWithPath(dir + "/vimperator.tmp");
}

File diff suppressed because it is too large Load Diff

View File

@@ -75,12 +75,12 @@ vimperator.modes = (function ()
// Usually you should only indicate to leave a special mode linke HINTS
// by calling vimperator.modes.reset() and adding the stuff which is needed
// for its cleanup here
function handleModeChange(oldmode, newmode)
function handleModeChange(oldMode, newMode)
{
// TODO: fix v.log() to work verbosity level
// vimperator.log("switching from mode " + oldmode + " to mode " + newmode, 7);
// vimperator.log("switching from mode " + oldMode + " to mode " + newMode, 7);
switch (oldmode)
switch (oldMode)
{
case vimperator.modes.TEXTAREA:
case vimperator.modes.INSERT:
@@ -88,7 +88,7 @@ vimperator.modes = (function ()
break;
case vimperator.modes.VISUAL:
if (newmode == vimperator.modes.CARET)
if (newMode == vimperator.modes.CARET)
{
// clear any selection made
var selection = window.content.getSelection();
@@ -111,7 +111,7 @@ vimperator.modes = (function ()
break;
}
if (newmode == vimperator.modes.NORMAL)
if (newMode == vimperator.modes.NORMAL)
{
// XXX: why this code?
var value = vimperator.options.getFirefoxPref("accessibility.browsewithcaret", false);
@@ -169,21 +169,21 @@ vimperator.modes = (function ()
// helper function to set both modes in one go
// if silent == true, you also need to take care of the mode handling changes yourself
set: function (main_mode, extended_mode, silent)
set: function (mainMode, extendedMode, silent)
{
// if a main mode is set, the extended is always cleared
if (typeof main_mode === "number")
if (typeof mainMode === "number")
{
if (!silent && main_mode != main)
handleModeChange(main, main_mode);
if (!silent && mainMode != main)
handleModeChange(main, mainMode);
main = main_mode;
if (!extended_mode)
main = mainMode;
if (!extendedMode)
extended = vimperator.modes.NONE;
}
if (typeof extended_mode === "number")
extended = extended_mode;
if (typeof extendedMode === "number")
extended = extendedMode;
if (!silent)
this.show();

View File

@@ -26,7 +26,7 @@ the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/
vimperator.Option = function (names, type, extra_info) //{{{
vimperator.Option = function (names, type, extraInfo) //{{{
{
if (!names || !type)
return null;
@@ -38,29 +38,29 @@ vimperator.Option = function (names, type, extra_info) //{{{
this.usage = this.names;
this.type = type;
if (extra_info)
if (extraInfo)
{
if (extra_info.usage)
this.usage = extra_info.usage;
if (extraInfo.usage)
this.usage = extraInfo.usage;
this.help = extra_info.help || null;
this.short_help = extra_info.short_help || null;
this.help = extraInfo.help || null;
this.shortHelp = extraInfo.shortHelp || null;
// "", 0 are valid default values
if (extra_info.default_value !== undefined)
this.default_value = extra_info.default_value;
if (extraInfo.defaultValue !== undefined)
this.defaultValue = extraInfo.defaultValue;
else
this.default_value = null;
this.defaultValue = null;
value = this.default_value;
value = this.defaultValue;
if (extra_info.setter)
this.setter = extra_info.setter;
if (extra_info.getter)
this.getter = extra_info.getter;
if (extraInfo.setter)
this.setter = extraInfo.setter;
if (extraInfo.getter)
this.getter = extraInfo.getter;
this.completer = extra_info.completer || null;
this.validator = extra_info.validator || null;
this.completer = extraInfo.completer || null;
this.validator = extraInfo.validator || null;
}
// add noOPTION variant of boolean OPTION to this.names
@@ -85,9 +85,9 @@ vimperator.Option = function (names, type, extra_info) //{{{
}
);
this.__defineSetter__("value",
function (new_value)
function (newValue)
{
value = new_value;
value = newValue;
if (this.setter)
this.setter.call(this, value);
}
@@ -116,7 +116,7 @@ vimperator.Option = function (names, type, extra_info) //{{{
this.reset = function ()
{
this.value = this.default_value;
this.value = this.defaultValue;
};
}; //}}}
@@ -126,13 +126,13 @@ vimperator.Options = function () //{{{
////////////////////// PRIVATE SECTION /////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////{{{
var firefox_prefs = Components.classes["@mozilla.org/preferences-service;1"]
var firefoxPrefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var vimperator_prefs = firefox_prefs.getBranch("extensions.vimperator.");
var vimperatorPrefs = firefoxPrefs.getBranch("extensions.vimperator.");
var options = [];
// save if we already changed a GUI related option, used for setInitialGUI
var guioptions_done = false, showtabline_done = false, laststatus_done = false;
var guioptionsDone = false, showtablineDone = false, laststatusDone = false;
function optionsIterator()
{
@@ -142,14 +142,14 @@ vimperator.Options = function () //{{{
throw StopIteration;
}
function storePreference(name, value, vimperator_branch)
function storePreference(name, value, vimperatorBranch)
{
var branch;
if (vimperator_branch)
branch = vimperator_prefs;
if (vimperatorBranch)
branch = vimperatorPrefs;
else
branch = firefox_prefs;
branch = firefoxPrefs;
switch (typeof value)
{
@@ -167,23 +167,23 @@ vimperator.Options = function () //{{{
}
}
function loadPreference(name, forced_default, vimperator_branch)
function loadPreference(name, forcedDefault, vimperatorBranch)
{
var default_value = null;
if (forced_default != null) // this argument sets defaults for non-user settable options (like comp_history)
default_value = forced_default;
var defaultValue = null;
if (forcedDefault != null) // this argument sets defaults for non-user settable options (like comp_history)
defaultValue = forcedDefault;
if (vimperator_branch)
if (vimperatorBranch)
{
branch = vimperator_prefs;
branch = vimperatorPrefs;
if (!forced_default) // this argument sets defaults for non-user settable options (like comp_history)
if (!forcedDefault) // this argument sets defaults for non-user settable options (like comp_history)
{
for (var i = 0; i < options.length; i++)
{
if (options[i].name == name) // only first name is searched
{
default_value = options[i].default_value;
defaultValue = options[i].defaultValue;
break;
}
}
@@ -191,12 +191,12 @@ vimperator.Options = function () //{{{
}
else
{
branch = firefox_prefs;
branch = firefoxPrefs;
}
try
{
switch (typeof default_value)
switch (typeof defaultValue)
{
case "string":
return branch.getCharPref(name);
@@ -205,12 +205,12 @@ vimperator.Options = function () //{{{
case "boolean":
return branch.getBoolPref(name);
default:
return default_value;
return defaultValue;
}
}
catch (e)
{
return default_value;
return defaultValue;
}
}
@@ -226,7 +226,7 @@ vimperator.Options = function () //{{{
document.getElementById("PersonalToolbar").collapsed = value.indexOf("b") > -1 ? false : true;
document.getElementById("PersonalToolbar").hidden = value.indexOf("b") > -1 ? false : true;
guioptions_done = true;
guioptionsDone = true;
}
function setLastStatus(value)
@@ -246,7 +246,7 @@ vimperator.Options = function () //{{{
document.getElementById("status-bar").hidden = false;
}
laststatus_done = true;
laststatusDone = true;
}
function setShowTabline(value)
@@ -270,7 +270,7 @@ vimperator.Options = function () //{{{
tabs.collapsed = false;
}
showtabline_done = true;
showtablineDone = true;
}
function setTitleString(value)
@@ -297,9 +297,9 @@ vimperator.Options = function () //{{{
//
// work around firefox popup blocker
var popup_allowed_events = loadPreference("dom.popup_allowed_events", "change click dblclick mouseup reset submit");
if (!/keypress/.test(popup_allowed_events))
storePreference("dom.popup_allowed_events", popup_allowed_events + " keypress");
var popupAllowedEvents = loadPreference("dom.popup_allowed_events", "change click dblclick mouseup reset submit");
if (!/keypress/.test(popupAllowedEvents))
storePreference("dom.popup_allowed_events", popupAllowedEvents + " keypress");
// TODO: shouldn't we be resetting these in destroy() as well?
// we have our own typeahead find implementation
@@ -341,11 +341,11 @@ vimperator.Options = function () //{{{
{
// reset some modified firefox prefs
if (loadPreference("dom.popup_allowed_events", "change click dblclick mouseup reset submit")
== popup_allowed_events + " keypress")
storePreference("dom.popup_allowed_events", popup_allowed_events);
== popupAllowedEvents + " keypress")
storePreference("dom.popup_allowed_events", popupAllowedEvents);
},
list: function (only_non_default)
list: function (onlyNondefault)
{
// TODO: columns like Vim?
var list = ":" + vimperator.util.escapeHTML(vimperator.commandline.getCommand()) + "<br/>" +
@@ -356,9 +356,9 @@ vimperator.Options = function () //{{{
{
name = options[i].name;
value = options[i].value;
def = options[i].default_value;
def = options[i].defaultValue;
if (only_non_default && value == def)
if (onlyNondefault && value == def)
continue;
if (options[i].type == "boolean")
@@ -390,11 +390,11 @@ vimperator.Options = function () //{{{
// this hack is only needed, because we need to do asynchronous loading of the .vimperatorrc
setInitialGUI: function ()
{
if (!guioptions_done)
if (!guioptionsDone)
this.get("guioptions").reset();
if (!laststatus_done)
if (!laststatusDone)
this.get("laststatus").reset();
if (!showtabline_done)
if (!showtablineDone)
this.get("showtabline").reset();
},
@@ -405,9 +405,9 @@ vimperator.Options = function () //{{{
return storePreference(name, value, true);
},
getPref: function (name, forced_default)
getPref: function (name, forcedDefault)
{
return loadPreference(name, forced_default, true);
return loadPreference(name, forcedDefault, true);
},
setFirefoxPref: function (name, value)
@@ -415,9 +415,9 @@ vimperator.Options = function () //{{{
return storePreference(name, value);
},
getFirefoxPref: function (name, forced_default)
getFirefoxPref: function (name, forcedDefault)
{
return loadPreference(name, forced_default);
return loadPreference(name, forcedDefault);
}
};
@@ -433,7 +433,7 @@ vimperator.Options = function () //{{{
optionManager.add(new vimperator.Option(["activate", "act"], "stringlist",
{
short_help: "Define when tabs are automatically activated",
shortHelp: "Define when tabs are automatically activated",
help: "Available items:<br/>" +
"<ul>" +
"<li><b>homepage</b>: <code class=\"mapping\">gH</code> mapping</li>" +
@@ -441,7 +441,7 @@ vimperator.Options = function () //{{{
"<li><b>tabopen</b>: <code class=\"command\">:tabopen[!]</code> command</li>" +
"<li><b>paste</b>: <code class=\"mapping\">P</code> and <code class=\"mapping\">gP</code> mappings</li>" +
"</ul>",
default_value: "homepage,quickmark,tabopen,paste",
defaultValue: "homepage,quickmark,tabopen,paste",
validator: function (value)
{
return value.split(",").every(function (item) { return /^(homepage|quickmark|tabopen|paste|)$/.test(item); });
@@ -450,7 +450,7 @@ vimperator.Options = function () //{{{
));
optionManager.add(new vimperator.Option(["complete", "cpt"], "charlist",
{
short_help: "Items which are completed at the :[tab]open prompt",
shortHelp: "Items which are completed at the :[tab]open prompt",
help: "Available items:<br/>" +
"<ul>" +
"<li><b>s</b>: Search engines and keyword URLs</li>" +
@@ -460,52 +460,52 @@ vimperator.Options = function () //{{{
"</ul>" +
"The order is important, so <code class=\"command\">:set complete=bs</code> would list bookmarks first, and then any available quick searches.<br/>" +
"Add <code class=\"option\">'sort'</code> to the <code class=\"option\">'wildoptions'</code> option if you want all entries sorted.",
default_value: "sfbh",
defaultValue: "sfbh",
validator: function (value) { return !/[^sfbh]/.test(value); }
}
));
optionManager.add(new vimperator.Option(["defsearch", "ds"], "string",
{
short_help: "Set the default search engine",
shortHelp: "Set the default search engine",
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.",
default_value: "google"
defaultValue: "google"
}
));
optionManager.add(new vimperator.Option(["editor"], "string",
{
short_help: "Set the external text editor",
shortHelp: "Set the external text editor",
help: "Sets the editor to run when <code class=\"mapping\">&lt;C-i&gt;</code> " +
"is pressed in INSERT and TEXTAREA modes. Note that Vimperator will " +
"not behave correctly if the editor forks its own process, such as with "+
"gvim without the -f argument.",
default_value: "gvim -f"
defaultValue: "gvim -f"
}
));
optionManager.add(new vimperator.Option(["extendedhinttags", "eht"], "string",
{
short_help: "XPath string of hintable elements activated by ';'",
default_value: DEFAULT_HINTTAGS
shortHelp: "XPath string of hintable elements activated by ';'",
defaultValue: DEFAULT_HINTTAGS
}
));
optionManager.add(new vimperator.Option(["focusedhintstyle", "fhs"], "string",
{
short_help: "CSS specification of focused hints",
default_value: "z-index:5000; font-family:monospace; font-size:12px; color:ButtonText; background-color:ButtonShadow; " +
shortHelp: "CSS specification of focused hints",
defaultValue: "z-index:5000; font-family:monospace; font-size:12px; color:ButtonText; background-color:ButtonShadow; " +
"border-color:ButtonShadow; border-width:1px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;"
}
));
optionManager.add(new vimperator.Option(["fullscreen", "fs"], "boolean",
{
short_help: "Show the current window fullscreen",
shortHelp: "Show the current window fullscreen",
setter: function (value) { window.fullScreen = value; },
getter: function () { return window.fullScreen; },
default_value: false
defaultValue: false
}
));
optionManager.add(new vimperator.Option(["guioptions", "go"], "charlist",
{
short_help: "Show or hide the menu, toolbar and scrollbars",
shortHelp: "Show or hide the menu, toolbar and scrollbars",
help: "Supported characters:<br/>" +
"<ul>" +
"<li><b>m</b>: menubar</li>" +
@@ -513,68 +513,68 @@ vimperator.Options = function () //{{{
"<li><b>b</b>: bookmark bar</li>" +
"</ul>",
setter: function (value) { setGuiOptions(value); },
default_value: "",
defaultValue: "",
validator: function (value) { return !/[^mTb]/.test(value); }
}
));
optionManager.add(new vimperator.Option(["hinttimeout", "hto"], "number",
{
short_help: "Automatically follow non unique numerical hint after {arg} ms",
shortHelp: "Automatically follow non unique numerical hint after {arg} ms",
help: "Set to 0 (the default) to only follow numeric hints after pressing &lt;Return&gt; or when the hint is unique.",
default_value: 0,
defaultValue: 0,
validator: function (value) { return value >= 0; }
}
));
optionManager.add(new vimperator.Option(["hintstyle", "hs"], "string",
{
short_help: "CSS specification of unfocused hints",
default_value: "z-index:5000; font-family:monospace; font-size:12px; color:white; background-color:red; " +
shortHelp: "CSS specification of unfocused hints",
defaultValue: "z-index:5000; font-family:monospace; font-size:12px; color:white; background-color:red; " +
"border-color:ButtonShadow; border-width:0px; border-style:solid; padding:0px 1px 0px 1px; position:absolute;"
}
));
optionManager.add(new vimperator.Option(["hinttags", "ht"], "string",
{
short_help: "XPath string of hintable elements activated by <code class=\"mapping\">'f'</code> and <code class=\"mapping\">'F'</code>",
default_value: DEFAULT_HINTTAGS
shortHelp: "XPath string of hintable elements activated by <code class=\"mapping\">'f'</code> and <code class=\"mapping\">'F'</code>",
defaultValue: DEFAULT_HINTTAGS
}
));
optionManager.add(new vimperator.Option(["hlsearch", "hls"], "boolean",
{
short_help: "Highlight previous search pattern matches",
shortHelp: "Highlight previous search pattern matches",
setter: function (value) { if (value) vimperator.search.highlight(); else vimperator.search.clear(); },
default_value: false
defaultValue: false
}
));
optionManager.add(new vimperator.Option(["hlsearchstyle", "hlss"], "string",
{
short_help: "CSS specification of highlighted search items",
default_value: "color: black; background-color: yellow; padding: 0; display: inline;"
shortHelp: "CSS specification of highlighted search items",
defaultValue: "color: black; background-color: yellow; padding: 0; display: inline;"
}
));
optionManager.add(new vimperator.Option(["ignorecase", "ic"], "boolean",
{
short_help: "Ignore case in search patterns",
default_value: true
shortHelp: "Ignore case in search patterns",
defaultValue: true
}
));
optionManager.add(new vimperator.Option(["incsearch", "is"], "boolean",
{
short_help: "Show where the search pattern matches as it is typed",
shortHelp: "Show where the search pattern matches as it is typed",
help: "NOTE: Incremental searching currently only works in the forward direction.",
default_value: true
defaultValue: true
}
));
optionManager.add(new vimperator.Option(["insertmode", "im"], "boolean",
{
short_help: "Use Insert mode as the default for text areas",
shortHelp: "Use Insert mode as the default for text areas",
help: "Makes Vimperator work in a way that Insert mode is the default mode for text areas. " +
"Useful if you want to use Vimperator as a modeless editor, keeping the known Firefox interface for editing text areas.",
default_value: true
defaultValue: true
}
));
optionManager.add(new vimperator.Option(["laststatus", "ls"], "number",
{
short_help: "Show the status line",
shortHelp: "Show the status line",
help: "Determines when the last window will have a status line. " +
"Possible values:<br/>" +
"<ul>" +
@@ -583,27 +583,27 @@ vimperator.Options = function () //{{{
"<li><b>2</b>: always</li>" +
"</ul>" +
"NOTE: laststatus=1 not implemented yet.",
default_value: 2,
defaultValue: 2,
setter: function (value) { setLastStatus(value); },
validator: function (value) { return (value >= 0 && value <= 2); }
}
));
optionManager.add(new vimperator.Option(["linksearch", "lks"], "boolean",
{
short_help: "Limit the search to hyperlink text",
shortHelp: "Limit the search to hyperlink text",
help: "This includes (X)HTML elements with an \"href\" atrribute and XLink \"simple\" links.",
default_value: false
defaultValue: false
}
));
optionManager.add(new vimperator.Option(["more"], "boolean",
{
short_help: "Pause the message list window when more than one screen of listings is displayed",
default_value: true
shortHelp: "Pause the message list window when more than one screen of listings is displayed",
defaultValue: true
}
));
optionManager.add(new vimperator.Option(["pageinfo", "pa"], "charlist",
{
short_help: "Desired info on :pa[geinfo]",
shortHelp: "Desired info on :pa[geinfo]",
help: "Available items:<br/>" +
"<ul>" +
"<li><b>g</b>: general info</li>" +
@@ -611,13 +611,13 @@ vimperator.Options = function () //{{{
"<li><b>m</b>: meta tags</li>" +
"</ul>" +
"The order matters",
default_value: "gfm",
defaultValue: "gfm",
validator: function (value) { return !(/[^gfm]/.test(value) || value.length > 3 || value.length < 1); }
}
));
optionManager.add(new vimperator.Option(["popups", "pps"], "number",
{
short_help: "Where to show requested popup windows",
shortHelp: "Where to show requested popup windows",
help: "Define where to show requested popup windows. Does not apply to windows which are opened by middle clicking a link, they always open in a new tab. " +
"Possible values:<br/>" +
"<ul>" +
@@ -627,48 +627,48 @@ vimperator.Options = function () //{{{
"<li><b>3</b>: Always open in a new window</li>" +
"</ul>" +
"NOTE: This option does not change the popup blocker of Firefox in any way.",
default_value: 1,
defaultValue: 1,
setter: function (value) { setPopups(value); },
validator: function (value) { return (value >= 0 && value <= 3); }
}
));
optionManager.add(new vimperator.Option(["preload"], "boolean",
{
short_help: "Speed up first time history/bookmark completion",
shortHelp: "Speed up first time history/bookmark completion",
help: "History access can be quite slow for a large history. Vimperator maintains a cache to speed it up significantly on subsequent access.<br/>" +
"In order to also speed up first time access, it is cached at startup, if this option is set (recommended).",
default_value: true
defaultValue: true
}
));
optionManager.add(new vimperator.Option(["previewheight", "pvh"], "number",
{
short_help: "Default height for preview window",
shortHelp: "Default height for preview window",
help: "Value must be between 1 and 50. If the value is too high, completions may cover the command-line. " +
"Close the preview window with <code class=\"command\">:pclose</code>.<br/>" +
"NOTE: Option currently disabled",
default_value: 10,
defaultValue: 10,
validator: function (value) { return (value >= 1 && value <= 50); }
}
));
optionManager.add(new vimperator.Option(["scroll", "scr"], "number",
{
short_help: "Number of lines to scroll with <code class=\"mapping\">C-u</code> and <code class=\"mapping\">C-d</code> commands",
shortHelp: "Number of lines to scroll with <code class=\"mapping\">C-u</code> and <code class=\"mapping\">C-d</code> commands",
help: "The number of lines scrolled defaults to half the window size. " +
"When a <code class=\"argument\">{count}</code> is specified to the <code class=\"mapping\">&lt;C-u&gt;</code> or <code class=\"mapping\">&lt;C-d&gt;</code> commands this is used to set the value of <code class=\"option\">'scroll'</code> and also used for the current command. " +
"The value can be reset to half the window height with <code class=\"command\">:set scroll=0</code>.",
default_value: 0,
defaultValue: 0,
validator: function (value) { return value >= 0; }
}
));
optionManager.add(new vimperator.Option(["showmode", "smd"], "boolean",
{
short_help: "Show the current mode in the command line",
default_value: true
shortHelp: "Show the current mode in the command line",
defaultValue: true
}
));
optionManager.add(new vimperator.Option(["showstatuslinks", "ssli"], "number",
{
short_help: "Show the destination of the link under the cursor in the status bar",
shortHelp: "Show the destination of the link under the cursor in the status bar",
help: "Also links which are focused by keyboard commands like <code class=\"mapping\">&lt;Tab&gt;</code> are shown. " +
"Possible values:<br/>" +
"<ul>" +
@@ -676,13 +676,13 @@ vimperator.Options = function () //{{{
"<li><b>1</b>: Show the link in the status line</li>" +
"<li><b>2</b>: Show the link in the command line</li>" +
"</ul>",
default_value: 1,
defaultValue: 1,
validator: function (value) { return (value >= 0 && value <= 2); }
}
));
optionManager.add(new vimperator.Option(["showtabline", "stal"], "number",
{
short_help: "Control when to show the tab bar of opened web pages",
shortHelp: "Control when to show the tab bar of opened web pages",
help: "Possible values:<br/>" +
"<ul>" +
"<li><b>0</b>: Never show tab bar</li>" +
@@ -690,55 +690,55 @@ vimperator.Options = function () //{{{
"<li><b>2</b>: Always show tab bar</li>" +
"</ul>",
setter: function (value) { setShowTabline(value); },
default_value: 2,
defaultValue: 2,
validator: function (value) { return (value >= 0 && value <= 2); }
}
));
optionManager.add(new vimperator.Option(["smartcase", "scs"], "boolean",
{
short_help: "Override the 'ignorecase' option if the pattern contains uppercase characters",
shortHelp: "Override the 'ignorecase' option if the pattern contains uppercase characters",
help: "This is only used if the <code class=\"option\">'ignorecase'</code> option is set.",
default_value: true
defaultValue: true
}
));
optionManager.add(new vimperator.Option(["titlestring"], "string",
{
short_help: "Change the title of the browser window",
shortHelp: "Change the title of the browser window",
help: "Vimperator changes the browser title from \"Title of web page - Mozilla Firefox\" to " +
"\"Title of web page - Vimperator\".<br/>If you don't like that, you can restore it with: " +
"<code class=\"command\">:set titlestring=Mozilla Firefox</code>.",
setter: function (value) { setTitleString(value); },
default_value: "Vimperator"
defaultValue: "Vimperator"
}
));
optionManager.add(new vimperator.Option(["usermode", "um"], "boolean",
{
short_help: "Show current website with a minimal style sheet to make it easily accessible",
shortHelp: "Show current website with a minimal style sheet to make it easily accessible",
help: "Note that this is a local option for now, later it may be split into a global and <code class=\"command\">:setlocal</code> part",
setter: function (value) { getMarkupDocumentViewer().authorStyleDisabled = value; },
getter: function () { return getMarkupDocumentViewer().authorStyleDisabled; },
default_value: false
defaultValue: false
}
));
optionManager.add(new vimperator.Option(["verbose", "vbs"], "number",
{
short_help: "Define which type of messages are logged",
shortHelp: "Define which type of messages are logged",
help: "When bigger than zero, Vimperator will give messages about what it is doing. They are printed to the error console which can be shown with <code class=\"command\">:javascript!</code>.<br/>" +
"The highest value is 9, being the most verbose mode.",
default_value: 0,
defaultValue: 0,
validator: function (value) { return (value >= 0 && value <= 9); }
}
));
optionManager.add(new vimperator.Option(["visualbell", "vb"], "boolean",
{
short_help: "Use visual bell instead of beeping on errors",
shortHelp: "Use visual bell instead of beeping on errors",
setter: function (value) { vimperator.options.setFirefoxPref("accessibility.typeaheadfind.enablesound", !value); },
default_value: false
defaultValue: false
}
));
optionManager.add(new vimperator.Option(["wildmode", "wim"], "stringlist",
{
short_help: "Define how command line completion works",
shortHelp: "Define how command line completion works",
help: "It is a comma-separated list of parts, where each part specifies " +
"what to do for each consecutive use of the completion key. The first part " +
"specifies the behavior for the first use of the completion key, the second part " +
@@ -753,7 +753,7 @@ vimperator.Options = function () //{{{
"<tr><td><b>'list:longest'</b></td><td>When more than one match, list all matches and complete till the longest common string.</td></tr>" +
"</table>" +
"When there is only a single match, it is fully completed regardless of the case.",
default_value: "list:full",
defaultValue: "list:full",
validator: function (value)
{
return value.split(",").every(function (item) { return /^(full|longest|list|list:full|list:longest|)$/.test(item); });
@@ -762,30 +762,30 @@ vimperator.Options = function () //{{{
));
optionManager.add(new vimperator.Option(["wildoptions", "wop"], "stringlist",
{
short_help: "Change how command line completion is done",
shortHelp: "Change how command line completion is done",
help: "A list of words that change how command line completion is done.<br/>" +
"Currently only one word is allowed:<br/>" +
"<table>" +
"<tr><td><b>sort</b></td><td>Always sorts completion list, overriding the <code class=\"option\">'complete'</code> option.</td></tr>" +
"</table>",
default_value: "",
defaultValue: "",
validator: function (value) { return /^(sort|)$/.test(value); }
}
));
optionManager.add(new vimperator.Option(["nextpattern"], "stringlist",
{
short_help: "String to search when looking for 'next' page in document relation",
shortHelp: "String to search when looking for 'next' page in document relation",
help: "Change it to make it look for another string in links when pressing ]n<br/>" +
"This value is case insensitive",
default_value: "\\bnext,^>$"
defaultValue: "\\bnext,^>$"
}
));
optionManager.add(new vimperator.Option(["previouspattern"], "stringlist",
{
short_help: "String to search when looking for 'prev' page in document relation",
shortHelp: "String to search when looking for 'prev' page in document relation",
help: "Change it to make it look for another string in links when pressing ]p<br/>" +
"This value is case insensitive",
default_value: "\\bprev,previous\\b,^<$"
defaultValue: "\\bprev,previous\\b,^<$"
}
));
//}}}
@@ -795,7 +795,7 @@ vimperator.Options = function () //{{{
setShowTabline(0);
setGuiOptions("");
setLastStatus(0);
guioptions_done = showtabline_done = laststatus_done = false;
guioptionsDone = showtablineDone = laststatusDone = false;
setTitleString(optionManager.titlestring);
setPopups(optionManager.popups);

View File

@@ -145,9 +145,9 @@ vimperator.Tabs = function () //{{{
getBrowser().moveTabTo(tab, index);
},
// quit_on_last_tab = 1: quit without saving session
// quit_on_last_tab = 2: quit and save session
remove: function (tab, count, focus_left_tab, quit_on_last_tab)
// quitOnLastTab = 1: quit without saving session
// quitOnLastTab = 2: quit and save session
remove: function (tab, count, focusLeftTab, quitOnLastTab)
{
function removeOrBlankTab (tab)
{
@@ -169,26 +169,26 @@ vimperator.Tabs = function () //{{{
if (count < 1)
count = 1;
if (quit_on_last_tab >= 1 && getBrowser().mTabs.length <= count)
if (quitOnLastTab >= 1 && getBrowser().mTabs.length <= count)
{
if (vimperator.windows.length > 1)
window.close();
else
vimperator.quit(quit_on_last_tab == 2);
vimperator.quit(quitOnLastTab == 2);
return;
}
var index = this.index(tab);
if (focus_left_tab)
if (focusLeftTab)
{
var last_removed_tab = 0;
var lastRemovedTab = 0;
for (var i = index; i > index - count && i >= 0; i--)
{
removeOrBlankTab(this.getTab(i));
last_removed_tab = i > 0 ? i : 1;
lastRemovedTab = i > 0 ? i : 1;
}
getBrowser().mTabContainer.selectedIndex = last_removed_tab - 1;
getBrowser().mTabContainer.selectedIndex = lastRemovedTab - 1;
}
else
{
@@ -226,9 +226,9 @@ vimperator.Tabs = function () //{{{
alternates = [this.getTab(), alternates[0]];
},
reload: function (tab, bypass_cache)
reload: function (tab, bypassCache)
{
if (bypass_cache)
if (bypassCache)
{
const nsIWebNavigation = Components.interfaces.nsIWebNavigation;
const flags = nsIWebNavigation.LOAD_FLAGS_BYPASS_PROXY | nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
@@ -240,15 +240,15 @@ vimperator.Tabs = function () //{{{
}
},
reloadAll: function (bypass_cache)
reloadAll: function (bypassCache)
{
if (bypass_cache)
if (bypassCache)
{
for (var i = 0; i < getBrowser().mTabs.length; i++)
{
try
{
this.reload(getBrowser().mTabs[i], bypass_cache);
this.reload(getBrowser().mTabs[i], bypassCache);
}
catch (e)
{

File diff suppressed because it is too large Load Diff

View File

@@ -27,6 +27,7 @@ the terms of any one of the MPL, the GPL or the LGPL.
}}} ***** END LICENSE BLOCK *****/
vimperator.util = {
escapeHTML: function (str)
{
// XXX: the following code is _much_ slower than a simple .replace()
@@ -39,9 +40,9 @@ vimperator.util = {
},
// TODO: use :highlight color groups
// if "process_strings" is true, any passed strings will be surrounded by " and
// if "processStrings" is true, any passed strings will be surrounded by " and
// any line breaks are displayed as \n
colorize: function (arg, process_strings)
colorize: function (arg, processStrings)
{
var type = typeof arg;
@@ -54,7 +55,7 @@ vimperator.util = {
}
else if (type == "string")
{
if (process_strings)
if (processStrings)
arg = '"' + vimperator.util.escapeHTML(arg.replace(/\n/, "\\n")) + '"';
return "<span style=\"color: green;\">" + arg + "</span>";
@@ -97,7 +98,7 @@ vimperator.util = {
begin: for (var url = 0; url < urls.length; url++)
{
var new_url = vimperator.buffer.URL;
var newURL = vimperator.buffer.URL;
var matches;
// strip each 'URL' - makes things simpler later on
@@ -108,13 +109,13 @@ vimperator.util = {
if (matches = urls[url].match(/^(?:\.$|\.\/(\S*))/))
{
var tail = matches[1] || "";
urls[url] = new_url.replace(/(.+\/)[^\/]*/, "$1" + tail); // NOTE: escape / in character sets so as not to break Vim syntax highlighting
urls[url] = newURL.replace(/(.+\/)[^\/]*/, "$1" + tail); // NOTE: escape / in character sets so as not to break Vim syntax highlighting
continue;
}
else if (matches = urls[url].match(/^(?:\.\.$|\.\.\/(\S*))/))
{
var tail = matches[1] || "";
urls[url] = new_url.replace(/(.+\/)[^\/]*/, "$1../" + tail);
urls[url] = newURL.replace(/(.+\/)[^\/]*/, "$1../" + tail);
continue;
}
else if (matches = urls[url].match(/^(?:\.\.\.$|\.\.\.\/(\S*))/))
@@ -142,18 +143,18 @@ vimperator.util = {
// like the comments below ;-)
// check if the first word is a search engine
var search_url = vimperator.bookmarks.getSearchURL(text, alias);
if (search_url/* && search_url.length >= 1*/)
var searchURL = vimperator.bookmarks.getSearchURL(text, alias);
if (searchURL/* && searchURL.length >= 1*/)
{
urls[url] = search_url;
urls[url] = searchURL;
continue;
}
else // the first word was not a search engine, search for the whole string in the default engine
{
search_url = vimperator.bookmarks.getSearchURL(urls[url], null);
if (search_url/* && search_url.length >= 1*/)
searchURL = vimperator.bookmarks.getSearchURL(urls[url], null);
if (searchURL/* && searchURL.length >= 1*/)
{
urls[url] = search_url;
urls[url] = searchURL;
continue;
}
}
@@ -206,6 +207,7 @@ vimperator.util = {
return strNum[0] + " " + unitVal[unitIndex];
}
};
// vim: set fdm=marker sw=4 ts=4 et:

View File

@@ -33,11 +33,11 @@ const vimperator = (function () //{{{
/////////////////////////////////////////////////////////////////////////////{{{
// our services
var sound_service = Components.classes["@mozilla.org/sound;1"]
var soundService = Components.classes["@mozilla.org/sound;1"]
.getService(Components.interfaces.nsISound);
var console_service = Components.classes["@mozilla.org/consoleservice;1"]
var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces.nsIConsoleService);
var environment_service = Components.classes["@mozilla.org/process/environment;1"]
var environmentService = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
var callbacks = [];
@@ -107,7 +107,7 @@ const vimperator = (function () //{{{
}
else
{
sound_service.beep();
soundService.beep();
}
},
@@ -296,7 +296,7 @@ const vimperator = (function () //{{{
if (typeof msg == "object")
msg = this.objectToString(msg, false);
console_service.logStringMessage("vimperator: " + msg);
consoleService.logStringMessage("vimperator: " + msg);
},
// open one or more URLs
@@ -369,9 +369,9 @@ const vimperator = (function () //{{{
},
// quit vimperator, no matter how many tabs/windows are open
quit: function (save_session)
quit: function (saveSession)
{
if (save_session)
if (saveSession)
vimperator.options.setFirefoxPref("browser.startup.page", 3); // start with saved session
else
vimperator.options.setFirefoxPref("browser.startup.page", 1); // start with default homepage session
@@ -428,7 +428,7 @@ const vimperator = (function () //{{{
}
catch (e)
{
var dirs = environment_service.get("PATH").split(WINDOWS ? ";" : ":");
var dirs = environmentService.get("PATH").split(WINDOWS ? ";" : ":");
for (var i = 0; i < dirs.length; i++)
{
var path = dirs[i] + (WINDOWS ? "\\" : "/") + program;
@@ -522,16 +522,16 @@ const vimperator = (function () //{{{
else
{
var heredoc = "";
var heredoc_end = null; // the string which ends the heredoc
var heredocEnd = null; // the string which ends the heredoc
str.split("\n").forEach(function (line)
{
if (heredoc_end) // we already are in a heredoc
if (heredocEnd) // we already are in a heredoc
{
if (heredoc_end.test(line))
if (heredocEnd.test(line))
{
eval("with(vimperator){" + heredoc + "}");
heredoc = "";
heredoc_end = null;
heredocEnd = null;
}
else
{
@@ -548,7 +548,7 @@ const vimperator = (function () //{{{
var matches = args.match(/(.*)<<\s*([^\s]+)$/);
if (matches)
{
heredoc_end = new RegExp("^" + matches[2] + "$", "m");
heredocEnd = new RegExp("^" + matches[2] + "$", "m");
if (matches[1])
heredoc = matches[1] + "\n";
}
@@ -596,9 +596,9 @@ const vimperator = (function () //{{{
vimperator.log("Loading module search...", 3);
vimperator.search = vimperator.Search();
vimperator.log("Loading module preview window...", 3);
vimperator.previewwindow = vimperator.InformationList("vimperator-previewwindow", { incremental_fill: false, max_items: 10 });
vimperator.previewwindow = vimperator.InformationList("vimperator-previewwindow", { incrementalFill: false, maxItems: 10 });
vimperator.log("Loading module buffer window...", 3);
vimperator.bufferwindow = vimperator.InformationList("vimperator-bufferwindow", { incremental_fill: false, max_items: 10 });
vimperator.bufferwindow = vimperator.InformationList("vimperator-bufferwindow", { incrementalFill: false, maxItems: 10 });
vimperator.log("Loading module mappings...", 3);
vimperator.mappings = vimperator.Mappings();
vimperator.log("Loading module statusline...", 3);
@@ -650,20 +650,20 @@ const vimperator = (function () //{{{
// make sourcing asynchronous, otherwise commands that open new tabs won't work
setTimeout(function () {
var rc_file = vimperator.io.getRCFile();
var rcFile = vimperator.io.getRCFile();
if (rc_file)
vimperator.source(rc_file.path, true);
if (rcFile)
vimperator.source(rcFile.path, true);
else
vimperator.log("No user RC file found", 3);
// also source plugins in ~/.vimperator/plugin/
try
{
var plugin_dir = vimperator.io.getPluginDir();
if (plugin_dir)
var pluginDir = vimperator.io.getPluginDir();
if (pluginDir)
{
var files = vimperator.io.readDirectory(plugin_dir.path);
var files = vimperator.io.readDirectory(pluginDir.path);
vimperator.log("Sourcing plugin directory...", 3);
files.forEach(function (file) {
if (!file.isDirectory() && /\.(js|vimp)$/i.test(file.path))