blob: 2d6f79101670bbc1c4879abb901fd73f4e0a2b61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
function setupTypeahead() {
$('#pkgsearch-field').typeahead({
source: function(query, callback) {
$.getJSON('/opensearch/packages/suggest', {q: query}, function(data) {
callback(data[1]);
});
},
matcher: function(item) { return true; },
sorter: function(items) { return items; },
menu: '<ul class="pkgsearch-typeahead"></ul>',
items: 10,
updater: function(item) {
$('#pkgsearch-field').val(item);
$('#pkgsearch-form').submit();
return item;
}
}).attr('autocomplete', 'off');
$('#pkgsearch-field').keyup(function(e) {
if (e.keyCode === 13 &&
$('ul.pkgsearch-typeahead li.active').size() === 0) {
$('#pkgsearch-form').submit();
}
});
}
function setupKonami(image_src) {
var konami = new Konami(function() {
$('#konami').html('<img src="' + image_src + '" alt=""/>');
setTimeout(function() {
$('#konami').fadeIn(500);
}, 500);
$('#konami').click(function() {
$('#konami').fadeOut(500);
});
});
}
|