-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathping-pong.min.js
9 lines (8 loc) · 965 Bytes
/
ping-pong.min.js
1
2
3
4
5
6
7
8
9
//
// Ping-Pong.js 0.1.0
//
// (c) 2012 Mindaugas Bujanauskas, Apollo Music Aps
// Ping-Pong.js may be freely distributed under the MIT license.
//
(function(d){d.PingPong=function(a){a=a||null;this.success=function(){};this.error=function(){};this.src="/ping.gif";this.random=!0;if(a&&(a.success&&"function"===typeof a.success&&(this.success=a.success),a.error&&"function"===typeof a.error&&(this.error=a.error),a.src&&"string"===typeof a.src&&(this.src=a.src),"boolean"===typeof a.random&&!1===a.random))this.random=!1;var c=function(a,b,c){a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c)},b;this.pong=function(a){if("undefined"!==
typeof a&&(a.src&&"string"===typeof a.src&&(this.src=a.src),"boolean"===typeof a.random&&this.random!=a.random))this.random=a.random;b=null;b=new Image;c(b,"load",this.success);c(b,"error",this.error);b.src=this.random?this.src+"?r="+Math.random():this.src};this.pong()}})(window);