mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 01:51:40 -05:00
Add regex test to main
Just playing with various autocomplete options
This commit is contained in:
parent
5bb3f5e026
commit
687483f313
1 changed files with 13 additions and 0 deletions
|
@ -78,6 +78,19 @@ The following functions all talk to the content.js script to perform functions t
|
||||||
|
|
||||||
browser.browserAction.onClicked.addListener(handleBrowserAction)
|
browser.browserAction.onClicked.addListener(handleBrowserAction)
|
||||||
|
|
||||||
|
## Regex test
|
||||||
|
|
||||||
|
Adapted from http://www.dustindiaz.com/autocomplete-fuzzy-matching
|
||||||
|
|
||||||
|
tridactyl.mystrings = mystrings = ["colin", "olie", "jake", "harri"]
|
||||||
|
tridactyl.func.matchString = matchString = (input) ->
|
||||||
|
search = new RegExp(input.split('').join('\\w*').replace(/\W/, ""), 'i')
|
||||||
|
mystrings.filter((string) ->
|
||||||
|
if string.match(search)
|
||||||
|
return string
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
## Finish the Tridactyl namespace and initialise it
|
## Finish the Tridactyl namespace and initialise it
|
||||||
|
|
||||||
tridactyl.func.__init__()
|
tridactyl.func.__init__()
|
||||||
|
|
Loading…
Add table
Reference in a new issue