diff --git a/soundcloud.player.api.js b/soundcloud.player.api.js index 2b3d783..884825b 100644 --- a/soundcloud.player.api.js +++ b/soundcloud.player.api.js @@ -31,10 +31,22 @@ // re-dispatch SoundCloud events up in the DOM if(window.jQuery){ // if jQuery is available, trigger the custom event - jQuery(playerNode).trigger(customEventType, [data]); + try{ + jQuery(playerNode).trigger(customEventType, [data]); + }catch(e){ + if(this.debug && window.console){ + console.error("Unable to dispatch jQuery Event (.trigger failed) " + eventType + " for the widget id " + flashId, data, e); + } + } }else if(window.Prototype){ // if Prototype.js is available, fire the custom event - $(playerNode).fire(customEventType, data); + try{ + $(playerNode).fire(customEventType, data); + }catch(e){ + if(this.debug && window.console){ + console.error("Unable to dispatch Prototype Event (.fire failed) " + eventType + " for the widget id " + flashId, data, e); + } + } }else{ // TODO add more JS libraries that support custom DOM events } diff --git a/soundcloud.player.api.min.js b/soundcloud.player.api.min.js new file mode 100644 index 0000000..855d804 --- /dev/null +++ b/soundcloud.player.api.min.js @@ -0,0 +1 @@ +(function(){var b=(/msie/i).test(navigator.userAgent)&&!(/opera/i).test(navigator.userAgent);var a=window.soundcloud={version:"0.1",debug:false,_listeners:[],_redispatch:function(c,n,g){var j,m=this._listeners[c]||[],d="soundcloud:"+c;try{j=this.getPlayer(n)}catch(k){if(this.debug&&window.console){console.error("unable to dispatch widget event "+c+" for the widget id "+n,g,k)}return}if(window.jQuery){try{jQuery(j).trigger(d,[g])}catch(k){if(this.debug&&window.console){console.error("Unable to dispatch jQuery Event (.trigger failed) "+c+" for the widget id "+n,g,k)}}}else{if(window.Prototype){try{$(j).fire(d,g)}catch(k){if(this.debug&&window.console){console.error("Unable to dispatch Prototype Event (.fire failed) "+c+" for the widget id "+n,g,k)}}}else{}}for(var h=0,f=m.length;h