//function to set the right buttons in the rroliveControls function setRroliveControls(){ if(parent.Player.lastPlayedId != ''){ if(parent.Player.players[parent.Player.lastPlayedId] == "stopped"){ document.getElementById("rrolivePlayOrange").style.display="none"; document.getElementById("rrolivePlayGrey").style.display="inline-block"; document.getElementById("rrolivePause").style.display="none"; document.getElementById("rroliveStopGrey").style.display="inline-block"; document.getElementById("rroliveStopOrange").style.display="none"; } else if(parent.Player.players[parent.Player.lastPlayedId] == "paused"){ document.getElementById("rrolivePlayOrange").style.display="inline-block"; document.getElementById("rrolivePlayGrey").style.display="none"; document.getElementById("rrolivePause").style.display="none"; document.getElementById("rroliveStopGrey").style.display="none"; document.getElementById("rroliveStopOrange").style.display="inline-block"; } else{ document.getElementById("rrolivePlayOrange").style.display="none"; document.getElementById("rrolivePlayGrey").style.display="none"; document.getElementById("rrolivePause").style.display="inline-block"; document.getElementById("rroliveStopGrey").style.display="none"; document.getElementById("rroliveStopOrange").style.display="inline-block"; } } } function surfaceFrameReadyFunction(){ //detect if the page is loaded in a frame. if(window.self !== window.top){ //just execute this code, if both frames are fully loaded //if(parent.Player.document.readyState == "complete"){ if(parent.Player.document.readyState == "complete"){ //if rrolive is called in the frame "Surface", color the actual player, to see which radio is playing at the moment if(/rrolive/.test(location.href)){ parent.Player.colorPlayers(); } //detect if a link is clicked $('a').click(function(event){ //if the link is rrolive, add the parameter frame=yes, otherwise there will be frame in frame in frame... if( /rrolive/.test($(this).attr('href'))){ event.preventDefault(); location.href = "http://www.rro.ch/mobile14/rroliveIOS/?frame=no"; } //if the link refers to somewhere on the mobile site and no radio has yet been played, open the link in the parent else if( /rro.ch\/mobile/.test($(this).attr('href')) && parent.Player.lastPlayedId == ''){ event.preventDefault(); parent.location.href = $(this).attr('href'); } }); //show the controls in the navigation if any radio has been played if(parent.Player.lastPlayedId != ''){ $("#rroliveControls").show(); setRroliveControls(); } //if pause or is clicked pause or play the radio $("#rrolivePlayOrange, #rrolivePlayGrey, #rrolivePause").click(function(){ parent.Player.playPause(parent.Player.lastPlayedId); }); //stop: reload the whole page, so no frames are there anymore $("#rroliveStopOrange, #rroliveStopGrey").click(function(){ if(/rrolive/.test(location.href)){ parent.location.reload(); } else{ parent.location.href = location.href; } }); } else { setTimeout("surfaceFrameReadyFunction()", 300); } } } $( document ).ready(function() { surfaceFrameReadyFunction(); });