diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-06-21 16:38:27 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-06-21 16:38:27 +0000 |
commit | fbab0ebea531927baf98e6144599057db464c49b (patch) | |
tree | 94d18a10ad3f4cb2b6a7f5416524191f0bb378a5 /templates/javascript_refresh.inc | |
parent | 280ee86ed799fbc39139c46b49d43cfc150ddae4 (diff) | |
download | ampache-fbab0ebea531927baf98e6144599057db464c49b.tar.gz ampache-fbab0ebea531927baf98e6144599057db464c49b.tar.bz2 ampache-fbab0ebea531927baf98e6144599057db464c49b.zip |
fixed nowplaying refresh issues and switched it to div layout
Diffstat (limited to 'templates/javascript_refresh.inc')
-rw-r--r-- | templates/javascript_refresh.inc | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/templates/javascript_refresh.inc b/templates/javascript_refresh.inc deleted file mode 100644 index d8d56a67..00000000 --- a/templates/javascript_refresh.inc +++ /dev/null @@ -1,94 +0,0 @@ -<script type="text/javascript" language="javascript"> -<!-- Begin -// when a page/song is loaded, we get starttime and mpd_elapsed. -// mpd_elapsed is # of seconds elapsed in the now playing song when the page/song was refreshed -// secondssinceloaded is the calculated number of seconds since mpd_elapsed was set (less some load & execute lag). - -// Set refresh interval (in seconds) -var refreshinterval=<?php echo conf('refresh_limit'); ?>; -var web_path = "<?php echo conf('web_path');?>"; - -<?php -if ($user->prefs['play_type'] == 'mpd') { - echo 'var player = "mpd"' . - '; var mpd_elapsed = '. $myMpd->current_track_position . - '; var mpd_song_length = '. $myMpd->current_track_length . - '; var mpd_songid = 0'.$myMpd->current_track_id. - '; var mpdpl_first = 0' . -// $myMpd->current_track_id-1 . - '; var player_state = "'. $myMpd->state .'";'; -} else { - echo 'var player = "'. $user->prefs['play_type'] . - '"; var player_state = "";'; -} -?> - - -// Display the countdown inside the status bar? -// Set "1" for yes or "0" for no -var displaycountdown=1 - -// main-code -var starttime -var nowtime -var reloadseconds=0 -var secondssinceloaded=0 -//var mpd_notstoppause=1 - -function starttime() { - starttime=new Date() - starttime=starttime.getTime() -// if (player_state == "stop" || player_state == "pause") { mpd_notstoppause = 0; } - countdown() -} - -function fmt_time (timenum) { -var sec = Math.floor(timenum % 60); -return Math.floor((1/60) * timenum) + ':' + ((sec < 10) ? '0' : '') + sec; - -} - -function countdown() { - nowtime= new Date() - nowtime=nowtime.getTime() - secondssinceloaded=(nowtime-starttime)/1000 - - if (player_state == 'play') { - reloadseconds = Math.round(mpd_song_length - mpd_elapsed - secondssinceloaded) - } - else - { reloadseconds = Math.round(refreshinterval - secondssinceloaded) } - - if (displaycountdown==1) { - window.status="Refreshing in "+reloadseconds+" seconds"; - if ((player == 'mpd') && (player_state == 'play')) { - if (NodeList = document.getElementById ('mpd_cur_track_pos')) - { NodeList.firstChild.data = fmt_time((mpd_elapsed) + (secondssinceloaded)); } - if (NodeList = document.getElementById ('mpd_on_deck_in')) - { NodeList.firstChild.data = fmt_time (mpd_song_length - mpd_elapsed - secondssinceloaded); } - if (NodeList = document.getElementById ('mpd_pctplayed')) - { NodeList.firstChild.data = Math.floor (100*(mpd_elapsed + secondssinceloaded)/mpd_song_length); } - } - if (reloadseconds > 0) { - var timer=setTimeout("countdown()",1000) - } - else { - clearTimeout(timer) - if (true) { /* rig it for AJAX for now; later replace with conf('AJAX') */ - startRequest('action=now_playing'); - starttime = new Date(); - starttime=starttime.getTime() - var timer=setTimeout("countdown()",1000) - } - else { - window.location.reload(true) - } - } //if reloadseconds > 0 - } // if displaycountdown -} - -// start with page-load -window.onload=starttime -// End --> -</script> - |