[icinga-checkins] icinga.org: icinga-core/hbaecker/threaded-trimming: Added missing sound.js

git at icinga.org git at icinga.org
Sun Jan 10 13:39:40 CET 2010


Module: icinga-core
Branch: hbaecker/threaded-trimming
Commit: 45b7f7fb531801c2a6dfca716c6bf4a3b451c30b
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=45b7f7fb531801c2a6dfca716c6bf4a3b451c30b

Author: Hendrik Baecker <andurin at process-zero.de>
Date:   Sun Jan 10 13:18:31 2010 +0100

Added missing sound.js

closes #196

---

 html/js/sound.js |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/html/js/sound.js b/html/js/sound.js
new file mode 100644
index 0000000..e2487cd
--- /dev/null
+++ b/html/js/sound.js
@@ -0,0 +1,55 @@
+// script.aculo.us sound.js v1.8.2, Tue Nov 18 18:30:58 +0100 2008
+
+// Copyright (c) 2005-2008 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;
+    $$('body')[0].insert(
+      Prototype.Browser.IE ? new Element('bgsound',{
+        id: 'sound_'+options.track+'_'+options.id,
+        src: options.url, loop: 1, autostart: true
+      }) : 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(){};
+}
\ No newline at end of file





More information about the icinga-checkins mailing list