}
// Check the version of playlist to see if update is needed.
- setInterval(function(){
+ var update_interval_id = null;
+ function update() {
$.ajax({
type: 'POST',
url : 'post',
playlist_ver = data.ver;
}
updateControls(data);
+ if (data.play) {
+ clearInterval(update_interval_id);
+ update_interval_id = setInterval(update, 1000);
+ } else {
+ clearInterval(update_interval_id);
+ update_interval_id = setInterval(update, 3000);
+ }
}
}
});
- } , 1000);
+ }
+ update_interval_id = setInterval(update, 3000);
themeInit();
$(document).ready(updatePlaylist);