-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Autocomplete brands and models
The database is crowded with bogus entries (see #90). Here's a prototype of autocompletion for watch brands and models. You can try it out by typing 'j' in the brand, it will suggests 'Java', 'Javascript' and 'Clojure' because they all contain a 'j'. If 'Java' is choosen, then a 'n' in the model input will suggests 'Niark'. It also works for 'Scala' -> 'Plop'. @VS2000, I need supported brands and models of each brand to complete this.
- Loading branch information
1 parent
b110b43
commit 5e5115a
Showing
4 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
$(function() { | ||
var availableBrands = [ | ||
"ActionScript", | ||
"AppleScript", | ||
"Asp", | ||
"BASIC", | ||
"C", | ||
"C++", | ||
"Clojure", | ||
"COBOL", | ||
"ColdFusion", | ||
"Erlang", | ||
"Fortran", | ||
"Groovy", | ||
"Haskell", | ||
"Java", | ||
"JavaScript", | ||
"Lisp", | ||
"Perl", | ||
"PHP", | ||
"Python", | ||
"Ruby", | ||
"Scala", | ||
"Scheme" | ||
]; | ||
|
||
var availableModelsByBrand = {}; | ||
availableModelsByBrand["Java"] = ["Niark"]; | ||
availableModelsByBrand["Scala"] = ["Plop"]; | ||
|
||
$( "#brand" ).autocomplete({ | ||
source: availableBrands, | ||
autoFill: true, | ||
select: function (event, ui){ | ||
console.log(ui.item.value); | ||
var brand = ui.item.value; | ||
|
||
$("#model").autocomplete({ | ||
autoFill: true, | ||
source: availableModelsByBrand[brand] | ||
}); | ||
} | ||
}); | ||
}); |