/** * The core script for public-facing CASH Music elements and embeds * http://cashmusic.org/ * * License: BSD, included in uncompressed source * Source: https://raw.github.com/cashmusic/platform/master/interfaces/php/public/cashmusic_uncompressed.js */ ;window.cashmusic=(function(){var a;if(window.cashmusic!=null){a=window.cashmusic;}else{a={getXHR:function(){try{return new XMLHttpRequest();}catch(c){try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(d){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(b){return false;}}}},embed:function(h,k,l,g,i){var f="cashmusic_embed"+Math.floor((Math.random()*1000000)+1);var m=h+"/request/embed/"+k+"/location/"+encodeURIComponent(window.location.href.replace(/\//g,"!slash!"));if(l){var b=document.querySelector(l);}else{var d=document.querySelectorAll('script[src="'+h+'cashmusic.js"]');var b=d[d.length-1];}if(b){var c=document.createElement("div");c.className="cashmusic_embed";if(g){if(!i){i="open element";}var j="cashmusic_embed"+Math.floor((Math.random()*1000000)+1);c.innerHTML=''+i+'';b.parentNode.insertBefore(c,b);document.getElementById(f).addEventListener("click",function(p){window.cashmusic.fadeEffect.init(j,1,100);p.preventDefault();},false);window.addEventListener("keyup",function(r){if(r.keyCode==27){var q=document.querySelectorAll("div.cashmusic_embed_overlay");for(var p=0;p';c.innerHTML=o;b.parentNode.insertBefore(c,b);var n=document.getElementById(f);var e=function(q){if(q.data.substring(0,15)=="cashmusic_embed"){var p=q.data.split("_");if(p[2]==k){if(m.indexOf(q.origin)!==-1){n.height=p[3]+"px";if(window.addEventListener){window.removeEventListener("message",e,false);}else{if(window.attachEvent){window.detachEvent("onmessage",e);}}}}}};if(window.addEventListener){window.addEventListener("message",e,false);}else{if(window.attachEvent){window.attachEvent("onmessage",e);}}}}},encodeForm:function(d){if(typeof d!=="object"){return false;}var b="";d=d.elements||d;for(var c=0;c0){this.elem.style.display="block";}this.si=setInterval(function(){window.cashmusic.fadeEffect.tween();},20);},tween:function(){if(this.alpha==this.target){clearInterval(this.elem.si);}else{var b=Math.round(this.alpha+((this.target-this.alpha)*0.05))+(this.flag);this.elem.style.opacity=b/100;this.elem.style.filter="alpha(opacity="+b+")";if(b==0){this.elem.style.display="none";}this.alpha=b;}}},sendXHR:function(c,d,b){var f="POST";if(!d){f="GET";d=null;}var e=this.getXHR();if(e){e.open(f,c,true);e.setRequestHeader("X-Requested-With","XMLHttpRequest");if(f=="POST"){e.setRequestHeader("Content-type","application/x-www-form-urlencoded");}if(typeof b=="function"){e.onreadystatechange=function(){if(e.readyState===4&&e.status===200){b(e.responseText);}};}e.send(d);}}};}return a;}());