throttle playSound

This commit is contained in:
Thibault Duplessis 2013-06-11 02:29:11 +02:00
parent 0e8ce345c6
commit 59fb081808
2 changed files with 4 additions and 2 deletions

View file

@ -664,7 +664,7 @@ var lichess_sri = Math.random().toString(36).substring(5); // 8 chars
return $soundToggle.hasClass("sound_state_on");
}
$.playSound = function() {
$.playSound = _.throttle(function() {
if (canPlayAudio && soundEnabled()) {
var sound = $('#lichess_sound_player').get(0);
sound.play();
@ -673,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')));

2
todo
View file

@ -66,6 +66,8 @@ 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
---