scratch – Rev 73

Subversion Repositories:
Rev:
/*!
* @license SoundJS
* Visit http://createjs.com/ for documentation, updates and examples.
*
* Copyright (c) 2011-2015 gskinner.com, inc.
*
* Distributed under the terms of the MIT license.
* http://www.opensource.org/licenses/mit-license.html
*
* This notice shall be included in all copies or substantial portions of the Software.
*/

/**!
 * SoundJS FlashAudioPlugin also includes swfobject (http://code.google.com/p/swfobject/)
 */

/*!     SWFObject v2.2 <http://code.google.com/p/swfobject/> 
        is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){function a(){if(!R){try{var a=K.getElementsByTagName("body")[0].appendChild(q("span"));a.parentNode.removeChild(a)}catch(b){return}R=!0;for(var c=N.length,d=0;c>d;d++)N[d]()}}function b(a){R?a():N[N.length]=a}function c(a){if(typeof J.addEventListener!=C)J.addEventListener("load",a,!1);else if(typeof K.addEventListener!=C)K.addEventListener("load",a,!1);else if(typeof J.attachEvent!=C)r(J,"onload",a);else if("function"==typeof J.onload){var b=J.onload;J.onload=function(){b(),a()}}else J.onload=a}function d(){M?e():f()}function e(){var a=K.getElementsByTagName("body")[0],b=q(D);b.setAttribute("type",G);var c=a.appendChild(b);if(c){var d=0;!function(){if(typeof c.GetVariable!=C){var e=c.GetVariable("$version");e&&(e=e.split(" ")[1].split(","),U.pv=[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10)])}else if(10>d)return d++,void setTimeout(arguments.callee,10);a.removeChild(b),c=null,f()}()}else> f()}function f(){var a=O.length;if(a>0)for(var b=0;a>b;b++){var c=O[b].id,d=O[b].callbackFn,e={success:!1,id:c};if(U.pv[0]>0){var f=p(c);if(f)if(!s(O[b].swfVersion)||U.wk&&U.wk<312)if(O[b].expressInstall&&h()){var k={};k.data=O[b].expressInstall,k.width=f.getAttribute("width")||"0",k.height=f.getAttribute("height")||"0",f.getAttribute("class")&&(k.styleclass=f.getAttribute("class")),f.getAttribute("align")&&(k.align=f.getAttribute("align"));for(var l={},m=f.getElementsByTagName("param"),n=m.length,o=0;n>o;o++)"movie"!=m[o].getAttribute("name").toLowerCase()&&(l[m[o].getAttribute("name")]=m[o].getAttribute("value"));i(k,l,c,d)}else j(f),d&&d(e);else u(c,!0),d&&(e.success=!0,e.ref=g(c),d(e))}else if(u(c,!0),d){var q=g(c);q&&typeof q.SetVariable!=C&&(e.success=!0,e.ref=q),d(e)}}}function g(a){var b=null,c=p(a);if(c&&"OBJECT"==c.nodeName)if(typeof c.SetVariable!=C)b=c;else{var d=c.getElementsByTagName(D)[0];d&&(b=d)}return b}function h(){return!S&&s("6.0.65")&&(U.win||U.mac)&&!(U.wk&&U.wk<312)}function i(a,b,c,d){S=!0,y=d||null,z={success:!1,id:c};var e=p(c);if(e){"OBJECT"==e.nodeName?(w=k(e),x=null):(w=e,x=c),a.id=H,(typeof a.width==C||!/%$/.test(a.width)&&parseInt(a.width,10)<310)&&(a.width="310"),(typeof a.height==C||!/%$/.test(a.height)&&parseInt(a.height,10)<137)&&(a.height="137"),K.title=K.title.slice(0,47)+" - Flash Player Installation";var f=U.ie&&U.win?"ActiveX":"PlugIn"</FONT>,g="MMredirectURL="+encodeURI(window.location).toString().replace(/&/g,"%26")+"&MMplayerType="+f+"&MMdoctitle="+K.title;if(typeof b.flashvars!=C?b.flashvars+="&"+g:b.flashvars=g,U.ie&&U.win&&4!=e.readyState){var h=q("div");c+="SWFObjectNew",h.setAttribute("id",c),e.parentNode.insertBefore(h,e),e.style.display="none",function(){4==e.readyState?e.parentNode.removeChild(e):setTimeout(arguments.callee,10)}()}l(a,b,c)}}COLOR="#A020F0">function j(a){if(U.ie&&U.win&&4!=a.readyState){var b=q("div");a.parentNode.insertBefore(b,a),b.parentNode.replaceChild(k(a),b),a.style.display="none",function(){4==a.readyState?a.parentNode.removeChild(a):setTimeout(arguments.callee,10)}()}else a.parentNode.replaceChild(k(a),a)}function k(a){var b=q("div");if(U.win&&U.ie)b.innerHTML=a.innerHTML;else{var c=a.getElementsByTagName(D)[0];if(c){COLOR="#A020F0">var d=c.childNodes;if(d)for(var e=d.length,f=0;e>f;f++)1==d[f].nodeType&&"PARAM"==d[f].nodeName||8==d[f].nodeType||b.appendChild(d[f].cloneNode(!0))}}return b}function l(a,b,c){var d,e=p(c);if(U.wk&&U.wk<312)return d;if(e)if(typeof a.id==C&&(a.id=c),U.ie&&U.win){var f="";for(var g in a)a[g]!=Object.prototype[g]&&("data"==g.toLowerCase()?b.movie=a[g]:"styleclass"==g.toLowerCase()?f+=' class="'+a[g]+'"':"classid"!=g.toLowerCase()&&(f+=" "+g+'="'+a[g]+'"'));var h="";for(var i in b)b[i]!=Object.prototype[i]&&(h+='<param name="'+i+'" value="'+b[i]+'" />');e.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+f+">"+h+"</object>",P[P.length]=a.id,d=p(a.id)}else{var j=q(D);j.setAttribute("type",G);for(var k in a)a[k]!=Object.prototype[k]&&("styleclass"==k.toLowerCase()?j.setAttribute("class",a[k]):"classid"!=k.toLowerCase()&&j.setAttribute(k,a[k]));for(var l in b)b[l]!=Object.prototype[l]&&"movie"!=l.toLowerCase()&&m(j,l,b[l]);e.parentNode.replaceChild(j,e),d=j}return d}function m(a,b,c){var d=q("param");d.setAttribute("name",b),d.setAttribute("value",c),a.appendChild(d)}function n(a){var b=p(a);b&&"OBJECT"==b.nodeName&&(U.ie&&U.win?(b.style.display="none",function(){4==b.readyState?o(a):setTimeout(arguments.callee,10)}()):b.parentNode.removeChild(b))}function o(a){var b=p(a);if(b){for(var c in b)"function"==typeof b[c]&&(b[c]=null);b.parentNode.removeChild(b)}}function p(a){var b=null;try{b=K.getElementById(a)}catch(c){}return b}function q(a){return K.createElement(a)}function r(a,b,c){a.attachEvent(b,c),Q[Q.length]=[a,b,c]}function s(a){var b=U.pv,c=a.split(".");return c[0]=parseInt(c[0],10),c[1]=parseInt(c[1],10)||0,c[2]=parseInt(c[2],10)||0,b[0]>c[0]||b[0]==c[0]&&b[1]>c[1]||b[0]==c[0]&&b[1]==c[1]&&b[2]>=c[2]?!0:!1}function t(a,b,c,d){if(!U.ie||!U.mac){var e=K.getElementsByTagName("head")[0];if(e){var f=c&&"string"==typeof c?c:"screen";if(d&&(A=null,B=null),!A||B!=f){<FONT COLOR="#A020F0">var g=q("style");g.setAttribute("type","text/css"),g.setAttribute("media",f),A=e.appendChild(g),U.ie&&U.win&&typeof K.styleSheets!=C&&K.styleSheets.length>0&&(A=K.styleSheets[K.styleSheets.length-1]),B=f}U.ie&&U.win?A&&typeof A.addRule==D&&A.addRule(a,b):A&&typeof K.createTextNode!=C&&A.appendChild(K.createTextNode(a+" {"+b+"}"))}}}function u(a,b){if(T){var c=b?"visible":"hidden";R&&p(a)?p(a).style.visibility=c:t("#"+a,"visibility:"+c)}}function v(a){var b=/[\\\"<>\.;]/,c=null!=b.exec(a);return c&&typeof encodeURIComponent!=C?encodeURIComponent(a):a}{var w,x,y,z,A,B,C="undefined",D="object",E="Shockwave Flash",F="ShockwaveFlash.ShockwaveFlash",G="application/x-shockwave-flash",H="SWFObjectExprInst",I="onreadystatechange",J=window,K=document,L=navigator,M=!1,N=[d],O=[],P=[],Q=[],R=!1,S=!1,T=!0,U=function(){var a=typeof K.getElementById!=C&&typeof K.getElementsByTagName!=C&&typeof K.createElement!=C,b=L.userAgent.toLowerCase(),c=L.platform.toLowerCase(),d=/win/.test(c?c:b),e=/mac/.test(c?c:b),f=/webkit/.test(b)?parseFloat(b.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):!1,g=!1,h=[0,0,0],i=null;if(typeof L.plugins!=C&&typeof L.plugins[E]==D)i=L.plugins[E].description,!i||typeof L.mimeTypes!=C&&L.mimeTypes[G]&&!L.mimeTypes[G].enabledPlugin||(M=!0,g=!1,i=i.replace(/^.*\s+(\S+\s+\S+$)/,"$1"),h[0]=parseInt(i.replace(/^(.*)\..*$/,"$1"),10),h[1]=parseInt(i.replace(/^.*\.(.*)\s.*$/,"$1"),10),h[2]=/[a-zA-Z]/.test(i)?parseInt(i.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0);else if(typeof J.ActiveXObject!=C)try{var j=new ActiveXObject(F);j&&(i=j.GetVariable("$version"),i&&(g=!0,i=i.split(" ")[1].split(LOR="#BC8F8F">","),h=[parseInt(i[0],10),parseInt(i[1],10),parseInt(i[2],10)]))}catch(k){}return{w3:a,pv:h,wk:f,ie:g,win:d,mac:e}}();!function(){U.w3&&((typeof K.readyState!=C&&"complete"==K.readyState||typeof K.readyState==C&&(K.getElementsByTagName("body")[0]||K.body))&&a(),R||(typeof K.addEventListener!=C&&K.addEventListener("DOMContentLoaded",a,!1),U.ie&&U.win&&(K.attachEvent(I,function(){"complete"==K.readyState&&(K.detachEvent(I,arguments.callee),a())}),J==top&&!function(){if(!R){try{K.documentElement.doScroll("left")}catch(b){return void setTimeout(arguments.callee,0)}a()}}()),U.wk&&!function(){return R?void 0:/loaded|complete/.test(K.readyState)?void a():void setTimeout(arguments.callee,0)}(),c(a)))}(),function(){U.ie&&U.win&&window.attachEvent("onunload",function(){for(var a=Q.length,b=0;a>b;b++)Q[b][0].detachEvent(Q[b][1],Q[b][2]);for(var c=P.length,d=0;c>d;d++)n(P[d]);for(var e in U)U[e]=null;U=null;for(var f in swfobject)swfobject[f]=null;swfobject=null})}()}return{registerObject:function(a,b,c,d){if(U.w3&&a&&b){var e={};e.id=a,e.swfVersion=b,e.expressInstall=c,e.callbackFn=d,O[O.length]=e,u(a,!1)}else d&&d({success:!1,id:a})},getObjectById:functionONT>(a){return U.w3?g(a):void 0},embedSWF:function(a,c,d,e,f,g,j,k,m,n){var o={success:!1,id:c};U.w3&&!(U.wk&&U.wk<312)&&a&&c&&d&&e&&f?(u(c,!1),b(function(){d+="",e+="";var b={};if(m&&typeof m===D)for(var p in m)b[p]=m[p];b.data=a,b.width=d,b.height=e;var q={};if(k&&typeof k===D)for(var r in k)q[r]=k[r];T COLOR="#A020F0">if(j&&typeof j===D)for(var t in j)typeof q.flashvars!=C?q.flashvars+="&"+t+"="+j[t]:q.flashvars=t+"="+j[t];if(s(f)){var v=l(b,q,c);b.id==c&&u(c,!0),o.success=!0,o.ref=v}else{if(g&&h())return b.data=g,void i(b,q,c,n);u(c,!0)}n&&n(o)})):n&&n(o)},switchOffAutoHideShow:function(){T=!1},ua:U,getFlashPlayerVersion:function(){return{major:U.pv[0],minor:U.pv[1],release:U.pv[2]}},hasFlashPlayerVersion:s,createSWF:function(a,b,c){return U.w3?l(a,b,c):void 0},showExpressInstall:function(a,b,c,d){U.w3&&h()&&i(a,b,c,d)},removeSWF:function(a){U.w3&&n(a)},createCSS:function(a,b,c,d){U.w3&&t(a,b,c,d)},addDomLoadEvent:b,addLoadEvent:c,getQueryParamValue:function(a){var b=K.location.search||K.location.hash;if(b){if(/\?/.test(b)&&(b=b.split("?")[1]),null==a)return v(b);for(var c=b.split("&"),d=0;d<c.length;d++)if(c[d].substring(0,c[d].indexOf("="))==a)return v(c[d].substring(c[d].indexOf("=")+1))}return""},expressInstallCallback:function(){if(S){var a=p(H);a&&w&&(a.parentNode.replaceChild(w,a),x&&(u(x,!0),U.ie&&U.win&&(w.style.display="block")),y&&y(z)),S=!1}}}}();this.createjs=this.createjs||{},function(){"use strict";function a(a){this.AbstractLoader_constructor(a,!1,createjs.AbstractLoader.SOUND),this.flashId=null}var b=createjs.extend(a,createjs.AbstractLoader),c=a;c._flash=null,c._preloadInstances=[],c.setFlash=function(a){c._flash=a;for(var b=c._preloadInstances.length;b--;){var d=c._preloadInstances.pop();d.load()}},b.load=function(){if(null==c._flash)return void c._preloadInstances.push(this);this.flashId=c._flash.preload(this._item.src);var a=new createjs.Event(createjs.FlashAudioPlugin._REG_FLASHID);this.dispatchEvent(a)},b.handleProgress=function(a,b){this._sendProgress(a/b)},b.handleComplete=function(){this._result=this._item.src,this._sendComplete()},b.handleError=function(a){this._handleError(a)},b.destroy=function(){var a=new createjs.Event(createjs.FlashAudioPlugin._UNREG_FLASHID);this.dispatchEvent(a),this.AbstractLoader_destroy()},b.toString=function(){return"[FlashAudioLoader]"},createjs.FlashAudioLoader=createjs.promote(a,"AbstractLoader")}(),this.createjs=this.createjs||{},function(){"use strict";function FlashAudioSoundInstance(a,c,d,e){this.AbstractSoundInstance_constructor(a,c,d,e),this.flashId=null,null==b._flash&&b._instances.push(this)}var a=createjs.extend(FlashAudioSoundInstance,createjs.AbstractSoundInstance),b=FlashAudioSoundInstance;b._flash=null,b._instances=[],b.setFlash=function(a){b._flash=a;for(var c=b._instances.length;c--;){var d=b._instances.pop();d._setDurationFromSource()}},a.setLoop=function(a){null!=this.flashId&&b._flash.setLoop(this.flashId,a),this._loop=a},a.toString=function(){return"[FlashAudioSoundInstance]"},a._updateVolume=function(){null!=this.flashId&&b._flash.setVolume(this.flashId,this._volume)},a._updatePan=function(){null!=this.flashId&&b._flash.setPan(this.flashId,this._pan)},a._setDurationFromSource=function(){this._duration=b._flash.getDurationBySrc(this.src)},a._interrupt=function(){null!=this.flashId&&(b._flash.interrupt(this.flashId),this.AbstractSoundInstance__interrupt())},a._handleCleanUp=function(){b._flash.stopSound(this.flashId),this._sendEvent(createjs.FlashAudioPlugin._UNREG_FLASHID),this.flashId=null},a._beginPlaying=function(a){return null==b._flash?!1:(this.setPosition(a.offset),this.setLoop(a.loop),this.setVolume(a.volume),this.setPan(a.pan),null!=a.startTime&&(this.setStartTime(a.startTime),this.setDuration(a.duration)),this._paused=!1,this.flashId=b._flash.playSound(this.src,this._position,this._loop,this._volume,this._pan,this._startTime,this._duration),null==this.flashId?(this._playFailed(),!1):(this._muted&&this.setMute(!0),this._sendEvent(createjs.FlashAudioPlugin._REG_FLASHID),this.playState=createjs.Sound.PLAY_SUCCEEDED,this._sendEvent("succeeded"),!0))},a._pause=function(){null!=this.flashId&&(this._position=this._calculateCurrentPosition(),b._flash.pauseSound(this.flashId))},a._resume=function(){null!=this.flashId&&b._flash.resumeSound(this.flashId)},a._handleStop=function(){null!=this.flashId&&b._flash.stopSound(this.flashId)},a._updateVolume=function(){var a=this._muted?0:this._volume;b._flash.setVolume(this.flashId,a)},a._calculateCurrentPosition=function(){return b._flash.getPosition(this.flashId)},a._updatePosition=function(){null!=this.flashId&&b._flash.setPosition(this.flashId,this._position)},a.handleSoundFinished=function(){this._loop=0,this._handleSoundComplete()},a.handleSoundLoop=function(){this._loop--,this._sendEvent("loop")},createjs.FlashAudioSoundInstance=createjs.promote(FlashAudioSoundInstance,"AbstractSoundInstance")}(),this.createjs=this.createjs||{},function(){"use strict";function FlashAudioPlugin(){this.AbstractPlugin_constructor(),this.showOutput=!1,this._CONTAINER_ID="flashAudioContainer",this._WRAPPER_ID="SoundJSFlashContainer",this._container=null,this._flash=null,this.flashReady=!1,this._flashInstances={},this._flashPreloadInstances={},this._capabilities=b._capabilities,this._loaderClass=createjs.FlashAudioLoader,this._soundInstanceClass=createjs.FlashAudioSoundInstance;var a=this.wrapper=document.createElement("div");a.id=this._WRAPPER_ID,a.style.position="absolute",a.style.marginLeft="-1px",a.className=this._WRAPPER_ID,document.body.appendChild(a);var c=this._container=document.createElement("div");c.id=this._CONTAINER_ID,c.appendChild(document.createTextNode("SoundJS Flash Container")),a.appendChild(c);{var d=b.swfPath;swfobject.embedSWF(d+"FlashAudioPlugin.swf",this._CONTAINER_ID,"1","1","9.0.0",null,null,{AllowScriptAccess:"always"},null,createjs.proxy(this._handleSWFReady,this))}}var a=createjs.extend(FlashAudioPlugin,createjs.AbstractPlugin),b=FlashAudioPlugin;b._REG_FLASHID="registerflashid",b._UNREG_FLASHID="unregisterflashid",b._capabilities=null,b.swfPath="src/soundjs/flashaudio/",b.isSupported=function(){return createjs.BrowserDetect.isIOS||createjs.BrowserDetect.isAndroid||createjs.BrowserDetect.isBlackberry||createjs.BrowserDetect.isWindowsPhone?!1:(b._generateCapabilities(),null==swfobject?!1:swfobject.hasFlashPlayerVersion("9.0.0"))},b._generateCapabilities=function(){if(null==b._capabilities){b._capabilities={panning:!0,volume:!0,tracks:-1,mp3:!0,ogg:!1,mpeg:!0,wav:!0,m4a:!1,mp4:!1,aiff:!1,wma:!1,mid:!1}}},a.register=function(a,c){var d=this.AbstractPlugin_register(a,c);return d.addEventListener(b._REG_FLASHID,createjs.proxy(this.registerPreloadInstance,this)),d.addEventListener(b._UNREG_FLASHID,createjs.proxy(this.unregisterPreloadInstance,this)),d},a.removeAllSounds=function(){this._flashInstances={},this._flashPreloadInstances={},this.AbstractPlugin_removeAllSounds()},a.create=function(a,c,d){var e=this.AbstractPlugin_create(a,c,d);return e.on(b._REG_FLASHID,this.registerSoundInstance,this),e.on(b._UNREG_FLASHID,this.unregisterSoundInstance,this),e},a.toString=function(){return"[FlashAudioPlugin]"},a._handleSWFReady=function(a){this._flash=a.ref},a._handleFlashReady=function(){this.flashReady=!0,this._loaderClass.setFlash(this._flash),this._soundInstanceClass.setFlash(this._flash)},a._updateVolume=function(){var a=createjs.Sound._masterMute?0:this._volume;return this._flash.setMasterVolume(a)},a.registerPreloadInstance=function(a){this._flashPreloadInstances[a.target.flashId]=a.target},a.unregisterPreloadInstance=function(a){delete this._flashPreloadInstances[a.target.flashId]},a.registerSoundInstance=function(a){this._flashInstances[a.target.flashId]=a.target},a.unregisterSoundInstance=function(a){delete this._flashInstances[a.target.flashId]},a.flashLog=function(a){try{this.showOutput&&console.log(a)}catch(b){}},a.handleSoundEvent=function(a,b){var c=this._flashInstances[a];if(null!=c){for(var d=[],e=2,f=arguments.length;f>e;e++)d.push(arguments[e]);try{0==d.length?c[b]():c[b].apply(c,d)}catch(g){}}},a.handlePreloadEvent=function(a,b){var c=this._flashPreloadInstances[a];if(null!=c){for(var d=[],e=2,f=arguments.length;f>e;e++)d.push(arguments[e]);try{0==d.length?c[b]():c[b].apply(c,d)}catch(g){}}},a.handleEvent=function(a){switch(a){case"ready":this._handleFlashReady()}},a.handleErrorEvent=function(a){},createjs.FlashAudioPlugin=createjs.promote(FlashAudioPlugin,"AbstractPlugin")}(),this.createjs=this.createjs||{},function(){var a=createjs.FlashAudioPlugin=createjs.FlashAudioPlugin||{};a.version="NEXT",a.buildDate="Mon, 14 Sep 2015 19:11:47 GMT"}();

Generated by GNU Enscript 1.6.5.90.