820
by Jacques Distler
Update Javascripts
1
// script.aculo.us sound.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
3
// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
5
// Based on code created by Jules Gravinese (http://www.webveteran.com/)
7
// script.aculo.us is freely distributable under the terms of an MIT-style license.
8
// For details, see the script.aculo.us web site: http://script.aculo.us/
14
new Template('<embed style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>'),
16
Sound._enabled = true;
19
Sound._enabled = false;
22
if(!Sound._enabled) return;
23
var options = Object.extend({
24
track: 'global', url: url, replace: false
25
}, arguments[1] || {});
27
if(options.replace && this.tracks[options.track]) {
28
$R(0, this.tracks[options.track].id).each(function(id){
29
var sound = $('sound_'+options.track+'_'+id);
30
sound.Stop && sound.Stop();
33
this.tracks[options.track] = null;
36
if(!this.tracks[options.track])
37
this.tracks[options.track] = { id: 0 };
39
this.tracks[options.track].id++;
41
options.id = this.tracks[options.track].id;
43
Prototype.Browser.IE ? new Element('bgsound',{
44
id: 'sound_'+options.track+'_'+options.id,
45
src: options.url, loop: 1, autostart: true
46
}) : Sound.template.evaluate(options));
50
if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
51
if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
52
Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>');
53
else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('Windows Media') != -1 }))
54
Sound.template = new Template('<object id="sound_#{track}_#{id}" type="application/x-mplayer2" data="#{url}"></object>');
55
else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('RealPlayer') != -1 }))
56
Sound.template = new Template('<embed type="audio/x-pn-realaudio-plugin" style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>');
58
Sound.play = function(){};