
    /* Cache version: 20210304T093755 */
    /* Included files: sites/rts.ui.media-player.js,sites/rts.ui.player.js,player-popup.js */




    function JSCompiler_emptyFn(){return function(){}}function JSCompiler_get(JSCompiler_get_name){return function(){return this[JSCompiler_get_name]}}
(function($,undefined){if(!$.widget)throw new Error("Widget factory is not available. Missing file 'libs/jquery-ui.custom.min.js'");var debug={_stack:[],_doDebug:false,_liveDebug:false,_msgCounter:0,init:function(){if(window.location.host.match(/\.ece(dev|stage)\./)){var self=this;this._doDebug=true;$(document).keydown(function(evt){if(evt.ctrlKey&&evt.altKey&&evt.which==68){evt.preventDefault();self.print();self._liveDebug=!self._liveDebug}})}},_log:function(msg){if(this._stack[this._stack.length-
1]==msg)this._msgCounter++;else this._msgCounter=0;if(this._msgCounter>3)return;if(this._liveDebug)console.log(msg);else this._stack.push(msg)},log:function(){if(this._doDebug){var args=Array.prototype.slice.call(arguments);return this._log.apply(this,args)}},print:function(){for(var i=0;i<this._stack.length;i++)console.log(this._stack[i]);this.flush()},flush:function(){this._stack=[]}};debug.init();var Skin=function(widget){$.extend(this,{_widget:null,_poster:null,_controls:null,_zIndex:null,_statusPos:{limit:{w:496,
h:279},video:{big:{origin:{x:"0",y:"-378px"},hover:{x:"0",y:"-249px"}},small:{origin:{x:"-512px",y:"-336px"},hover:{x:"-512px",y:"-249px"}}},audio:{big:{origin:{x:"-128px",y:"-378px"},hover:{x:"-128px",y:"-249px"}},small:{origin:{x:"-601px",y:"-336px"},hover:{x:"-601px",y:"-249px"}}}},_type:null,_sizeType:"big",_playing:false,_posterClick:function(e){e.preventDefault()},_init:function(widget){this._widget=widget;this._poster=this._widget.find("a.player-poster");this._controls=this._widget.find(".player-controls");
this._zIndex=parseInt(this._controls.css("z-index"));if($.browser.msie&&$.browser.version<9)this._widget.css({display:"inline",zoom:"1"});this._initPoster()},_initPoster:function(){var self=this;if(!this.hasPoster())return;var smallPoster=this._poster.hasClass("small");this._poster.bind("click",this._posterClick);this._posterClick=function(evt){evt.preventDefault();self._widget.mediaPlayer(self._playing?"pause":"play")};this._widget.find("div.player-fallback").css({"position":"relative","overflow":"hidden"});
this._controls.css({"overflow":"hidden"});this._poster.css({"position":"absolute","top":"0","z-index":this._zIndex+1,"width":"100%","padding":0,"margin":0,"border":"none"});if(smallPoster){var realHeight=this._controls.find("audio,video").height();this._widget.height(realHeight+3*2);this._poster.css({"font-size":"0.9em","margin":"3px","width":this._widget.width()-3*2+"px","height":"auto","line-height":realHeight+"px","background-image":"-webkit-linear-gradient(bottom, rgb(5,5,5) 00%, rgb(128,128,128) 100%)",
"-webkit-box-shadow":"0px 0px "+3+"px rgba(0, 0, 0, 0.5)","border-radius":"5px","overflow":"hidden"})}else{this._sizeType=this._widget.width()>this._statusPos.limit.w||this._widget.height()>this._statusPos.limit.h?"big":"small";var spriteDatas=this._statusPos.video[this._sizeType];this._poster.find("span.status-icon").css({"position":"absolute","top":"50%","left":"50%","z-index":this._zIndex+20,"display":"block","width":self._sizeType=="big"?"120px":"86px","height":self._sizeType=="big"?"120px":"86px",
"background":'url("'+RTS.basic.host+'/img/general/pictos-rts.png") '+spriteDatas.origin.x+" "+spriteDatas.origin.y+" no-repeat","margin":self._sizeType=="big"?"-60px":"-43px","padding":"0"}).hover(function(){$(this).css("background-position-y",spriteDatas.hover.y)},function(){$(this).css("background-position-y",spriteDatas.origin.y)});this._poster.find("span.loading-icon").css({"display":"none","background-color":"#000","-webkit-border-radius":"7px","-moz-border-radius":"7px","border-radius":"7px",
"opacity":"0.7","position":"absolute","width":"60px","height":"60px","top":"50%","left":"50%","z-index":this._zIndex+30,"margin":"-30px","padding":"0"});this._poster.find("span.loading-icon img").css({"margin":"14px","display":"block","width":"32px","height":"32px","position":"absolute","float":"none","padding":"0"})}this._widget.find("audio,video").attr("poster","");this.setMediaType(this._widget.find("audio,video")[0].tagName.toLowerCase());this.togglePoster(true)},togglePoster:function(flag){if(!this.hasPoster())return;
if(flag){if(this._poster.hasClass("small"))this._poster.show();else this._poster.css("z-index",this._zIndex+1);this._controls.css("left","-99999px")}else{if(this._poster.hasClass("small"))this._poster.hide();else this._poster.css("z-index",this._zIndex-1);this._controls.css("left","0")}},hasPoster:function(){return!RTS.browser.hasFlash&&this._poster.length>0},updateMetaData:function(data){if(!this._poster.hasClass("small")){var background="";if(data.poster){background=decodeURIComponent(data.poster).replace(/\?.*$/,
"");background+="?w\x3d"+this._poster.width()+"\x26h\x3d"+this._poster.height();if(!/^http:/.test(background))background=RTS.basic.host+background}this._poster.css("background-image",'url("'+background+'")')}this.setMediaType(data.type);this.togglePoster(true)},setMediaType:function(type){this._type=type;if(!this._poster.hasClass("small")){var spriteDatas=this._statusPos[this._type][this._sizeType];this._poster.find(".status-icon").css({"background-position-x":spriteDatas.origin.x,"background-position-y":spriteDatas.origin.y}).hover(function(){$(this).css("background-position-y",
spriteDatas.hover.y)},function(){$(this).css("background-position-y",spriteDatas.origin.y)})}this._widget.find(type).css({height:type=="audio"?"":"100%"})},updatePlayingStatus:function(flag){this._playing=flag;if(flag){if(this._type=="video")this._poster.find(".status-icon").hide();this.togglePoster(false)}else if(this._type=="video")this._poster.find(".status-icon").show()},updateLoadingStatus:function(flag){if(!this.hasPoster())return;if(flag){this._poster.find(".status-icon").hide();this._poster.find(".loading-icon").show();
this._poster.unbind("click",this._posterClick)}else{this._poster.find(".status-icon").show();this._poster.find(".loading-icon").hide();this._poster.bind("click",this._posterClick)}},updateVolumeLevel:JSCompiler_emptyFn(),setDisabled:JSCompiler_emptyFn(),setWide:function(flag){this._widget.css({width:"100%",height:"100%"})},setErrorMessage:function(value){var $panel=this._widget.find(".error-panel").show();if(this._poster.hasClass("small")){this._poster.find("span").remove();if(!$panel.length){$panel=
$("\x3cspan/\x3e").addClass("error-panel").html("Impossible de lire ce media.");this._poster.append($panel)}return}if(!$panel.length){$panel=$("\x3cdiv/\x3e").addClass("error-panel").append("\x3cspan/\x3e");$panel.css({"position":"absolute","z-index":"200","top":0,"left":0,"width":"100%","height":"100%","background":"#fff"});$panel.find("span").css({"position":"absolute","padding":"0","color":"#000","font-size":"12px","text-align":"left","font-style":"italic"});this._widget.find("div.player-fallback").append($panel)}var $message=
$panel.find("span");$message.css({"width":"auto","height":"auto","top":0,"left":0}).html(value.replace(/\n/g,"\x3cbr\x3e"));var w=Math.min($message.width(),this._widget.width()-20*2);var h=Math.min($message.height(),this._widget.height()-20*2);$message.css({top:"50%",left:"50%",width:w+"px",height:h+"px",margin:"-"+Math.round(h/2)+"px 0 0 -"+Math.round(w/2)+"px"});$message.find("span.err-title").css({"display":"block","font-weight":"bold"});$message.find("a").css({"color":"#ff5555","text-decoration":"underline",
"float":"none","padding":"0","width":"auto"})},hideErrorMessage:function(){this._widget.find(".error-panel").hide()}});this._init(widget)};var UID=0;var _readyListeners={};var _readyListen=function(objectId,listener){if(objectId in _readyListeners)return;_readyListeners[objectId]=listener};var _getScriptXHR=null;var _getScriptCallbacks=[];var prototype={options:{disabled:true},_events:["player_complete","player_pause","player_playing","player_quality_change","player_stop","player_stream_loading",
"player_stream_set","player_streaming","player_volume_change","player_wide_status_change","skin_toggle_wide_screen","connection_stream_progress","connection_seek_error","connection_error","connection_stream_loading","player_error","not_supported_error"],_uid:null,_player:null,getCoreObject:JSCompiler_get("_player"),_isReady:false,isReady:JSCompiler_get("_isReady"),_playing:false,isPlaying:JSCompiler_get("_playing"),_info:null,_autoplay:false,_startTime:null,_skin:null,_create:function(){var self=
this;this.widgetEventPrefix="media_";var startTime=parseInt(this.element.attr("data-start-time"));if(startTime>0)this._startTime=startTime;this._skin=new Skin(this.element);this._skin.updateLoadingStatus(true);this._initOverlay();this._bind("connection_stream_progress",function(){self._unbind("connection_stream_progress",arguments.callee);self._autoplay=true});if(!RTS.browser.hasFlash){var media=this.element.find("audio, video");var $tmp=$('script[src*\x3d"rts.ui.media-player"]');var cacheVersion=
$tmp.length&&$tmp.attr("src")?$tmp.attr("src").replace(/^.*v=([^&]+).*$/,"$1"):"1";if(RTS.browser.mobile&&typeof $.support.touch=="undefined"){$.support.touch=false;$.getScript(RTS.basic.host+"/js/libs/jquery.touch.min.js?v\x3d"+cacheVersion)}if(media.height()>this.element.height())this.element.height(media.height());var success=function(){self._player=media.media();self._autoplay=RTS.browser.iOs||RTS.browser.android?false:!!media.autoplay;self._swfReady();self._player.ready()};if(!$.fn.media){_getScriptCallbacks.push(success);
if(!_getScriptXHR)_getScriptXHR=$.ajax({url:RTS.basic.host+"/js/sites/rts.ui.media.js?v\x3d"+cacheVersion,dataType:"script",cache:true,success:function(){for(var i=0;i<_getScriptCallbacks.length;i++)_getScriptCallbacks[i]()},error:function(jqXHR,textStatus,e){debug.log("rts.ui.media ["+textStatus+"] : "+e.message)}})}else success();this.element.addClass("html5-enabled")}else{this._player=this.element.find("object")[0];for(var c=this._player.firstChild;c;c=c.nextSibling)if(c.nodeType==1&&c.nodeName.toLowerCase()==
"param"&&c.name.toLowerCase()=="flashvars"){this._autoplay=/\bautoPlay=(true|1)\b/.test(c.value);break}_readyListen(this._player.id,this)}this.element.attr("data-inited","1")},_setOption:function(key,value){if(key==="disabled")this._setDisabled(value);$.Widget.prototype._setOption.apply(this,arguments)},_bind:function(event,listener){event=event.split(" ");for(var i=0;i<event.length;i++)event[i]=this.widgetEventPrefix+event[i];this.element.bind(event.join(" "),listener);return this},_unbind:function(event,
listener){this.element.unbind(this.widgetEventPrefix+event,listener);return this},_swfReady:function(){this._addListeners();this._initControls();this._isReady=true;this._trigger("player_ready")},_initOverlay:JSCompiler_emptyFn(),_setDisabled:function(flag){var $overlay=this.element.find(".player-overlay");if(flag){this.pause();$overlay.show().fadeTo(500,.6)}else $overlay.fadeTo(500,0,function(){$(this).hide()})},_initControls:function(){var self=this;this.element.addClass(this.widgetBaseClass);this._bind("player_playing",
function(){self._playing=true;self._skin.updatePlayingStatus(true);self._skin.updateLoadingStatus(false)});this._bind("player_pause",function(evt,data){if(data);else{self._playing=false;self._skin.updatePlayingStatus(false)}});this._bind("player_volume_change",JSCompiler_emptyFn());this._trigger("player_volume_change",null,{level:1});this._bind("player_complete",function(evt,data){self._skin.updatePlayingStatus(false);self._skin.updateLoadingStatus(false);self._trigger("stream_complete",null,self._info.id)});
this._bind("player_stream_loading connection_stream_loading",function(){self._skin.updateLoadingStatus(true)});this._bind("player_stream_set",function(evt,data){self._info=data.original;self._skin.updateLoadingStatus(false);var meta={poster:"",type:self._info["audioUrl"]?"audio":"video"};if(self._info["preview_image_url"])meta.poster=self._info["preview_image_url"];else if(self._info["img"])meta.poster=self._info["img"];self._skin.updateMetaData(meta);var historyFn=function(){try{require(["app/app-history"],
function(){AddHistory(self._info.id)})}catch(e){if(console)console.error(e)}return true};if(!self._playing||!historyFn()){self._bind("player_playing.history",function(){if(historyFn()){self._unbind("player_playing.history");self._unbind("player_complete.history")}});self._bind("player_complete.history",function(){if(historyFn()){self._unbind("player_playing.history");self._unbind("player_complete.history")}})}if(self.options.disabled)self._setOption("disabled",false);if(self._startTime){var duration=
self._info.duration;if(self._startTime<duration){var pos=self._startTime/duration;if(self._autoplay)self.seek(pos);else{self._bind("player_playing.autoseek",function(){self._unbind("player_playing.autoseek");self.seek(pos)});self._bind("player_stream_loading.autoseek",function(){self._unbind("player_stream_loading.autoseek");self._unbind("player_playing.autoseek")})}}self._startTime=null}});this._bind("player_error",function(evt,msgObj){self._skin.updateLoadingStatus(false);self._skin.setErrorMessage('\x3cspan class\x3d"err-title"\x3e'+
msgObj.reason.title+"\x3c/span\x3e"+"\x3cspan\x3e"+msgObj.reason.text+"\n\nMerci de votre compréhension.\x3c/span\x3e")});this._bind("not_supported_error",function(evt,data){self._skin.updateLoadingStatus(false);self._skin.setErrorMessage('\x3cspan class\x3d"err-title"\x3e'+data.reason.title+"\x3c/span\x3e"+data.reason.text)})},_addListeners:function(){window[this.getUid()]={};for(var i=0;i<this._events.length;i++)(function(target,eventName){var uid=target.getUid();window[uid][eventName]=function(data){debug.log("EVENT : "+
eventName);target._trigger(eventName,null,[data])};target._player.action("addJsListener",[eventName,"window."+uid+"."+eventName])})(this,this._events[i])},getUid:function(){if(null===this._uid)this._uid=this.namespace.replace(".","_")+"_player_"+ ++UID;return this._uid},load:function(obj,position,forceAutoPlay){var self=this;if(typeof position==="boolean"){forceAutoPlay=position;position=0}if(!(parseInt(obj)>0||typeof obj==="object"))return false;if(parseInt(obj)>0){id=parseInt(obj);if(null!==this._info&&
this._info.id==id)if(position&&position<=1&&position>=0){this._bind("connection_seek_error",function(){self._unbind("connection_seek_error",arguments.callee);if(self._autoplay)self.play()});this.seek(position)}else if(this._autoplay)this.play();paramAttribute="id";paramValue=id}else{paramAttribute="stream";paramValue=obj}this._skin.updateLoadingStatus(true);this._skin.hideErrorMessage();if(position&&position<=1&&position>=0&&this._autoplay)this._bind("player_stream_set",function(){self._unbind("player_stream_set",
arguments.callee);self.seek(position)});if(!(RTS.browser.iOs||RTS.browser.android))this._autoplay=true;var playerParam={autoPlay:forceAutoPlay!==undefined?forceAutoPlay:this._autoplay};playerParam[paramAttribute]=paramValue;this._player.action("load",[playerParam]);return true},changeVolume:function(level){if(!this._info)return;level=parseFloat(level);if(level<=1&&level>=0)this._player.action("changeVolume",[{info:{level:level}}])},changeQuality:function(quality){this._player.action("changeQuality",
[{info:{id:quality}}])},goShopping:function(){if(this._info["shopLink"]&&this._info["shopLink"]!=""&&this._info["shopLink"]!="#")window.open(this._info["shopLink"]);else if(this._info["shopParams"]){var query=this._info["shopParams"];var $form=$("\x3cform /\x3e");$form.attr({method:"POST",action:"https://boutique.rts.ch/commande-emission-tsr.php",target:"_blank"});for(var k in query){if(k=="paiement"&&query[k]=="false")continue;$form.append('\x3cinput type\x3d"hidden" name\x3d"'+k+'" value\x3d"'+
query[k]+'" /\x3e')}$("body").append($form);$form.submit().remove();delete $form}else debug.log("shop error: no shopParams in stream")},statusIsWide:function(flag){if(this.element.hasClass("html5-enabled"))this._skin.setWide(flag);else this._player.action("statusIsWide",flag)},seek:function(position){var self=this;if(!this._info)return;position=parseFloat(position);if(position<=1&&position>=0){this._bind("connection_stream_progress",function(){self._unbind("connection_stream_progress",arguments.callee);
self._trigger("seek_complete")});self._skin.updateLoadingStatus(true);debug.log("ACTION : seek {percent: "+position+"}");this._player.action("seek",[{info:{percent:position}}])}}};$.each("play,pause,stop,setEmbedMode".split(","),function(index,method){prototype[method]=function(){debug.log("ACTION : "+method);if(arguments.length){var args=Array.prototype.slice.call(arguments);this._player.action(method,args)}else this._player.action(method)}});$.widget("rts.mediaPlayer",prototype);$.rts.mediaPlayerReady=
function(objectId){if(objectId in _readyListeners){_readyListeners[objectId]._swfReady();delete _readyListeners[objectId]}};$.fn.initMediaPlayers=function(options){options=options||{};return this.each(function(){$(this).find("div.media-player-widget:not([data-inited])").each(function(){var $this=$(this);var id=$this.find("object").attr("id");var uid=$this.find("object").data("uid");window["__player_jsReady"+uid]=function(){return true};window["__player_swfReady"+uid]=function(){$.rts.mediaPlayerReady(id)};
$this.mediaPlayer(options)})})};$(function(){$(document).initMediaPlayers();$(document).ajaxComplete(function(evt,xhr,options){if(options.dataType!="json")$(document).initMediaPlayers()})})})(jQuery);
(function($,undefined){var debug={_stack:[],_doDebug:false,_msgCounter:0,init:function(){if(window.location.host.match(/\.ece(dev|stage)\./)){var self=this;this._doDebug=true;$(document).keydown(function(evt){if(evt.ctrlKey&&evt.altKey&&evt.which==68){evt.preventDefault();self.print()}})}},_log:function(msg){if(this._stack[this._stack.length-1]==msg)this._msgCounter++;else this._msgCounter=0;if(this._msgCounter>3)return;this._stack.push(msg)},log:function(){if(this._doDebug){var args=Array.prototype.slice.call(arguments);
return this._log.apply(this,args)}},print:function(){for(var i=0;i<this._stack.length;i++)console.log(this._stack[i]);this.flush()},flush:function(){this._stack=[]}};debug.init();var UID=0;var _readyList=[];var _readyListeners={};var _readyListen=function(objectId,listener){if(-1!==$.inArray(objectId,_readyList))return listener._swfReady();_readyListeners[objectId]=listener};var getOpener=function(){try{if(window.opener&&window.opener.$)return window.opener.$(window.opener)}catch(e){return null}return null};
var ce={_initialized:false,_actionRunning:false,_playlistId:null,_logged:false,_items:[],_listeners:[],init:function(){var self=this;$(window).bind("ce_app_init",function(evt,data){self._initialized=true;self._init(data)}).bind("ce_playlist_update",function(evt,data){self._actionRunning=false;self._setItems(data.items)}).bind("ce_action_running",function(){self._actionRunning=true}).bind("ce_action_error",function(evt,data){self._actionRunning=false});var playlistUpdateHandler=function(response){if(response!=
undefined)$(window).triggerHandler("ce_playlist_update",{items:response.audioPlaylist.items})};$.ce("onAdd",playlistUpdateHandler);$.ce("onRemove",playlistUpdateHandler);var op=getOpener();if(op)op.triggerHandler("player_popup_ce_ready");if(!this._initialized)$.ce("info",function(json){var data=json.logged?{playlistId:json.audioPlaylistId,logged:json.logged,items:[]}:{playlistId:null,logged:false,items:[]};$(window).triggerHandler("ce_app_init",data)})},_init:function(data){this._playlistId=data.playlistId;
this._logged=data.logged;this._setItems(data.items)},_setItems:function(audioItems){this._items=[];this._inited=true;for(var i=0;i<audioItems.length;i++){var media=audioItems[i];var title="Audio indisponible";if(media.title!==null)title=media["titleHTML"]?media.titleHTML:media.title;var date="";if(media.date!==null)date=" du "+RTS.date.format("%d.%m.%Y",media.date);var channelName="";if(media.channelName!==null)channelName=" ("+media.channelName+")";this._items.push({title:title+date+channelName,
url:"#",id:media.id})}this._dispatch()},addListener:function(fn,scope){if(!fn.guid)fn.guid=++UID;var callback;if(typeof scope=="object"){callback=function(items){fn.call(scope,items)};callback.guid=fn.guid}else callback=fn;this._listeners.push(callback)},removeListener:function(fn){if(!fn.guid)return;for(var i=0;i<this._listeners.length;i++)if(this._listeners[i].guid==fn.guid){this._listeners.splice(i,1);break}},_dispatch:function(){for(var i=0;i<this._listeners.length;i++)this._listeners[i](this._items)},
getItems:JSCompiler_get("_items"),hasItem:function(audioId){var items=this._items;for(var i=0;i<items.length;i++)if(items[i].id==audioId)return true;return false},action:function(audioId,action,callback){if(!action.match(/^(add|remove)$/))throw new Error("Unknown action '"+action+"'");var self=this;if(typeof callback=="function")this.addListener(function(items){self.removeListener(arguments.callee);callback(items)});this._actionRunning=false;var op=getOpener();if(op)op.triggerHandler("player_popup_ce_action",
{id:audioId,action:action});if(!this._actionRunning)$.ce("playlist",action+"Audio",audioId)}};$(function(){ce.init()});var prototype={options:{disabled:true,autoplay:true,onairDisplay:false,metaDataWrappers:[]},_events:["player_complete","player_pause","player_playing","player_quality_change","player_stop","player_stream_loading","player_stream_set","player_streaming","player_volume_change","connection_stream_progress","connection_seek_error","player_error","not_supported_error"],_uid:null,_player:null,
_isReady:false,isReady:JSCompiler_get("_isReady"),_info:null,info:function(){if(!this._info)return null;return{id:this._info.id,seekPos:this._info.seekPos,audioUrl:this._info.audioUrl,duration:this._isLive?3600:this._info.duration,isLive:this._isLive,isInPlaylist:this._isLiked}},_previousInfo:null,previousInfo:function(){return _previousInfo},_autoPlay:true,_completed:false,_startTime:null,_startPrevious:null,_volume:0,_duration:0,_isLive:false,_isLiked:false,_isFirstStreamSet:true,_timeScaleRefs:{loaded:false,
first:"",second:""},_liveInfo:{channel:null,tsstamp:0,onAir:{},onAirXhr:null,timeouts:{}},_playlist:{title:"",items:[],xhr:null},_theme:null,shortnames:{"couleur3":"c3","option-musique":"om","la-1ere":"lp","espace-2":"e2"},_isStreamLoading:false,_create:function(){var startTime=parseInt(this.element.attr("data-start-time"));if(startTime>0)this._startTime=startTime;this._initTheme();this._initOverlay();if(!RTS.browser.hasFlash||false){if(!RTS.browser.isOs)this.element.find("object").replaceWith(this.element.find("audio").clone(true));
var self=this;var audio=this.element.find("audio");var cacheVersion=$('script[src*\x3d"rts.ui.player"]').attr("src").replace(/^.*v=([^&]+).*$/,"$1");if(typeof $.support.touch=="undefined"){$.support.touch=false;$.getScript("/js/libs/jquery.touch.min.js?v\x3d"+cacheVersion)}$.ajax({url:"/js/sites/rts.ui.media.js?v\x3d"+cacheVersion,dataType:"script",cache:true,success:function(){self._player=audio.media();self._autoPlay=RTS.browser.iOs||RTS.browser.android?false:true;self._bind("connection_stream_progress",
function(){self._unbind("connection_stream_progress",arguments.callee);self._autoPlay=true;audio[0].autoplay=true});self._swfReady();self._player.ready()}});this.element.find("div.volume-ctrl").hide();this.element.addClass("html5-mode")}else{this._player=this.element.find("object")[0];this._autoPlay=!!$(this._player).find("param[name\x3dflashVars]").attr("value").match(/\bautoPlay=(true|1)\b/);_readyListen(this._player.id,this)}this.element.attr("data-inited","1")},_setOption:function(key,value){if(key===
"disabled")this._setDisabled(value);$.Widget.prototype._setOption.apply(this,arguments)},_bind:function(event,listener){event=event.split(" ");for(var i=0;i<event.length;i++)event[i]=this.widgetEventPrefix+event[i];this.element.bind(event.join(" "),listener);return this},_unbind:function(event,listener){this.element.unbind(this.widgetEventPrefix+event,listener);return this},_swfReady:function(){this._addListeners();this._initControls();if(this.element.attr("data-playlist-load"))this.playPlaylist();
this._isReady=true;this._trigger("player_ready")},_initTheme:function(){switch(this.element.data("theme")){case "original":this._theme=$.extend({},themes["original"]);break;default:this._theme=$.extend({},themes["default"])}this._theme.init(this.element)},_initOverlay:function(){if(!this.element.css("position").match(/(absolute|relative|fixed)/))this.element.css("position","relative");$overlay=$(document.createElement("div"));$overlay.addClass("player-overlay").css({"position":"absolute","z-index":"600",
"top":"0","left":"0","width":"100%","background":"#666666","opacity":.6}).height(this.element.outerHeight());this.element.append($overlay)},_setDisabled:function(flag){var $overlay=this.element.find(".player-overlay");if(flag){this.pause();$overlay.show().fadeTo(500,.6);if(this._isLive)this._destroyLiveHandlers()}else{$overlay.fadeTo(500,0,function(){$(this).hide()});if(this._isLive)this._initLiveHandlers()}},_initControls:function(){var self=this;var $wrapper=this.element;if(this.options.onairDisplay)$wrapper.find(".playing-title").show();
else $wrapper.find(".playing-title").hide();$("a.debit-action").click(function(evt){if(window.opener){window.opener.location.href=$(this).attr("href");evt.preventDefault()}});$wrapper.addClass(this.widgetBaseClass);var $playCtrl=$wrapper.find(".play-ctrl");$playCtrl.click(function(){if(!self._info)return false;var $this=$(this);if($this.hasClass("playing"))self.pause();else{$this.addClass("loading");self._theme.setLoading(true);self.play()}return false});this._bind("player_playing",function(){$playCtrl.addClass("playing");
self._theme.setPlaying(true)});this._bind("player_pause",function(evt,data){if(data)handleProgressData(data);else{$playCtrl.removeClass("playing");self._theme.setPlaying(false)}});this._bind("player_error",function(evt,data){$playCtrl.removeClass("playing").removeClass("loading");self._theme.setPlaying(false);self._theme.setLoading(false);$progressTime.html(self._getFormatTime(0));updateProgress($progressBar.width(),0);self._updateErrorData(data.reason)});this._bind("not_supported_error",function(evt,
data){$playCtrl.removeClass("playing").removeClass("loading");self._theme.setPlaying(false);self._theme.setLoading(false);$progressTime.html(self._getFormatTime(0));updateProgress($progressBar.width(),0);self._updateErrorData(data.reason)});var $dragger=$wrapper.find(".volume-dragger");var $volIcon=$wrapper.find(".volume-icon");var containmentWidth=$dragger.parent().width()-$dragger.width();var volIconHeight=$volIcon.height();var dragging=false;$dragger.draggable({axis:"x",containment:"parent",start:function(){dragging=
true},stop:function(){dragging=false},drag:function(evt,ui){var level=Math.round(ui.position.left/containmentWidth*100)/100;self.changeVolume(level)}});$volIcon.click(function(){var $this=$(this);if(self._volume>0){$this.data("volume",self._volume);self.changeVolume(0)}else{var volume=$this.data("volume")||1;self.changeVolume(volume)}return false});this._bind("player_volume_change",function(evt,data){self._volume=data.level;$volIcon.css("background-position","0px "+-volIconHeight*Math.ceil(self._volume/
(1/3))+"px");if(!dragging)$dragger.animate({left:Math.round(containmentWidth*self._volume)+"px"},300)})._trigger("player_volume_change",null,{level:1});var $progressBar=$wrapper.find(".progressbar");var $progressValue=$wrapper.find(".progress-value");var $progressDragger=$wrapper.find(".progress-dragger");var $progressTime=$wrapper.find(".progress-time span");var $progressTimeDrag=$wrapper.find(".progressbar .progress-time span");var progressDragging=false;var firstLiveSeekDrag=false;var updateProgress=
function(w,x){var tW=($progressTimeDrag.width()-$progressDragger.width()/2)/2;var lPad=x-tW;var rPad=x+tW-w;$progressValue.width(x);if(lPad<0)$progressTimeDrag.parent().css("margin","0 -"+lPad*-1+"px 0 0");else if(rPad>0)$progressTimeDrag.parent().css("margin","0 "+rPad+"px 0 0");else $progressTimeDrag.parent().css("margin",0)};var handleProgressData=function(data){if(progressDragging)return;self._info.seekPos=data.time/data.duration;var w=$progressBar.width();var x=Math.ceil(w*self._info.seekPos);
if(data.isLiveStream){var nTime=RTS.date.format("%H:%M:%S",data.nowTime,RTS.date.getSwitzerlandOffset());if(data.isPlayingLive){x=w;self._liveInfo.tsstamp=0;self._info.seekPos=1}else self._liveInfo.tsstamp=data.nowTime}else nTime=self._getFormatTime(data.time);$progressTime.html(nTime);updateProgress(w,x,data.isLiveStream)};$progressBar.click(function(evt){var position=Math.round((evt.pageX-$progressBar.offset().left)/$progressBar.width()*100)/100;self.seek(position)});$progressDragger.draggable({axis:"x",
containment:$progressBar,start:function(){progressDragging=true;firstLiveSeekDrag=true},stop:function(evt,ui){var seeking=ui.position.left/$progressBar.width()*100/100;self.seek(seeking>=.99?1:seeking);$progressDragger.css("left","auto");progressDragging=false;if($progressValue.hasClass("live")){$progressTime.html(RTS.date.format("%H:%M:%S"),null,RTS.date.getSwitzerlandOffset());$progressValue.removeClass("live")}},drag:function(evt,ui){var w=$progressBar.width();var position=ui.position.left/$progressBar.width()*
100/100;if(ui.position.left>w){ui.position.left=w;return}if(self._isLive){var nowStamp=(new Date).getTime();limitStamp=(new Date(nowStamp-60*6E4+RTS.date.getSwitzerlandOffset()*60*60)).getTime(),diff=nowStamp-limitStamp;if(position>=.99){if(firstLiveSeekDrag){$progressValue.addClass("live");$progressTime.html("Direct");firstLiveSeekDrag=false}}else{if($progressValue.hasClass("live"))$progressValue.removeClass("live");firstLiveSeekDrag=true;$progressTime.html(RTS.date.format("%H:%M:%S",limitStamp+
diff*ui.position.left/w,RTS.date.getSwitzerlandOffset()))}}else $progressTime.html(self._getFormatTime(self._duration*Math.max(.001,ui.position.left/w)));updateProgress(w,ui.position.left)}});this._bind("connection_stream_progress",function(evt,data){if(self._isStreamLoading)return;$playCtrl.removeClass("loading");self._theme.setLoading(false);handleProgressData(data)});this._bind("player_complete",function(evt,data){self._previousInfo=null;self._completed=true;$playCtrl.removeClass("playing").removeClass("loading");
self._theme.setPlaying(false);self._theme.setLoading(false);$progressTime.html(self._getFormatTime(0));updateProgress($progressBar.width(),0);self._trigger("stream_complete",null,self._info.id)});this._bind("player_stream_loading",function(){self._isStreamLoading=true;$playCtrl.addClass("loading");self._theme.setLoading(true)});this._bind("player_stream_set",function(evt,data){self._isStreamLoading=false;if(!self._completed)self._previousInfo=self.info();self._completed=false;self._info=data.original;
var historyFn=function(){try{var scope$$0=window;try{if(window.opener&&window.opener.require)scope$$0=window.opener}catch(e){}(function(scope){scope.require(["app/app-history"],function(){scope.AddHistory(self._info.id)})})(scope$$0)}catch(e$$0){if(console)console.error(e$$0)}return true};if(!$playCtrl.hasClass("playing")||!historyFn()){self._bind("player_playing.history",function(){if(historyFn()){self._unbind("player_playing.history");self._unbind("player_complete.history")}});self._bind("player_complete.history",
function(){if(historyFn()){self._unbind("player_playing.history");self._unbind("player_complete.history")}})}self._info.title=$("\x3cdiv/\x3e").html(self._info.title).text();if(!self._autoPlay){$playCtrl.removeClass("loading");self._theme.setLoading(false)}if(self.options.disabled)self._setOption("disabled",false);if(self._startTime||self._startPrevious){var starting=self._startTime||self._startPrevious;var duration=self._info.duration;if(duration<0)duration=3600;if(starting<duration){var pos=starting/
duration;if(self._autoPlay||self._startPrevious)self.seek(pos);else{self._bind("player_playing.autoseek",function(){self._unbind("player_playing.autoseek");self.seek(pos)});self._bind("player_stream_loading.autoseek",function(){self._unbind("player_stream_loading.autoseek");self._unbind("player_playing.autoseek")})}}self._startTime=self._startPrevious=null}self._isLiked=ce.hasItem(self._info.id);self._trigger("toggle_selection",null,[self._isLiked]);if(self._isFirstStreamSet&&self._isLiked)self.playPlaylist();
self._isFirstStreamSet=false;self._handleStreamChange()})},_handleStreamChange:function(){var meta={program:this._info.program,title:this._info.title,image:this._info.img==""?"":this._info.img.substring(0,this._info.img.indexOf("?"))+"?w\x3d100\x26h\x3d100",desc:this._info.intro.replace(/\n/g,"\x3cbr\x3e"),url:this._info.broadcastUrl};if(this._info.program=="Le Journal horaire"){var d=this._info.audio_created_date;var y=d.substr(0,4);var month=d.substr(5,2);var day=d.substr(8,2);var h=d.substr(11,
2);var m=d.substr(14,2);meta.desc="\x3cp class\x3d'date'\x3e"+(day+"."+month+"."+y+" - "+h+":"+m)+"\x3c/p\x3e"+meta.desc}this._isLive=this._info.type=="live";this._duration=this._info.duration;this._destroyLiveHandlers();if(this._isLive){this._initLiveHandlers();this.element.find(".scale.aod").hide();this.element.find(".scale.live").show()}else{this.element.find(".progress-time span").html(this._getFormatTime(0));this.element.find(".duration").html(this._getFormatTime(this._duration));this.element.find(".scale.aod").show();
this.element.find(".scale.live").hide();this.element.find(".playing-title .scrollingtext").hide()}this._updateMetaData(meta)},_initLiveHandlers:function(){var self=this;this._liveInfo.channel=this._info.channelId;this._updateOnAir();this._updateLivePlaylist();this._updateTimeScale();this._bind("seek_complete.live",function(){self._updatePlayingAudio();self._updateOnAir()})},_destroyLiveHandlers:function(){for(var k in this._liveInfo.timeouts)clearTimeout(this._liveInfo.timeouts[k]);if(this._playlist.xhr&&
this._playlist.xhr["abort"])this._playlist.xhr.abort();this._unbind("seek_complete.live")},_liveTimeout:function(name,delay){if(this._liveInfo.timeouts[name])clearTimeout(this._liveInfo.timeouts[name]);this._liveInfo.timeouts[name]=setTimeout($.proxy(this,name),delay)},_updateMetaData:function(meta){if(this.options.metaDataWrappers.length)$.each(this.options.metaDataWrappers,function(i,elmt){var $elmt=$(elmt);for(var k in meta){var $metaElmt=$elmt.find(".meta-"+k);if(k=="image")if(meta[k]){$metaElmt.attr("src",
meta[k]).show();$elmt.addClass("illustrated")}else{$metaElmt.hide();$elmt.removeClass("illustrated")}else if(k=="url")if(meta[k]&&-1===meta[k].indexOf("/le-journal-horaire/")&&0!=meta[k].indexOf("/audio/"))$metaElmt.attr("href",meta[k]).show();else $metaElmt.hide();else{$metaElmt.html(k=="program"?'"'+meta[k]+'"':meta[k]);if(k=="program"){$metaElmt.removeAttr("style");RTS.text.stripChars(".meta-"+k,$metaElmt.height())}}}$elmt.show()})},_updateErrorData:function(meta){var self=this;if(self._previousInfo)self._startPrevious=
parseInt(self._previousInfo.seekPos*self._previousInfo.duration);if(this.options.metaDataWrappers.length)$.each(this.options.metaDataWrappers,function(i,elmt){var $elmt=$(elmt);var $link=$elmt.find(".error-back");for(var k in meta)$elmt.find(".error-"+k).html(meta[k]);if(self._previousInfo&&!meta.noBack){$link.css("visibility","visible");$link.click(function(evt){evt.preventDefault();self.load(self._previousInfo.id)})}else $link.css("visibility","hidden");$elmt.show()})},_updatePlayingAudio:function(){var self=
this;var now=new Date;var $label=this.element.find(".playing-title .scrollingtext");if(this._liveInfo.tsstamp)now.setTime(this._liveInfo.tsstamp);for(var i=0;i<this._playlist.items.length;i++){var item=this._playlist.items[i];var start=RTS.date.parse(item.date.replace(/^(\d{2})(\.)(\d{2})(\.)(\d{4})\b/,"$5/$3/$1"));var end=start+item.duration*1E3;if(now.getTime()>start&&now.getTime()<end){this._unbind("onair_update.audioUpdate");$label.html(item.artist+" - "+item.title).show();$(".marquee-audio").RemoveScroller();
$(".marquee-audio").SetScroller({velocity:60,direction:"horizontal",startfrom:"right",loop:"infinite",movetype:"linear",onmouseover:"pause",onmouseout:"play",onstartup:"play",cursor:"pointer"});return(end-now.getTime())/1E3+2}}$label.html(this._liveInfo.onAir["title"]);this._bind("onair_update.audioUpdate",function(evt,data){self._unbind("onair_update.audioUpdate");$label.html(data.title).show()});return 60},_updateLivePlaylist:function(){var self=this;if(!this.options.onairDisplay)return;if(this._playlist.xhr)this._playlist.xhr.abort();
this._playlist.xhr=$.ajax({url:"/x/titles/live/rss_"+this.shortnames[this._liveInfo.channel]+".xml",dataType:"text",success:function(xml,status,xhr){var items=[];$(RTS.text.parseXML(xml)).find("channel\x3eitem").each(function(index,item){item=$(item);var titleObj=item.find("rsrd\\:title, title");var pubDate=item.find("pubDate").text();var beginTime=item.find("rsrd\\:begintime, begintime");var title=titleObj.length==1?$(titleObj[0]).text():$(titleObj[1]).text();if(!title||beginTime.length==0)return;
items.push({title:title,artist:item.find("rsrd\\:artist, artist").text(),date:pubDate.substring(0,pubDate.indexOf(" GMT")),time:beginTime,duration:item.find("rsrd\\:duration, duration").text()})});self._setPlaylist("Derniers morceaux",items);self._liveTimeout("_updateLivePlaylist",self._updatePlayingAudio()*1E3)}})},_updateOnAir:function(){if(this._liveInfo.onAirXhr)this._liveInfo.onAirXhr.abort();if(this._liveInfo.timeouts["_updateOnAir"])clearTimeout("_updateOnAir");if(!this.options.metaDataWrappers.length)return;
var self=this;var d=RTS.date.format("%Y-%m-%dT%H:%M:00",this._liveInfo.tsstamp,RTS.date.getSwitzerlandOffset());this._liveInfo.onAirXhr=$.ajax({url:"/?flux\x3dplayer\x26date\x3d"+d+"\x26channel\x3d"+this._liveInfo.channel,dataType:"text",success:function(xml,status,xhr){xml=$(RTS.text.parseXML(xml));var desc=xml.find("channel\x3edesc").text();var meta={title:xml.find("channel\x3etitle").text(),image:xml.find("channel\x3eimage\x3eurl").text(),desc:desc.replace(/\\n/g,"\x3cbr\x3e").replace("\n","\x3cbr\x3e\x3cbr\x3e"),
url:xml.find("channel\x3elink\x3eurl").text()};self._liveInfo.onAir=meta;self._trigger("onair_update",null,meta);self._updateMetaData(meta);self._liveTimeout("_updateOnAir",5*60*1E3)}})},loadPodcast:function(url){var self=this;if(this._playlist.xhr)this._playlist.xhr.abort();this._playlist.xhr=$.ajax({url:url,dataType:"json",success:function(json,status,xhr){var items=[];$.each(json.podcastJson.items.item,function(i,obj){items.push({title:obj.title+" du "+RTS.date.format("%d.%m.%Y %H:%M",obj.publishedDate),
id:obj.id,url:obj.file})});self._setPlaylist("Derniers journaux",items,"newsFeed")}})},_handlePlaylistItems:function(items){items=items.length?items:[{title:"Votre sélection est vide."}];this._setPlaylist("Ma sélection",items,"playlist")},playPlaylist:function(){this._handlePlaylistItems(ce._items);ce.addListener(this._handlePlaylistItems,this)},postCeAction:function(action,callback){ce.action(this._info.id,action,callback)},_setPlaylist:function(title,items,type){if(type!=="playlist")ce.removeListener(this._handlePlaylistItems);
this._playlist.title=title;this._playlist.type=type||"default";this._playlist.items=items;this._trigger("playlist_change",null,this._playlist)},_updateTimeScale:function(){var isRefChanges=false;var wBar=$(".progressbar",this.element).width();var now=new Date;var nowStamp=now.getTime();var minDiff=now.getMinutes()>=30?now.getMinutes()-30:now.getMinutes();var firstRef=new Date(nowStamp-(minDiff*6E4+now.getSeconds()*1E3));var firstRefStamp=firstRef.getTime();var firstRefSave=RTS.date.format("%H%M",
firstRef);var secondRef=new Date(firstRefStamp-30*6E4);var secondRefStamp=secondRef.getTime();var secondRefSave=RTS.date.format("%H%M",secondRef);limitStamp=(new Date(nowStamp-60*6E4)).getTime(),firstRefPos=wBar-(firstRefStamp-limitStamp)*wBar/(nowStamp-limitStamp)+6,secondRefPos=wBar-(secondRefStamp-limitStamp)*wBar/(nowStamp-limitStamp)+6,updateTime=function($obj,wScale,timestamp,isRefChanges,isFirst){var $time=$("span.hour",$obj);var $timeTxt=$("span:first",$time);var offset=$time.offset();var trueLeftOffset=
$time.parents().filter("#iplayer-player").length>0?offset.left-$("#iplayer-player").offset().left:offset.left;var wFull=wBar+6;var timeOff=$time.width()/4;var rightOffSet=wFull-trueLeftOffset;var leftOffSet=timeOff-trueLeftOffset;$obj.css("width",wScale+"px");if($obj.parent().hasClass("live"))$timeTxt.html(RTS.date.format("%H:%M",timestamp,RTS.date.getSwitzerlandOffset()));else $timeTxt.html(RTS.date.format("%H:%M",timestamp));if(rightOffSet==wFull&&leftOffSet==timeOff)$timeTxt.css("left","0");else if(isRefChanges)if(isFirst)$timeTxt.css("left",
"-8px");else $timeTxt.css("left","0");else if(rightOffSet<0)$timeTxt.css("left",rightOffSet+"px");else if(leftOffSet>0)$timeTxt.css("left",leftOffSet+"px");else $timeTxt.css("left","0")};if(firstRefSave!=this._timeScaleRefs.first&&secondRefSave!=this._timeScaleRefs.second){if(!this._timeScaleRefs.loaded)this._timeScaleRefs.loaded=true;else isRefChanges=true;this._timeScaleRefs.first=firstRefSave;this._timeScaleRefs.second=secondRefSave}updateTime($(".scale.live span.half-one",this.element),firstRefPos,
firstRefStamp,isRefChanges,true);updateTime($(".scale.live span.half-two",this.element),secondRefPos,secondRefStamp,isRefChanges,false);this._liveTimeout("_updateTimeScale",1E3)},_addListeners:function(){var self=this;var p=this._player;var uid=this.getUid();window[uid]={};for(var i=0;i<this._events.length;i++){var eventName$$0=this._events[i];(function(target,eventName){window[uid][eventName]=function(data){debug.log("EVENT : "+eventName);target._trigger(eventName,null,[data])}})(this,eventName$$0);
p.action("addJsListener",[eventName$$0,"window."+uid+"."+eventName$$0])}ce.addListener(function(){if(self._info&&self._info.id){self._isLiked=ce.hasItem(self._info.id);self._trigger("toggle_selection",null,[self._isLiked])}},this)},_getFormatTime:function(time){if(time==0)return"00:00";return RTS.date.format(time/3600>=1?"%H:%M:%S":"%M:%S",time*1E3,0)},getUid:function(){if(null===this._uid)this._uid=this.namespace.replace(".","_")+"_player_"+ ++UID;return this._uid},load:function(id,position){var self=
this;id=parseInt(id);if(id>0){if(null!==this._info&&this._info.id==id){if(position&&position<=1&&position>=0){this._bind("connection_seek_error",function(){self._unbind("connection_seek_error",arguments.callee);self.play()});this.seek(position)}else this.play();return false}if(position&&position<=1&&position>=0&&this._autoPlay)this._bind("player_stream_set",function(){self._unbind("player_stream_set",arguments.callee);self.seek(position)});debug.log("ACTION : load {id: "+id+", autoPlay: "+this.options.autoplay+
"}");this._player.action("load",[{id:id,autoPlay:this.options.autoplay}]);return true}return false},changeVolume:function(level){if(!this._info)return;level=parseFloat(level);if(level<=1&&level>=0)this._player.action("changeVolume",[{info:{level:level}}])},changeQuality:function(quality){this._player.action("changeQuality",[{info:{id:quality}}])},seek:function(position){var self=this;if(!this._info)return;position=parseFloat(position);if(position<=1&&position>=0){this._bind("connection_stream_progress",
function(){self._unbind("connection_stream_progress",arguments.callee);self._trigger("seek_complete")});this.element.find(".play-ctrl").addClass("loading");self._theme.setLoading(true);debug.log("ACTION : seek {percent: "+position+"}");this._player.action("seek",[{info:{percent:position}}])}}};$.each("play,pause,stop,setEmbedMode".split(","),function(index,method){prototype[method]=function(){debug.log("ACTION : "+method);if(arguments.length)this._player.action(method,arguments);else this._player.action(method)}});
$.widget("rts.player",prototype);var themes={"original":{_element:null,init:function($element){var reset={"padding":0,"margin":0,"min-height":0,"min-width":0};var height={"height":"22px"};this._element=$element;var playCss={"position":"absolute","top":"0","left":"0","width":"34px"};$element.find(".play-ctrl").css($.extend({},reset,height,playCss,{"z-index":"200","border-right":"2px solid #000","background":'url("/img/audio/player/original/play.gif") center 0 no-repeat'})).hover(function(){var $this=
$(this);$this.addClass("hover");if($this.hasClass("playing"))$this.css("background-position","center -66px");else $this.css("background-position","center -22px")},function(){var $this=$(this);$this.removeClass("hover");if($this.hasClass("playing"))$this.css("background-position","center -44px");else $this.css("background-position","center 0")});$element.find(".play-ctrl span").css($.extend({},reset,{"display":"block","width":"100%","height":"100%","visibility":"hidden","background":'#ccc url("/img/audio/player/player-loading.gif") center no-repeat'}));
$element.find(".player-object").css($.extend({},reset,playCss,height,{"z-index":"199","overflow":"hidden"}));$element.find(".player-object audio").css({"width":"200px","height":"50px","margin-left":"-200px"});var $progressBarWrapper=$element.find(".progressbar-wrapper");$progressBarWrapper.css($.extend({},reset,{"position":"relative","top":"6px","margin":"0 119px 0 45px","padding":"0 6px 0 0","background":"#000","border":"1px solid #dedede","border-radius":"5px","z-index":"300"}));if(!RTS.browser.hasFlash||
false)$progressBarWrapper.css("margin-right","92px");$element.find(".progressbar").css($.extend({},reset,{"position":"relative","height":"9px","cursor":"pointer"}));$element.find(".progress-value").css($.extend({},reset,{"position":"relative","border-radius":"5px","height":"9px","width":"0%","background":"#555"}));$element.find(".progress-dragger").css($.extend({},reset,{"position":"absolute","width":"19px","height":"17px","right":"0","margin":"-3px -9px","background":'url("/img/audio/player/dragger.png") left top no-repeat'}));
$element.find(".time-info-wrapper").css($.extend({},reset,height,{"position":"absolute","top":0,"right":"29px","width":"90px","line-height":"22px","text-align":"center"}));if(!RTS.browser.hasFlash||false)$element.find(".time-info-wrapper").css("right","0");$element.find(".time-info-wrapper, .time-info-wrapper span").css({"font-size":"9px","color":"#000","font-weight":"normal"});$element.find(".volume-ctrl").css($.extend({},reset,height,{"position":"absolute","top":"0","right":"0","width":"27px","border-left":"2px solid #000"}));
$element.find(".volume-icon").css($.extend({},reset,{"display":"block","width":"100%","height":"100%","background":'url("/img/audio/player/original/volume-icon.gif") 0 0 no-repeat'}));$element.find(".player-controls, .player-object").show()},setLoading:function(flag){var $playCtrl=this._element.find(".play-ctrl");if(flag)$playCtrl.find("span").css("visibility","visible");else $playCtrl.find("span").css("visibility","hidden")},setPlaying:function(flag){var $playCtrl=this._element.find(".play-ctrl");
var pos=flag?$playCtrl.hasClass("hover")?66:44:$playCtrl.hasClass("hover")?22:0;$playCtrl.css("background-position","center -"+pos+"px")}},"default":{init:function($element){$element.find(".player-object").show()},setLoading:JSCompiler_emptyFn(),setPlaying:JSCompiler_emptyFn()}};$.rts.playerReady=function(objectId){_readyList.push(objectId);if(_readyListeners[objectId])_readyListeners[objectId]._swfReady()};$(function(){$(".player-widget.default").player();$(document).ajaxComplete(function(){$(".player-widget.default:not([data-inited])").each(function(){var $this=
$(this);var id=$this.find("object").attr("id");var uid=$this.find("object").data("uid");window["__audio_player_jsReady"+uid]=function(){return true};window["__audio_player_swfReady"+uid]=function(){$.rts.playerReady(id)};$this.player()})})})})(jQuery);if(typeof RTS!="object")RTS={};
(function(ns){ns.PopupPlayerUI={};(function(ns,openerWindow){function _initScrollPane(){if(_scrollPaneWrapper.length){_scrollPane.jScrollPane({verticalGutter:3,horizontalGutter:10});var api=_scrollPane.data("jsp");var breakTimeout;_scrollPaneLabel.click(function(evt){if(_scrollPaneWrapper.position().top>=177)var cb=function(){api.reinitialise()};else cb=JSCompiler_emptyFn();var newTop=_scrollPaneWrapper.position().top==0?177:0;_scrollPaneWrapper.animate({top:newTop+"px"},500,"swing",cb);evt.preventDefault()});
$(window).bind("resize",function(){if($.browser.msie){if(!breakTimeout)breakTimeout=setTimeout(function(){api.reinitialise();breakTimeout=null},50)}else api.reinitialise()})}}function _updateScrollPane(title,items,type){var $list=_scrollPane.find("ul");var curInfo=_player.player("info");var playingItem=false;var prevType=$list.data("type");_scrollPaneLabel.html(title);$list.removeClass().addClass(type).empty();$list.data("type",type);for(var i=0;i<items.length;i++){var item=items[i];var $item=$(document.createElement("li"));
var $wrapper=$(document.createElement("a"));if(curInfo)if(item.id==curInfo.id)playingItem=item;if(item["url"]){if(!item["id"])item["id"]=item.url.replace(/^.*\/(\d+)[^\/]+\.html$/,"$1");$wrapper.attr({"href":item.url,"data-audio-id":item.id})}else $wrapper.click(function(){return false});if(item["time"]){var timeContent;if(RTS.browser.IE){var timeText=item.time[0].textContent||item.time[0].text;timeContent=$(document.createElement("span")).addClass("date").html("\x3cspan\x3e"+timeText+"\x3c/span\x3e")}else timeContent=
$(document.createElement("span")).addClass("date").html(item.time);$wrapper.addClass("has-date").append(timeContent)}$wrapper.append($(document.createElement("span")).addClass("title").html("\x3cspan\x3e"+item.title+"\x3c/span\x3e"));if(item["artist"])$wrapper.append($(document.createElement("span")).addClass("artist").html("\x3cspan\x3e"+item.artist+"\x3c/span\x3e"));$list.append($item.append($wrapper))}if(type=="playlist"){var newTop=0;var cb=function(){_scrollPane.data("jsp").reinitialise()};_scrollPaneWrapper.find(".playlist-link").css("visibility",
"visible")}else{newTop=177;cb=JSCompiler_emptyFn();_scrollPaneWrapper.find(".playlist-link").css("visibility","hidden")}_scrollPaneWrapper.animate({top:newTop+"px"},200,"linear",cb);if(playingItem)$list.find("a[data-audio-id\x3d"+playingItem.id+"]").addClass("playing");else if(items.length&&prevType!=type)_player.player("load",items[0].id)}function _updateSocialLinks(data$$0){var $download=$("#social-links a.download");var $share=$("#social-links a.share");var $podcast=$("#social-links a.podcast");
var $selection=$("#social-links a.playlist-add");$(".trigger-share-buttons").attr("data-url",data$$0.url);$(".trigger-share-buttons").attr("data-title",data$$0.title);$download.attr("href",data$$0.download).unbind("click");if(!data$$0.download){$download.parent().addClass("broke");$download.click(function(evt){evt.preventDefault()})}else{$download.parent().removeClass("broke");if(/http:\/\/download-audio-geo.rts.ch\//g.test(data$$0.download))$.ajax({url:"http://www.rts.ch/token/user-geo.xml",type:"GET",
dataType:"xml",success:function(data){if($(data).find("country").text()!="CH"){$download.parent().addClass("broke");$download.click(function(evt){evt.preventDefault()})}}})}if(data$$0.type=="live")$selection.parent().addClass("broke");else require(["app/app-openpopup"],function(){$selection.parent().removeClass("broke");$selection.click(function(evt){OpenPopup(data$$0.id);evt.preventDefault()})});$share.unbind("click").click(function(evt){evt.preventDefault()});$podcast.attr("href",data$$0.podcastUrl).unbind("click");
if(!data$$0.podcastUrl)$podcast.addClass("broke").click(function(evt){evt.preventDefault()});else $podcast.removeClass("broke")}function _toggleErrorMsg(){if(_isError){_infoWrapper.animate({left:"0px"},400,"easeOutCubic");_isError=false}else{_infoWrapper.animate({left:"-100%"},400,"easeOutCubic");if(_scrollPaneWrapper.position().top==0)_scrollPaneWrapper.animate({top:"177px"},200);_isError=true}}try{if(!openerWindow.location.href)openerWindow=null}catch(ignore){openerWindow=null}var _scrollPaneWrapper;
var _scrollPaneLabel;var _scrollPane;var _player;var _infoWrapper;var _isError;$(function(){var b=true;$.history.init(function(hash){if(b){var matches=hash.match(/\/(\d+)-[^\/]+\.html\b/);if(matches)$(".player-widget").bind("playerplayer_ready",function(){$(this).player("load",matches[1])});b=false}},{unescape:true})});$.extend(ns,{init:function(){_scrollPaneWrapper=$("#scroller-box");_scrollPaneLabel=_scrollPaneWrapper.find(".label");_scrollPane=_scrollPaneWrapper.find(".list-cont");_initScrollPane();
$('a[target\x3d"_opener"]').click(function(evt){if($(this).attr("target")!="_opener")return;if(openerWindow){openerWindow.location.href=$(this).attr("href");evt.preventDefault()}});_infoWrapper=$("#cont-wrapper");_isError=false;var firstStreamSet=true;_player=$(".player-widget");if(/\bt=\d+s\b/.test(window.location.hash))_player.attr("data-start-time",window.location.hash.replace(/.*\bt=(\d+)s\b.*/,"$1"));_player.player({metaDataWrappers:[$("#info-play")],onairDisplay:true});_player.bind("playerplaylist_change",
function(evt,data){_updateScrollPane(data.title,data.items,data.type)});_player.bind("playerplayer_stream_set",function(evt,data){if(_isError)_toggleErrorMsg();var o=data.original||data;var $active=$("a[data-audio-id\x3d"+o.id+"]");$("a[data-audio-id]").removeClass("playing");if($active.length)$active.addClass("playing");else if(firstStreamSet&&o.podcastUrl){firstStreamSet=false;$podcastLink=$("a.podcast-play[href^\x3d'"+o.podcastUrl+"']");if($podcastLink.length)_player.player("loadPodcast",$podcastLink.attr("href"))}var url=
o.audioUrl;if(location.pathname!=url)if(history.pushState)history.pushState(url,document.title,url+location.search);else $.history.load(url);document.title=$("\x3cdiv/\x3e").html(o.title).text();_updateSocialLinks(o)});_player.bind("playerstream_complete",function(evt,data){var listed=$('ul.playlist a[data-audio-id\x3d"'+data+'"]',_scrollPane);if(listed.length){var next=$("a[data-audio-id]",$(listed[0]).parent().next());if(next.length)_player.player("load",$(next[0]).attr("data-audio-id"))}});_player.bind("playertoggle_selection",
function(evt,inPlaylist){var $link=$("#social-links a.playlist-add");if(inPlaylist)$link.addClass("remove").html("\x3cdiv class\x3d'picto-selection'\x3e\x3c/div\x3eEnlever de ma sélection");else $link.removeClass("remove").html("\x3cdiv class\x3d'picto-selection'\x3e\x3c/div\x3eAjouter à mes playlists")});_player.bind("playerplayer_error",function(evt,data){if(!_isError)_toggleErrorMsg()});_player.bind("playernot_supported_error",function(evt,data){if(!_isError)_toggleErrorMsg()});$("a[data-audio-id]").live("click",
function(evt){if(_player.player("load",$(this).attr("data-audio-id")))if($(this).parents("#scroller-box").length==0)_scrollPaneWrapper.animate({top:"215px"},200);evt.preventDefault()});$("a.podcast-play").live("click",function(evt){_scrollPaneWrapper.animate({top:"215px"},200);_player.player("loadPodcast",$(this).attr("href"));evt.preventDefault()});if(openerWindow){$.cookie("player_popup",1,{path:"/"});$(window).unload(function(){$.cookie("player_popup",null,{path:"/"})});if(openerWindow.RTS.iplayer){openerWindow.RTS.iplayer.player.popup.ready(_player);
$(window).unload(function(){openerWindow.RTS.iplayer.player.popup.close(_player.player("info"))});$("a.meta-url").attr("target","_blank")}}}})})(ns.PopupPlayerUI,window.opener)})(RTS);$(document).ready(function(){RTS.PopupPlayerUI.init()});