From ebbbd2409783f3a2146024ff89fb9390372ad93c Mon Sep 17 00:00:00 2001 From: Martin Stubenschrott Date: Mon, 16 Jun 2008 13:19:25 +0000 Subject: [PATCH] added "custom" for hintmatching, thanks trapezoid --- content/hints.js | 3 ++- locale/en-US/options.txt | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/content/hints.js b/content/hints.js index 9e67424e..0f992177 100644 --- a/content/hints.js +++ b/content/hints.js @@ -535,6 +535,7 @@ liberator.Hints = function () //{{{ case "contains" : return containsMatcher(hintString); case "wordstartswith": return wordStartsWithMatcher(hintString, /*allowWordOverleaping=*/ true); case "firstletters" : return wordStartsWithMatcher(hintString, /*allowWordOverleaping=*/ false); + case "custom" : return liberator.plugins.customHintMatcher(hintString); default : liberator.echoerr("Invalid hintmatching type: " + hintMatching); } return null; @@ -588,7 +589,7 @@ liberator.Hints = function () //{{{ "How links are matched", "string", "contains", { - validator: function (value) { return /^contains|wordstartswith|firstletters$/.test(value); } + validator: function (value) { return /^(?:contains|wordstartswith|firstletters|custom)$/.test(value); } }); liberator.options.add(["wordseparators", "wsp"], diff --git a/locale/en-US/options.txt b/locale/en-US/options.txt index 554987e5..b5d81cf6 100644 --- a/locale/en-US/options.txt +++ b/locale/en-US/options.txt @@ -241,6 +241,7 @@ Change the hint matching algorithm during hint mode. Possible values: *contains* The typed characters are splitted by spaces, and these character groups have to be anywhere inside the text of the link. *wordstartswith* The typed characters are matched with the beginning of the first word (see 'wordseparators') in the link as long as possible. If no more or no character matches in the current word, than the matching is continued at the beginning of the next word. The words are worked through in the order they appear in the link. If the typed characters contain spaces, than the characters are splitted by spaces. These character groups are than matched with the beginning of the words, beginning at the first one and continuing with the following words in the order they appear in the link. *firstletters* Behaves almost as wordstartswith, but non matching words aren't overleaped. +*custom* Delegate to a custom function: liberator.plugins.customHintMatcher(hintString) ----------------------------------------------------------------------------------------------------------------------------------------------------- ____