File size: 985B
// Ion.Sound
// version 1.2.0 Build: 16
// https://github.com/IonDen/ion.sound
(function(c){if(!c.ionSound){var d={},f,g,k,b,e={},h=!1,m=function(b){var a,l;-1!==b.indexOf(":")?(a=b.split(":")[0],l=b.split(":")[1]):a=b;e[a]=new Audio;g=e[a].canPlayType("audio/mp3");k="probably"===g||"maybe"===g?d.path+a+".mp3":d.path+a+".ogg";c(e[a]).prop("src",k);e[a].load();e[a].volume=l||d.volume},n=function(b){var a=e[b],c;if("object"===typeof a&&null!==a)if(!d.multiPlay&&!h)a.play(),h=!0,c=setInterval(function(){a.ended&&(clearInterval(c),h=!1)},250);else if(d.multiPlay){if(!a.ended)try{a.currentTime=0}catch(f){}a.play()}};c.ionSound=function(e){d=c.extend({sounds:["water_droplet"],path:"static/sounds/",multiPlay:!0,volume:"0.5"},e);f=d.sounds.length;if("function"===typeof Audio||"object"===typeof Audio)for(b=0;b<f;b+=1)m(d.sounds[b]);c.ionSound.play=function(a){n(a)}};c.ionSound.destroy=function(){for(b=0;b<f;b+=1)e[d.sounds[b]]=null;f=0;c.ionSound.play=function(){}}}})(jQuery);