summaryrefslogtreecommitdiffstats
path: root/wp-includes/js/scriptaculous/sound.js
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-05-21 18:37:58 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-05-21 18:37:58 +0000
commit89fe0ff804e7c6497ebacc8b341ac89974f6f255 (patch)
tree3fce310b29c685008fdbb75c5ab531bc3a6ae12a /wp-includes/js/scriptaculous/sound.js
parenta139071806ba941346a109fbefb2d5f22bae1cc4 (diff)
downloadwordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.gz
wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.tar.xz
wordpress-mu-89fe0ff804e7c6497ebacc8b341ac89974f6f255.zip
WP Merge to rev 5499, this is a big one! Test it before you put it live!
Test only, not for production use yet git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@972 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-includes/js/scriptaculous/sound.js')
-rw-r--r--wp-includes/js/scriptaculous/sound.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/wp-includes/js/scriptaculous/sound.js b/wp-includes/js/scriptaculous/sound.js
new file mode 100644
index 0000000..fab10e8
--- /dev/null
+++ b/wp-includes/js/scriptaculous/sound.js
@@ -0,0 +1,60 @@
+// script.aculo.us sound.js v1.7.1_beta2, Sat Apr 28 15:20:12 CEST 2007
+
+// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
+//
+// Based on code created by Jules Gravinese (http://www.webveteran.com/)
+//
+// script.aculo.us is freely distributable under the terms of an MIT-style license.
+// For details, see the script.aculo.us web site: http://script.aculo.us/
+
+Sound = {
+ tracks: {},
+ _enabled: true,
+ template:
+ new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
+ enable: function(){
+ Sound._enabled = true;
+ },
+ disable: function(){
+ Sound._enabled = false;
+ },
+ play: function(url){
+ if(!Sound._enabled) return;
+ var options = Object.extend({
+ track: 'global', url: url, replace: false
+ }, arguments[1] || {});
+
+ if(options.replace && this.tracks[options.track]) {
+ $R(0, this.tracks[options.track].id).each(function(id){
+ var sound = $('sound_'+options.track+'_'+id);
+ sound.Stop && sound.Stop();
+ sound.remove();
+ })
+ this.tracks[options.track] = null;
+ }
+
+ if(!this.tracks[options.track])
+ this.tracks[options.track] = { id: 0 }
+ else
+ this.tracks[options.track].id++;
+
+ options.id = this.tracks[options.track].id;
+ if (Prototype.Browser.IE) {
+ var sound = document.createElement('bgsound');
+ sound.setAttribute('id','sound_'+options.track+'_'+options.id);
+ sound.setAttribute('src',options.url);
+ sound.setAttribute('loop','1');
+ sound.setAttribute('autostart','true');
+ $$('body')[0].appendChild(sound);
+ }
+ else
+ new Insertion.Bottom($$('body')[0], Sound.template.evaluate(options));
+ }
+};
+
+if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
+ if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
+ Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
+ else
+ Sound.play = function(){}
+}