/** * SoundManager 2 homepage demo JS * ------------------------------- * MP3 player button, Muxtape/page player, * inline player and 360 player demo bits * combined and minified for optimal performance. * For raw source, see individual demo pages. * -------------------------------- * Source files: * demo/play-mp3-links/script/inlineplayer.js * demo/page-player/script/page-player.js * demo/mp3-player-button/script/mp3-player-button.js * demo/360-player/script/berniecode-animator.js * demo/360-player/script/360player.js * demo/index.js */ /* Animator.js 1.1.9 This library is released under the BSD license: Copyright (c) 2006, Bernard Sumption. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name BernieCode nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ function InlinePlayer(){var a=this,c=this,b=soundManager,d=navigator.userAgent.match(/msie/i);this.playableClass="inline-playable";this.excludeClass="inline-exclude";this.links=[];this.sounds=[];this.soundsByURL=[];this.indexByURL=[];this.lastSound=null;this.soundCount=0;this.config={playNext:!1,autoPlay:!1};this.css={sDefault:"sm2_link",sLoading:"sm2_loading",sPlaying:"sm2_playing",sPaused:"sm2_paused"};this.addEventHandler="undefined"!==typeof window.addEventListener?function(a,b,c){return a.addEventListener(b, c,!1)}:function(a,b,c){a.attachEvent("on"+b,c)};this.removeEventHandler="undefined"!==typeof window.removeEventListener?function(a,b,c){return a.removeEventListener(b,c,!1)}:function(a,b,c){return a.detachEvent("on"+b,c)};this.classContains=function(a,b){return"undefined"!=typeof a.className?a.className.match(RegExp("(\\s|^)"+b+"(\\s|$)")):!1};this.addClass=function(b,c){if(!b||!c||a.classContains(b,c))return!1;b.className=(b.className?b.className+" ":"")+c};this.removeClass=function(b,c){if(!b|| !c||!a.classContains(b,c))return!1;b.className=b.className.replace(RegExp("( "+c+")|("+c+")","g"),"")};this.getSoundByURL=function(b){return"undefined"!=typeof a.soundsByURL[b]?a.soundsByURL[b]:null};this.isChildOfNode=function(a,b){if(!a||!a.parentNode)return!1;b=b.toLowerCase();do a=a.parentNode;while(a&&a.parentNode&&a.nodeName.toLowerCase()!=b);return a.nodeName.toLowerCase()==b?a:null};this.events={play:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className=c.css.sPlaying; c.addClass(this._data.oLink,this._data.className)},stop:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className=""},pause:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className=c.css.sPaused;c.addClass(this._data.oLink,this._data.className)},resume:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className=c.css.sPlaying;c.addClass(this._data.oLink,this._data.className)},finish:function(){c.removeClass(this._data.oLink, this._data.className);this._data.className="";if(c.config.playNext){var a=c.indexByURL[this._data.oLink.href]+1;ac?"0"+c:c):{min:h,sec:c}};this.getSoundByObject=function(b){return"undefined"!== typeof a.soundsByObject[b.id]?a.soundsByObject[b.id]:null};this.getPreviousItem=function(a){if(a.previousElementSibling)a=a.previousElementSibling;else for(a=a.previousSibling;a&&a.previousSibling&&1!==a.previousSibling.nodeType;)a=a.previousSibling;return"li"!==a.nodeName.toLowerCase()?null:a.getElementsByTagName("a")[0]};this.playPrevious=function(b){b||(b=a.lastSound);if(!b)return!1;(b=a.getPreviousItem(b._data.oLI))&&c.handleClick({target:b});return b};this.getNextItem=function(a){if(a.nextElementSibling)a= a.nextElementSibling;else for(a=a.nextSibling;a&&a.nextSibling&&1!==a.nextSibling.nodeType;)a=a.nextSibling;return"li"!==a.nodeName.toLowerCase()?null:a.getElementsByTagName("a")[0]};this.playNext=function(b){b||(b=a.lastSound);if(!b)return!1;(b=a.getNextItem(b._data.oLI))&&c.handleClick({target:b});return b};this.setPageTitle=function(b){if(!a.config.updatePageTitle)return!1;try{document.title=(b?b+" - ":"")+a.pageTitle}catch(c){a.setPageTitle=function(){return!1}}};this.events={play:function(){c.removeClass(this._data.oLI, this._data.className);this._data.className=c.css.sPlaying;c.addClass(this._data.oLI,this._data.className);a.setPageTitle(this._data.originalTitle)},stop:function(){c.removeClass(this._data.oLI,this._data.className);this._data.className="";this._data.oPosition.style.width="0px";a.setPageTitle();a.resetPageIcon()},pause:function(){if(c.dragActive)return!1;c.removeClass(this._data.oLI,this._data.className);this._data.className=c.css.sPaused;c.addClass(this._data.oLI,this._data.className);a.setPageTitle(); a.resetPageIcon()},resume:function(){if(c.dragActive)return!1;c.removeClass(this._data.oLI,this._data.className);this._data.className=c.css.sPlaying;c.addClass(this._data.oLI,this._data.className)},finish:function(){c.removeClass(this._data.oLI,this._data.className);this._data.className="";this._data.oPosition.style.width="0px";a.config.playNext?c.playNext(this):(a.setPageTitle(),a.resetPageIcon())},whileloading:function(){function b(){this._data.oLoading.style.width=100*(this.bytesLoaded/this.bytesTotal)+ "%";!this._data.didRefresh&&this._data.metadata&&(this._data.didRefresh=!0,this._data.metadata.refresh())}if(c.config.useThrottling){var h=new Date;if(h&&50 | Load failed, d\'oh! '+(b.sandbox.noRemote? " Possible cause: Flash sandbox is denying remote URL access.":b.sandbox.noLocal?"Flash denying local filesystem access":"404?")+"";setTimeout(function(){a.innerHTML=c},5E3)}},whileplaying:function(){var h=null;if(c.dragActive||!c.config.useThrottling){a.updateTime.apply(this);9<=b.flashVersion&&(c.config.usePeakData&&this.instanceOptions.usePeakData&&a.updatePeaks.apply(this),(c.config.useWaveformData&&this.instanceOptions.useWaveformData||c.config.useEQData&&this.instanceOptions.useEQData)&& a.updateGraph.apply(this));if(this._data.metadata&&(h=new Date)&&500c.config.flashVersion||!c.config.useWaveformData&&!c.config.useEQData)return!1;var a=this._data.oGraph.getElementsByTagName("div"),b;if(c.config.useWaveformData)for(b=255;b--;)a[255-b].style.marginTop=9+Math.ceil(-8*this.waveformData.left[b])+"px";else for(b=255;b--;)a[255-b].style.marginTop=17+Math.ceil(-9*this.eqData[b])+"px"};this.resetGraph=function(){if(!c.config.useEQData||9>c.config.flashVersion)return!1;var a=this._data.oGraph.getElementsByTagName("div"),b= !c.config.useEQData?"9px":"17px",h=!c.config.fillGraph?"1px":"32px",d;for(d=255;d--;)a[255-d].style.marginTop=b,a[255-d].style.height=h};this.updateTime=function(){var b=a.strings.timing.replace("%s1",a.getTime(this.position,!0)),b=b.replace("%s2",a.getTime(a.getDurationEstimate(this),!0));this._data.oTiming.innerHTML=b};this.getTheDamnTarget=function(a){return a.target||(window.event?window.event.srcElement:null)};this.withinStatusBar=function(b){return a.isChildOfClass(b,"playlist")&&a.isChildOfClass(b, "controls")};this.handleClick=function(h){if(2===h.button)return c.config.allowRightClick||c.stopEvent(h),c.config.allowRightClick;var d=a.getTheDamnTarget(h),m,f,e;if(!d)return!0;a.dragActive&&a.stopDrag();if(a.withinStatusBar(d))return!1;"a"!==d.nodeName.toLowerCase()&&(d=a.getParentByNodeName(d,"a"));if(!d)return!0;d.getAttribute("href");if(!d.href||!b.canPlayLink(d)&&!a.hasClass(d,"playable")||a.hasClass(d,"exclude"))return!0;a.initUL(a.getParentByNodeName(d,"ul"));a.initItem(d);m=d.href;(f=a.getSoundByObject(d))? (a.setPageTitle(f._data.originalTitle),f===a.lastSound?2!==f.readyState?1!==f.playState?f.play():f.togglePause():b._writeDebug("Warning: sound failed to load (security restrictions, 404 or bad format)",2):(a.lastSound&&a.stopSound(a.lastSound),g&&f._data.oTimingBox.appendChild(g),f.togglePause())):(f=b.createSound({id:d.id,url:decodeURI(m),onplay:a.events.play,onstop:a.events.stop,onpause:a.events.pause,onresume:a.events.resume,onfinish:a.events.finish,type:d.type||null,whileloading:a.events.whileloading, whileplaying:a.events.whileplaying,onmetadata:a.events.metadata,onload:a.events.onload}),m=a.oControls.cloneNode(!0),e=d.parentNode,e.appendChild(m),g&&e.appendChild(g),a.soundsByObject[d.id]=f,f._data={oLink:d,oLI:e,oControls:a.select("controls",e),oStatus:a.select("statusbar",e),oLoading:a.select("loading",e),oPosition:a.select("position",e),oTimingBox:a.select("timing",e),oTiming:a.select("timing",e).getElementsByTagName("div")[0],oPeak:a.select("peak",e),oGraph:a.select("spectrum-box",e),className:a.css.sPlaying, originalTitle:d.innerHTML,metadata:null},g&&f._data.oTimingBox.appendChild(g),f._data.oLI.getElementsByTagName("ul").length&&(f._data.metadata=new Metadata(f)),d=a.strings.timing.replace("%s1",a.config.emptyTime),d=d.replace("%s2",a.config.emptyTime),f._data.oTiming.innerHTML=d,a.sounds.push(f),a.lastSound&&a.stopSound(a.lastSound),a.resetGraph.apply(f),f.play());a.lastSound=f;return a.stopEvent(h)};this.handleMouseDown=function(b){n&&b.touches&&(b=b.touches[0]);if(2===b.button)return c.config.allowRightClick|| c.stopEvent(b),c.config.allowRightClick;var h=a.getTheDamnTarget(b);if(!h||!a.withinStatusBar(h))return!0;a.dragActive=!0;a.lastSound.pause();a.setPosition(b);n?d.add(document,"touchmove",a.handleMouseMove):d.add(document,"mousemove",a.handleMouseMove);a.addClass(a.lastSound._data.oControls,"dragging");return a.stopEvent(b)};this.handleMouseMove=function(b){n&&b.touches&&(b=b.touches[0]);if(a.dragActive)if(a.config.useThrottling){var c=new Date;20b;b++)a.vuMeterData[b]=[];for(b=0;16>b;b++)for(c=0;16>c;c++)e.setAttribute("width",16),e.setAttribute("height",16),h.fillStyle=m,h.fillRect(0,0,7,15),h.fillRect(8,0,7,15),h.fillStyle=d,h.fillRect(0,15-b,7,16-(16-b)),h.fillRect(8,15-c,7,16-(16-c)),h.clearRect(0,3,16,1),h.clearRect(0,7,16,1),h.clearRect(0, 11,16,1),a.vuMeterData[b][c]=e.toDataURL("image/png")};this.testCanvas=function(){var a=document.createElement("canvas"),b=null;if(!a||"undefined"===typeof a.getContext)return null;b=a.getContext("2d");if(!b||"function"!==typeof a.toDataURL)return null;try{a.toDataURL("image/png")}catch(c){return null}return a};this.initItem=function(b){b.id||(b.id="pagePlayerMP3Sound"+a.soundCount++);a.addClass(b,a.css.sDefault)};this.initUL=function(c){9<=b.flashVersion&&a.addClass(c,a.cssBase)};this.init=function(h){function m(b){d[b](document, "click",a.handleClick);n?(d[b](document,"touchstart",a.handleMouseDown),d[b](document,"touchend",a.stopDrag)):(d[b](document,"mousedown",a.handleMouseDown),d[b](document,"mouseup",a.stopDrag));d[b](window,"unload",p)}h?(b._writeDebug("pagePlayer.init(): Using custom configuration"),this.config=this._mergeObjects(h,this.config)):b._writeDebug("pagePlayer.init(): Using default configuration");var i,t,j,r;this.cssBase=[];b.useFlashBlock=!0;9<=b.flashVersion?(b.defaultOptions.usePeakData=this.config.usePeakData, b.defaultOptions.useWaveformData=this.config.useWaveformData,b.defaultOptions.useEQData=this.config.useEQData,this.config.usePeakData&&this.cssBase.push("use-peak"),(this.config.useWaveformData||this.config.useEQData)&&this.cssBase.push("use-spectrum"),this.cssBase=this.cssBase.join(" "),this.config.useFavIcon&&((e=a.testCanvas())&&k?a.createVUData():this.config.useFavIcon=!1)):(this.config.usePeakData||this.config.useWaveformData||this.config.useEQData)&&b._writeDebug("Page player: Note: soundManager.flashVersion = 9 is required for peak/waveform/EQ features."); f=document.createElement("div");f.innerHTML='
\n
\n
\n
\n
\n
\n
\n
\n %s1 / %s2\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
'; if(9<=b.flashVersion){g=a.select("spectrum-container",f);g=f.removeChild(g);i=a.select("spectrum-box",g);t=i.getElementsByTagName("div")[0];j=document.createDocumentFragment();r=null;for(h=256;h--;)r=t.cloneNode(!1),r.style.left=h+"px",j.appendChild(r);i.removeChild(t);i.appendChild(j)}else f.removeChild(a.select("spectrum-container",f)),f.removeChild(a.select("peak",f));a.oControls=f.cloneNode(!0);h=a.select("timing-data",f);a.strings.timing=h.innerHTML;h.innerHTML="";h.id="";p=function(){m("remove")}; m("add");b._writeDebug("pagePlayer.init(): Ready",1);a.config.autoStart&&c.handleClick({target:c.getByClassName("playlist","ul")[0].getElementsByTagName("a")[0]})}}soundManager.useFlashBlock=!0;soundManager.onready(function(){pagePlayer=new PagePlayer;pagePlayer.init("undefined"!==typeof PP_CONFIG?PP_CONFIG:null)}); function BasicMP3Player(){var a=this,c=this,b=soundManager,d=navigator.userAgent.match(/ipad|iphone/i),e=navigator.userAgent.match(/msie/i);this.excludeClass="button-exclude";this.links=[];this.sounds=[];this.soundsByURL={};this.indexByURL={};this.lastSound=null;this.soundCount=0;this.config={playNext:!1,autoPlay:!1};this.css={sDefault:"sm2_button",sLoading:"sm2_loading",sPlaying:"sm2_playing",sPaused:"sm2_paused"};this.includeClass=this.css.sDefault;this.addEventHandler="undefined"!==typeof window.addEventListener? function(a,b,c){return a.addEventListener(b,c,!1)}:function(a,b,c){a.attachEvent("on"+b,c)};this.removeEventHandler="undefined"!==typeof window.removeEventListener?function(a,b,c){return a.removeEventListener(b,c,!1)}:function(a,b,c){return a.detachEvent("on"+b,c)};this.classContains=function(a,b){return"undefined"!==typeof a.className?a.className.match(RegExp("(\\s|^)"+b+"(\\s|$)")):!1};this.addClass=function(b,c){if(!b||!c||a.classContains(b,c))return!1;b.className=(b.className?b.className+" ": "")+c};this.removeClass=function(b,c){if(!b||!c||!a.classContains(b,c))return!1;b.className=b.className.replace(RegExp("( "+c+")|("+c+")","g"),"")};this.getSoundByURL=function(b){return"undefined"!==typeof a.soundsByURL[b]?a.soundsByURL[b]:null};this.isChildOfNode=function(a,b){if(!a||!a.parentNode)return!1;b=b.toLowerCase();do a=a.parentNode;while(a&&a.parentNode&&a.nodeName.toLowerCase()!==b);return a.nodeName.toLowerCase()===b?a:null};this.events={play:function(){c.removeClass(this._data.oLink, this._data.className);this._data.className=c.css.sPlaying;c.addClass(this._data.oLink,this._data.className)},stop:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className=""},pause:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className=c.css.sPaused;c.addClass(this._data.oLink,this._data.className)},resume:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className=c.css.sPlaying;c.addClass(this._data.oLink,this._data.className)}, finish:function(){c.removeClass(this._data.oLink,this._data.className);this._data.className="";if(c.config.playNext){var a=c.indexByURL[this._data.oLink.href]+1;a=Math.abs(this.state-this.target)?this.target:this.state+a;try{this.propagate()}finally{this.options.onStep.call(this),this.target==this.state&&(window.clearInterval(this.intervalId),this.intervalId=null,this.options.onComplete.call(this))}},play:function(){this.seekFromTo(0,1)},reverse:function(){this.seekFromTo(1,0)},inspect:function(){for(var a="#"}};Animator.applyDefaults=function(a,c){var c=c||{},b,d={};for(b in a)d[b]=void 0!==c[b]?c[b]:a[b];return d};Animator.makeArray=function(a){if(null==a)return[];if(!a.length)return[a];for(var c=[],b=0;b=a?a:2-a}}; Animator.tx={easeInOut:function(a){return-Math.cos(a*Math.PI)/2+0.5},linear:function(a){return a},easeIn:Animator.makeEaseIn(1.5),easeOut:Animator.makeEaseOut(1.5),strongEaseIn:Animator.makeEaseIn(2.5),strongEaseOut:Animator.makeEaseOut(2.5),elastic:Animator.makeElastic(1),veryElastic:Animator.makeElastic(3),bouncy:Animator.makeBounce(1),veryBouncy:Animator.makeBounce(3)}; function NumericalStyleSubject(a,c,b,d,e){this.els=Animator.makeArray(a);this.property="opacity"==c&&window.ActiveXObject?"filter":Animator.camelize(c);this.from=parseFloat(b);this.to=parseFloat(d);this.units=null!=e?e:"px"} NumericalStyleSubject.prototype={setState:function(a){for(var a=this.getStyle(a),c=0,b=0;b=d;d++)a=Math.max(0,Math.min(255,parseInt(b[d]))),c+=ColorStyleSubject.toColorPart(a);return c}if(b=ColorStyleSubject.parseColor.hexRe.exec(a)){if(3==b[1].length){for(d=0;3>d;d++)c+=b[1].charAt(d)+b[1].charAt(d);return c}return"#"+b[1]}return!1};ColorStyleSubject.toColorPart=function(a){255a?"0"+c:c};ColorStyleSubject.parseColor.rgbRe=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i; ColorStyleSubject.parseColor.hexRe=/^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function DiscreteStyleSubject(a,c,b,d,e){this.els=Animator.makeArray(a);this.property=Animator.camelize(c);this.from=b;this.to=d;this.threshold=e||0.5}DiscreteStyleSubject.prototype={setState:function(a){for(var c=0;c=a?(this.forwards=!1,this.animators[this.current].seekTo(0)):(this.forwards=!0,this.animators[this.current].seekTo(1))}}; function Accordion(a){this.setOptions(a);var a=this.options.initialSection,c;this.options.rememberance&&(c=document.location.hash.substring(1));this.rememberanceTexts=[];this.ans=[];for(var b=this,d=0;da?1:0);this.options.rememberance&&(document.location.hash=this.rememberanceTexts[a])}};var threeSixtyPlayer,ThreeSixtyPlayer; (function(a){function c(){var b=this,c=this,e=soundManager,f=navigator.userAgent,i=f.match(/msie/i),g=f.match(/opera/i),j=f.match(/safari/i),k=f.match(/chrome/i);f.match(/firefox/i);var n=f.match(/ipad|iphone/i),p="undefined"===typeof a.G_vmlCanvasManager&&"undefined"!==typeof document.createElement("canvas").getContext("2d"),l=g||k?359.9:360;this.excludeClass="threesixty-exclude";this.links=[];this.sounds=[];this.soundsByURL=[];this.indexByURL=[];this.lastTouchedSound=this.lastSound=null;this.soundCount= 0;this.vuMeter=this.oUIImageMap=this.oUITemplate=null;this.callbackCount=0;this.peakDataHistory=[];this.config={playNext:!1,autoPlay:!1,allowMultiple:!1,loadRingColor:"#ccc",playRingColor:"#000",backgroundRingColor:"#eee",segmentRingColor:"rgba(255,255,255,0.33)",segmentRingColorAlt:"rgba(0,0,0,0.1)",loadRingColorMetadata:"#ddd",playRingColorMetadata:"rgba(128,192,256,0.9)",circleDiameter:null,circleRadius:null,animDuration:500,animTransition:a.Animator.tx.bouncy,showHMSTime:!1,scaleFont:!0,useWaveformData:!1, waveformDataColor:"#0099ff",waveformDataDownsample:3,waveformDataOutside:!1,waveformDataConstrain:!1,waveformDataLineRatio:0.64,useEQData:!1,eqDataColor:"#339933",eqDataDownsample:4,eqDataOutside:!0,eqDataLineRatio:0.54,usePeakData:!0,peakDataColor:"#ff33ff",peakDataOutside:!0,peakDataLineRatio:0.5,useAmplifier:!0,fontSizeMax:null,scaleArcWidth:1,useFavIcon:!1};this.css={sDefault:"sm2_link",sBuffering:"sm2_buffering",sPlaying:"sm2_playing",sPaused:"sm2_paused"};this.addEventHandler="undefined"!== typeof a.addEventListener?function(a,b,c){return a.addEventListener(b,c,!1)}:function(a,b,c){a.attachEvent("on"+b,c)};this.removeEventHandler="undefined"!==typeof a.removeEventListener?function(a,b,c){return a.removeEventListener(b,c,!1)}:function(a,b,c){return a.detachEvent("on"+b,c)};this.hasClass=function(a,b){return"undefined"!==typeof a.className?a.className.match(RegExp("(\\s|^)"+b+"(\\s|$)")):!1};this.addClass=function(a,c){if(!a||!c||b.hasClass(a,c))return!1;a.className=(a.className?a.className+ " ":"")+c};this.removeClass=function(a,c){if(!a||!c||!b.hasClass(a,c))return!1;a.className=a.className.replace(RegExp("( "+c+")|("+c+")","g"),"")};this.getElementsByClassName=function(a,c,d){var e=d||document,d=[],f,g=[];if("undefined"!==typeof c&&"string"!==typeof c)for(f=c.length;f--;){if(!g||!g[c[f]])g[c[f]]=e.getElementsByTagName(c[f])}else g=c?e.getElementsByTagName(c):e.all||e.getElementsByTagName("*");if("string"!==typeof c)for(f=c.length;f--;)for(e=g[c[f]].length;e--;)b.hasClass(g[c[f]][e], a)&&d.push(g[c[f]][e]);else for(f=0;fc?"0"+c:c):{min:d,sec:c}};this.clearCanvas=function(a){var b=null,c;a.getContext&&(b=a.getContext("2d"));c=a.offsetWidth;a=a.offsetHeight;b.clearRect(-(c/2),-(a/2), c,a)};this.updatePlaying=function(){var a=this._360data.showHMSTime?b.getTime(this.position,!0):parseInt(this.position/1E3,10),c=b.config.scaleArcWidth;this.bytesLoaded&&(this._360data.lastValues.bytesLoaded=this.bytesLoaded,this._360data.lastValues.bytesTotal=this.bytesTotal);this.position&&(this._360data.lastValues.position=this.position);this.durationEstimate&&(this._360data.lastValues.durationEstimate=this.durationEstimate);b.drawSolidArc(this._360data.oCanvas,b.config.backgroundRingColor,this._360data.width, this._360data.radius*c,b.deg2rad(l),!1);b.drawSolidArc(this._360data.oCanvas,this._360data.metadata?b.config.loadRingColorMetadata:b.config.loadRingColor,this._360data.width,this._360data.radius*c,b.deg2rad(l*(this._360data.lastValues.bytesLoaded/this._360data.lastValues.bytesTotal)),0,!0);0!==this._360data.lastValues.position&&b.drawSolidArc(this._360data.oCanvas,this._360data.metadata?b.config.playRingColorMetadata:b.config.playRingColor,this._360data.width,this._360data.radius*c,b.deg2rad(1=== this._360data.didFinish?l:l*(this._360data.lastValues.position/this._360data.lastValues.durationEstimate)),0,!0);this._360data.metadata&&this._360data.metadata.events.whileplaying();a!==this._360data.lastTime&&(this._360data.lastTime=a,this._360data.oTiming.innerHTML=a);(this.instanceOptions.useWaveformData||this.instanceOptions.useEQData)&&p&&b.updateWaveform(this);b.config.useFavIcon&&b.vuMeter&&b.vuMeter.updateVU(this)};this.updateWaveform=function(a){if(!b.config.useWaveformData&&!b.config.useEQData|| !e.features.waveformData&&!e.features.eqData||!a.waveformData.left.length&&!a.eqData.length&&!a.peakData.left)return!1;a._360data.oCanvas.getContext("2d");var c=parseInt(a._360data.circleDiameter/2,10)/2,d,f,g,j,i,k,n,l,p;if(b.config.useWaveformData){g=b.config.waveformDataDownsample;g=Math.max(1,g);j=256/g;n=b.config.waveformDataOutside?1:b.config.waveformDataConstrain?0.5:0.565;c=b.config.waveformDataOutside?0.7:0.75;l=b.deg2rad(360/j*b.config.waveformDataLineRatio);for(d=0;256>d;d+=g)i=b.deg2rad(360* (1*(d/j)/g)),k=i+l,f=a.waveformData.left[d],0>f&&b.config.waveformDataConstrain&&(f=Math.abs(f)),b.drawSolidArc(a._360data.oCanvas,b.config.waveformDataColor,a._360data.width*n*(2-b.config.scaleArcWidth),1.25*(a._360data.radius*c)*f,k,i,!0)}if(b.config.useEQData){g=b.config.eqDataDownsample;g=Math.max(1,g);j=192;n=b.config.eqDataOutside?1:0.565;f=b.config.eqDataOutside?-1:1;c=b.config.eqDataOutside?0.5:0.75;l=b.deg2rad(360/(j/g)*b.config.eqDataLineRatio);p=b.deg2rad(1===a._360data.didFinish?360:360* (a._360data.lastValues.position/a._360data.lastValues.durationEstimate));for(d=0;dp?b.config.eqDataColor:b.config.playRingColor,a._360data.width*n,a._360data.radius*c*a.eqData.left[d]*f,k,i,!0)}if(b.config.usePeakData&&!a._360data.animating){c=a.peakData.left||a.peakData.right;j=3;for(d=0;d',' ','
','
']}; this.uiTest=function(a){var c=document.createElement("div"),d,e;c.className="sm2-360ui";d=document.createElement("div");d.className="ui360"+(a?" "+a:"");c=d.appendChild(c.cloneNode(!0));d.style.position="absolute";d.style.left="-9999px";a=document.body.appendChild(d);e=b.getUIHTML(c.offsetWidth);c.innerHTML=e[1]+e[2]+e[3];c=parseInt(c.offsetWidth,10);e=parseInt(c/2,10);a=b.getElementsByClassName("sm2-timing","div",a)[0];a=parseInt(b.getStyle(a,"font-size"),10);isNaN(a)&&(a=null);d.parentNode.removeChild(d); return{circleDiameter:c,circleRadius:e,fontSizeMax:a}};this.init=function(){e._writeDebug("threeSixtyPlayer.init()");var c=b.getElementsByClassName("ui360","div"),d,f,g=[],j=!1,k=0,l,p,s,q,u;d=0;for(f=c.length;da;a++)c.vuMeterData[a]=[];for(a=0;16>a;a++)for(b=0;16>b;b++)c.vuDataCanvas.setAttribute("width",16),c.vuDataCanvas.setAttribute("height",16),e.fillStyle=i,e.fillRect(0,0,7,15),e.fillRect(8,0,7,15),e.fillStyle=f,e.fillRect(0,15-a,7,16-(16-a)),e.fillRect(8,15-b,7,16-(16-b)),e.clearRect(0,3,16,1),e.clearRect(0, 7,16,1),e.clearRect(0,11,16,1),c.vuMeterData[a][b]=c.vuDataCanvas.toDataURL("image/png")};this.testCanvas=function(){var a=document.createElement("canvas"),b=null;if(!a||"undefined"===typeof a.getContext)return null;b=a.getContext("2d");if(!b||"function"!==typeof a.toDataURL)return null;try{a.toDataURL("image/png")}catch(c){return null}return a};this.init=function(){a.config.useFavIcon&&(c.vuDataCanvas=c.testCanvas(),c.vuDataCanvas&&(i||f)?c.createVUData():a.config.useFavIcon=!1)};this.init()};c.prototype.Metadata= function(a,c){soundManager._wD("Metadata()");var e=this,f=a._360data.oUI360,i=f.getElementsByTagName("ul")[0].getElementsByTagName("li");navigator.userAgent.match(/firefox/i);var g;this.lastWPExec=0;this.refreshInterval=250;this.totalTime=0;this.events={whileplaying:function(){var f=a._360data.width,g=a._360data.radius,i=a.durationEstimate||1E3*e.totalTime,p=null,l,h;l=0;for(h=e.data.length;le.refreshInterval&&(e.refresh(),e.lastWPExec=f)}};this.refresh=function(){var c,d,e=null,f=a.position,g=a._360data.metadata.data;c=0;for(d=g.length;c=g[c].startTimeMS&&f<=g[c].endTimeMS){e=c;break}e!==g.currentItem&&e