diff --git a/common/content/find.js b/common/content/finder.js similarity index 95% rename from common/content/find.js rename to common/content/finder.js index a050a6b0..765dc170 100644 --- a/common/content/find.js +++ b/common/content/finder.js @@ -37,13 +37,12 @@ the terms of any one of the MPL, the GPL or the LGPL. // : 'linksearch' searches should highlight link matches only // : changing any search settings should also update the search state including highlighting // : incremental searches shouldn't permanently update search modifiers -// : normalise the use of "search" vs "find" and rename callbacks // make sure you only create this object when the "liberator" object is ready /** - * @instance search + * @instance finder */ -function Search() //{{{ +function Finder() //{{{ { //////////////////////////////////////////////////////////////////////////////// ////////////////////// PRIVATE SECTION ///////////////////////////////////////// @@ -62,13 +61,13 @@ function Search() //{{{ var linksOnly = false; // search is limited to link text only // Event handlers for search - closure is needed - liberator.registerCallback("change", modes.SEARCH_FORWARD, function (str) { search.onKeyPress(str); }); - liberator.registerCallback("submit", modes.SEARCH_FORWARD, function (str) { search.onSubmit(str); }); - liberator.registerCallback("cancel", modes.SEARCH_FORWARD, function () { search.onCancel(); }); + liberator.registerCallback("change", modes.SEARCH_FORWARD, function (str) { finder.onKeyPress(str); }); + liberator.registerCallback("submit", modes.SEARCH_FORWARD, function (str) { finder.onSubmit(str); }); + liberator.registerCallback("cancel", modes.SEARCH_FORWARD, function () { finder.onCancel(); }); // TODO: allow advanced myModes in register/triggerCallback - liberator.registerCallback("change", modes.SEARCH_BACKWARD, function (str) { search.onKeyPress(str); }); - liberator.registerCallback("submit", modes.SEARCH_BACKWARD, function (str) { search.onSubmit(str); }); - liberator.registerCallback("cancel", modes.SEARCH_BACKWARD, function () { search.onCancel(); }); + liberator.registerCallback("change", modes.SEARCH_BACKWARD, function (str) { finder.onKeyPress(str); }); + liberator.registerCallback("submit", modes.SEARCH_BACKWARD, function (str) { finder.onSubmit(str); }); + liberator.registerCallback("cancel", modes.SEARCH_BACKWARD, function () { finder.onCancel(); }); // set searchString, searchPattern, caseSensitive, linksOnly function processUserPattern(pattern) @@ -267,9 +266,9 @@ function Search() //{{{ setter: function (value) { if (value) - search.highlight(); + finder.highlight(); else - search.clear(); + finder.clear(); return value; } @@ -300,19 +299,19 @@ function Search() //{{{ mappings.add(myModes, ["/"], "Search forward for a pattern", - function () { search.openPrompt(modes.SEARCH_FORWARD); }); + function () { finder.openPrompt(modes.SEARCH_FORWARD); }); mappings.add(myModes, ["?"], "Search backwards for a pattern", - function () { search.openPrompt(modes.SEARCH_BACKWARD); }); + function () { finder.openPrompt(modes.SEARCH_BACKWARD); }); mappings.add(myModes, ["n"], "Find next", - function () { search.findAgain(false); }); + function () { finder.findAgain(false); }); mappings.add(myModes, ["N"], "Find previous", - function () { search.findAgain(true); }); + function () { finder.findAgain(true); }); mappings.add(myModes.concat([modes.CARET, modes.TEXTAREA]), ["*"], "Find word under cursor", @@ -322,7 +321,7 @@ function Search() //{{{ let word = buffer.getCurrentWord(); // A hacky way to move after the current match before searching forwards window.content.getSelection().getRangeAt(0).collapse(false); - search.onSubmit(word, false) + finder.onSubmit(word, false) }); mappings.add(myModes.concat([modes.CARET, modes.TEXTAREA]), ["#"], @@ -333,7 +332,7 @@ function Search() //{{{ let word = buffer.getCurrentWord(); // A hacky way to move before the current match before searching backwards window.content.getSelection().getRangeAt(0).collapse(true); - search.onSubmit(word, true) + finder.onSubmit(word, true) }); /////////////////////////////////////////////////////////////////////////////}}} @@ -342,7 +341,7 @@ function Search() //{{{ commands.add(["noh[lsearch]"], "Remove the search highlighting", - function () { search.clear(); }, + function () { finder.clear(); }, { argCount: "0" }); /////////////////////////////////////////////////////////////////////////////}}} @@ -477,7 +476,7 @@ function Search() //{{{ // TODO: move to find() when reverse incremental searching is kludged in // need to find again for reverse searching if (backwards) - setTimeout(function () { search.findAgain(false); }, 0); + setTimeout(function () { finder.findAgain(false); }, 0); if (options["hlsearch"]) this.highlight(searchString); diff --git a/common/content/liberator-overlay.js b/common/content/liberator-overlay.js index 73431da4..d7890d8a 100644 --- a/common/content/liberator-overlay.js +++ b/common/content/liberator-overlay.js @@ -41,7 +41,7 @@ "completion.js", "editor.js", "events.js", - "find.js", + "finder.js", "hints.js", "io.js", "mappings.js", diff --git a/vimperator/content/config.js b/vimperator/content/config.js index 64165c86..91956be8 100644 --- a/vimperator/content/config.js +++ b/vimperator/content/config.js @@ -165,7 +165,7 @@ const config = { //{{{ // or we could just make sure that they're all sourced in order. // The scripts could even just instantiate them themselves. // --Kris - liberator.loadModule("search", Search); + liberator.loadModule("finder", Finder); liberator.loadModule("bookmarks", Bookmarks); liberator.loadModule("history", History); liberator.loadModule("tabs", Tabs); diff --git a/xulmus/content/config.js b/xulmus/content/config.js index 579fa979..8f2ea42f 100644 --- a/xulmus/content/config.js +++ b/xulmus/content/config.js @@ -263,7 +263,7 @@ const config = { //{{{ // or we could just make sure that they're all sourced in order. // The scripts could even just instantiate them themselves. // --Kris - liberator.loadModule("search", Search); + liberator.loadModule("finder", Finder); liberator.loadModule("bookmarks", Bookmarks); liberator.loadModule("history", History); liberator.loadModule("tabs", Tabs);