diff options
author | Dan McGee <dan@archlinux.org> | 2014-10-21 21:12:24 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2014-10-21 21:12:24 -0500 |
commit | abb3a507a1e8f218b5225d3e00187808e323e48a (patch) | |
tree | 1af46dec2474ec0914c2eafa6f1e22b2e656c611 /templates | |
parent | d009cd0b5c4ba018681942daa59452fe2b1a42c2 (diff) |
Move all homepage JavaScript into single file
We had two small files plus a handful of inline stuff in the HTML; move
as much of it as possible into a single static file.
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/public/index.html | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/templates/public/index.html b/templates/public/index.html index 89486be8..d815363b 100644 --- a/templates/public/index.html +++ b/templates/public/index.html @@ -214,44 +214,8 @@ {% load cdn %}{% jquery %} <script type="text/javascript"> -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() { - var konami = new Konami(function() { - $('#konami').html('<img src="{% static "vector_tux.png" %}" alt=""/>'); - setTimeout(function() { - $('#konami').fadeIn(500); - }, 500); - $('#konami').click(function() { - $('#konami').fadeOut(500); - }); - }); -} $(document).ready(function() { - $.ajax({ url: "{% static "bootstrap-typeahead.min.js" %}", cache: true, dataType: "script", success: setupTypeahead }); - $.ajax({ url: "{% static "konami.min.js" %}", cache: true, dataType: "script", success: setupKonami }); + $.ajax({ url: "{% static "homepage.js" %}", cache: true, dataType: "script", success: function() { setupTypeahead(); setupKonami("{% static "vector_tux.png" %}"); } }); }); </script> {% endblock %} |