add typeahead for tournament names
[mlpccg-meta.git] / meta / static / js / main.js
1 function rateDeck() {
2 $.getJSON('/meta/rate', {url: $('#ponyheadURL').val()}, function(data) {
3 console.log(data);
4 });
5 }
6
7 var tournaments = new Bloodhound({
8 datumTokenizer: Bloodhound.tokenizers.obj.nonword('name'),
9 queryTokenizer: Bloodhound.tokenizers.nonword,
10 prefetch: '/meta/tournaments'
11 });
12
13 tournaments.initialize();
14
15 $(document).ready(function() {
16 $('.typeahead-tournaments').typeahead(null, {
17 name: 'tournaments',
18 displayKey: 'name',
19 source: tournaments.ttAdapter()
20 });
21 });