}
var snd = xul_param('sound',{'modal_xulG':true});
+ var snd_obj = xul_param('sound_object',{'modal_xulG':true});
if (snd) {
- try { JSAN.use('util.sound'); var sound = new util.sound(); sound[ snd ](); } catch(E) { alert(E); }
+ try {
+ var params = { 'interval' : 500, 'sig' : 'fancy_prompt_my_init' };
+ if (snd_obj) { params.reuse_queue_from_this_snd_obj = snd_obj; }
+ JSAN.use('util.sound'); var sound = new util.sound(params);
+ if (snd) { sound[ snd ](); }
+ } catch(E) {
+ alert(E);
+ }
}
JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
//+ '?xml_in_stash=temp_override_xml'
//+ '&title=' + window.escape(override_params.title),
'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
- { 'xml' : xml, 'title' : override_params.title, 'sound' : 'bad' }
+ { 'xml' : xml, 'title' : override_params.title, 'sound' : 'bad', 'sound_object' : obj.sound }
);
if (fancy_prompt_data.fancy_status == 'complete') {
req = obj._request(app,name + '.override',params);
/* We're going to turn this guy into a singleton, at least for a given window, and look for it in xulG */
if (! window.xulG) { window.xulG = {}; }
- if (window.xulG._sound) {
+ if (window.xulG._sound && !params.reuse_queue_from_this_snd_obj) {
dump('SOUND('+this.sig+'): reusing sound from ' + window.xulG._sound.origin + '('+xulG._sound.sig+') for ' + location.pathname + '\n');
return window.xulG._sound;
} else {
/* So we can queue up sounds and put a pause between them instead of having them trample over each other */
/* Limitation: interval only gets set once for a singleton */
- if (params.interval) {
+ if (params.interval || params.reuse_queue_from_this_snd_obj) {
this._queue = true;
- this._funcs = params.queue || [];
- JSAN.use('util.exec'); this._exec = new util.exec(); var intervalId = this._exec.timer( this._funcs, params.interval );
+ if (params.reuse_queue_from_this_snd_obj) {
+ this._funcs = params.reuse_queue_from_this_snd_obj._funcs || [];
+ } else {
+ this._funcs = [];
+ }
+ JSAN.use('util.exec'); this._exec = new util.exec(); var intervalId = this._exec.timer( this._funcs, params.interval || 500 );
dump('SOUND('+this.sig+'): starting timer with intervalId = ' + intervalId + '\n');
}