play sound on arriving challenge

This commit is contained in:
Thibault Duplessis 2013-06-11 12:50:21 +02:00
parent d1b4f03457
commit b4eb16caa4
2 changed files with 4 additions and 4 deletions

View file

@ -293,13 +293,14 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
}
},
challengeReminder: function(data) {
if (!$('div.lichess_overboard.joining').length) {
if (!localStorage.getItem('challenge-refused-'+data.id) && !$('div.lichess_overboard.joining').length) {
$('#challenge_reminder').each(function() {
clearTimeout($(this).data('timeout'));
$(this).remove();
});
$('div.notifications').append(data.html).find("a.decline").click(function() {
$.post($(this).attr("href"));
localStorage.setItem('challenge-refused-'+data.id, 1)
$('#challenge_reminder').remove();
return false;
});
@ -663,7 +664,7 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
return $soundToggle.hasClass("sound_state_on");
}
$.playSound = _.throttle(function() {
$.playSound = function() {
if (canPlayAudio && soundEnabled()) {
var sound = $('#lichess_sound_player').get(0);
sound.play();
@ -672,7 +673,7 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
},
1000);
}
}, 1500);
};
if (canPlayAudio) {
$('body').append($('<audio id="lichess_sound_player">').attr('src', $('body').attr('data-sound-file')));

1
todo
View file

@ -66,7 +66,6 @@ show friend games in homepage board
allow to filter anon
replace plot with watch plot when game starts
lobby table sort
sound when challenged
disable unused websocket hijack protection
---