Sha256: 5360118bfe07f7bf27431e68d5d01e479e5f0dec03c85729d805d38d632ca0ab

Contents?: true

Size: 1.88 KB

Versions: 66

Compression:

Stored size: 1.88 KB

Contents

// script.aculo.us sound.js v1.8.0_pre1, Fri Oct 12 21:34:51 +0200 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;
    $$('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(){}
}

Version data entries

66 entries across 66 versions & 12 rubygems

Version Path
dchelimsky-rspec-1.1.10 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11.1 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11.2 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11.3 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11.4 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11.5 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11.6 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11.7 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-1.1.11 story_server/prototype/javascripts/sound.js
dchelimsky-rspec-stories-1.0.0 story_server/prototype/javascripts/sound.js
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/story_server/prototype/javascripts/sound.js
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/story_server/prototype/javascripts/sound.js
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/story_server/prototype/javascripts/sound.js
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/story_server/prototype/javascripts/sound.js
samstokes-rspec-stories-1.0.1 story_server/prototype/javascripts/sound.js
samstokes-rspec-stories-1.0.2 story_server/prototype/javascripts/sound.js
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/story_server/prototype/javascripts/sound.js
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/story_server/prototype/javascripts/sound.js
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/story_server/prototype/javascripts/sound.js
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/story_server/prototype/javascripts/sound.js