//############################################################################## function TMetaOutput() { this.PlayerLoaded = function() { //Only show player controls if player is externally controlable setVisibility('idPlayerControls', doitall.player.isControllable()); //Hide player initially for gateway if(doitall.player.isControllable()) doitall.player.Hide(); } this.CheckAndWrite = function(idRow, idStr, val) { if(val!=null && val!="") { DynWrite(idStr, val); setVisibility(idRow, true); } else setVisibility(idRow, false); } //Process list of tracks this.UpdateHistory = function() { //var idHistoryList = document.getElementById('idHistorySummary'); //if(idHistoryList==null) return false; //setVisibility('idHistorySummary',true); //Make sure area is visible var list = doitall.mediadata.getMediaHistory(TMetaOutput.historyitems, TMetaOutput.mediatypes); for(var i=0; i0); } //Shoutcast stream? if(typeof(params['sc'])!="undefined") { doitall.useWMPOnChrome = (params['sc'].toLowerCase()=='y') || (params['sc']>0); } //Don't resize player if((params['noresize']==null) || (params['noresize'].toLowerCase()=="n")) { showHideAd(728, 498); doitall.onAds.subscribe(this.cbEnlarge, this, true); doitall.onRestore.subscribe(this.cbShrink, this, true); } } //========================================================================== // Custom song data handling //########################################################################## this.cbPlayerLoaded = function(type, args, me) { this.metaoutput.PlayerLoaded(); } this.cbStationData = function(type, args, me) { this.metaoutput.UpdateStationData(args[0]); } this.cbHistoryLoaded = function(type, args, me) { this.metaoutput.UpdateHistory(); } this.cbDisplayMedia = function(type, args, me) { var media = args[0]; this.metaoutput.UpdateHistory(); } this.cbDisplayAds = function(type, args, me) { var ads = args[0]; this.metaoutput.UpdateHistory(); if(ads['hasvideo']!="yes") { //If we do not have a cover to display, we can display a text ad - if available if(ads['coverID']>0) { this.areaMainMode("coverad"); doitall.streamads.DisplayInFrame(document.getElementById('frmCoverAd300x250'), ads, 'cover'); } else this.areaMainMode("restore"); } if(ads['bannerID']>0) { this.areaBottomMode("bannerad"); doitall.streamads.DisplayInFrame(document.getElementById('frmBannerAd728x90'), ads, 'banner'); } else this.areaBottomMode("restore"); if(ads['textID']>0) { this.areaRightMode("textad"); doitall.streamads.DisplayInID(document.getElementById('idAdText'), ads, 'text'); } else this.areaRightMode("restore"); } this.cbRestore = function(type, args, me) { this.areaMainMode("restore"); this.areaRightMode("restore"); this.areaBottomMode("restore"); cbDisplayAds } this.cbEnlarge = function(type, args, me) { var ads = args[0]; if(ads['bannerID']>0) { showHideAd(728, 588); } } this.cbShrink = function(type, args, me) { showHideAd(728, 498); } this.cbVideoBegin = function(type, args, me) { this.areaMainMode("videostart"); } this.cbVideoEnd = function(type, args, me) { this.areaMainMode("videoend"); } this.areaMainMode = function(mode) { //We can only use this area if we can conrol the player if(!doitall.player.isControllable()) return false; //See if we need to store mode for later use switch(mode) { case "restore" : /* do nothing */ break; case "coverpic" : lastMainMode = mode; break; case "videostart" : lastMainMode = mode; break; case "videoend" : lastMainMode = null; mode = "restore"; break; default : lastMainMode = null; break; } //Restore to last known good mode if((mode=="restore")&&(lastMainMode!=null)) { if(lastMainMode=="videostart") return false; //Still locked in video mode, abort if(lastMainMode=="coverpic") mode = lastMainMode; //Restore to coverpic mode } setVisibility("idCoverPic", mode=="coverpic"); setVisibility("frmCoverAd300x250", mode=="coverad"); //setVisibility("idVideo", mode=="video"); //We can't hide video area - this will prevent players from functioning //SLPlayer is always hidden if(doitall.player.getContextName()=="TSLPlayer") { doitall.player.Hide(); } //Otherwise check if player should be hidden or shown else if(mode=="player" || mode=="restore") doitall.player.Show(); else doitall.player.Hide(); } this.areaRightMode = function(mode) { setVisibility('trAdText', mode=="textad"); setVisibility('divHistory', mode!="textad"); } this.areaBottomMode = function(mode) { if(mode=="bannerad") { //TODO-increase popup window size setVisibility('frmBannerAd728x90', true); } else { setVisibility('frmBannerAd728x90',false); //TODO-decreate popup window size } } //========================================================================== } //========================================================================== // Functions for changing the window size //########################################################################## function detectBrowser() { var nVer = navigator.appVersion; var nAgt = navigator.userAgent; var browserName = navigator.appName; var fullVersion = '' + parseFloat(navigator.appVersion); var majorVersion = parseInt(navigator.appVersion, 10); var nameOffset, verOffset, ix; // In MSIE, the true version is after "MSIE" in userAgent if ((verOffset = nAgt.indexOf("MSIE")) != -1) { browserName = "Microsoft Internet Explorer"; fullVersion = nAgt.substring(verOffset + 5); } // In Opera, the true version is after "Opera" else if ((verOffset = nAgt.indexOf("Opera")) != -1) { browserName = "Opera"; fullVersion = nAgt.substring(verOffset + 6); } // In Chrome, the true version is after "Chrome" else if ((verOffset = nAgt.indexOf("Chrome")) != -1) { browserName = "Chrome"; fullVersion = nAgt.substring(verOffset + 7); } // In Safari, the true version is after "Safari" else if ((verOffset = nAgt.indexOf("Safari")) != -1) { browserName = "Safari"; fullVersion = nAgt.substring(verOffset + 7); } // In Firefox, the true version is after "Firefox" else if ((verOffset = nAgt.indexOf("Firefox")) != -1) { browserName = "Firefox"; fullVersion = nAgt.substring(verOffset + 8); } // In most other browsers, "name/version" is at the end of userAgent else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < (verOffset = nAgt.lastIndexOf('/'))) { browserName = nAgt.substring(nameOffset, verOffset); fullVersion = nAgt.substring(verOffset + 1); if (browserName.toLowerCase() == browserName.toUpperCase()) { browserName = navigator.appName; } } // trim the fullVersion string at semicolon/space if present if ((ix = fullVersion.indexOf(";")) != -1) fullVersion = fullVersion.substring(0, ix); if ((ix = fullVersion.indexOf(" ")) != -1) fullVersion = fullVersion.substring(0, ix); majorVersion = parseInt('' + fullVersion, 10); if (isNaN(majorVersion)) { fullVersion = '' + parseFloat(navigator.appVersion); majorVersion = parseInt(navigator.appVersion, 10); } //alert(browserName + ' ' + majorVersion); var browser = new Array(); browser['name'] = browserName; browser['version'] = majorVersion; browser['full_version'] = fullVersion; browser['appName'] = navigator.appName; browser['userAgent'] = navigator.userAgent; return browser; } function showHideAd(width, height) { var browser = detectBrowser(); var Size = correctBrowserSize(width, height, browser) changeSize(Size['w'], Size['h']) } //Initialize global objects var metahandler = new TMetaHandler();