]> git.0d.be Git - earwig.git/blob - earwig/static/js/earwig.js
0001e8bd8722e2e6179a4f36ed18126d1b1af6ed
[earwig.git] / earwig / static / js / earwig.js
1 $(function() {
2   $('#content').delegate('div.tile a', 'click', function() {
3     $('header').removeClass('hidden');
4     $('header #cover').css('background-image', $(this).parent().css('background-image'));
5     $('header #title').text($(this).find('.channel').text() + ' - ' + $(this).find('.sound').text());
6     $('audio').empty();
7     var source = $('<source>', {src: $(this).data('sound-uri')});
8     $('audio').append(source);
9     $('audio')[0].pause();
10     $('audio')[0].load();
11     $('audio')[0].play();
12   });
13   $('#filter').on('submit', function() {
14     $.ajax({
15       url: '/',
16       data: {q: $('#filter input').val()}
17     }).done(function(result) {
18       $('#content').html($(result).find('div.tile'));
19     });
20     return false;
21   });
22 });