pari: trunk r754 - /trunk/config/scripts/astman.js

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Tue Apr 24 16:46:56 MST 2007


Author: pari
Date: Tue Apr 24 18:46:55 2007
New Revision: 754

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=754
Log:
tweak: Not having to do browser detection every time an event is defined

Modified:
    trunk/config/scripts/astman.js

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=754&r1=753&r2=754
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Tue Apr 24 18:46:55 2007
@@ -119,25 +119,16 @@
 }
 
 
-function add_event( a , b, c ){  
-	// cross browser function for adding events
-	// a is element , b is event (string) , c is the function 
-	if ( a.addEventListener){
-		a.addEventListener(b, c, false);
-	} else if (a.attachEvent){
-		a.attachEvent('on'+b, c);
-	}
-}
-
-function remove_event(a,b,c){ 
-	// cross browser function for removing events
-	// a is element , b is event (string) , c is the function 
-	if(a.removeEventListener){
-		a.removeEventListener( b, c , false);
-	}else if(a.detachEvent){
-		a.detachEvent("on"+b, c);
-	}
-}
+// cross browser function for adding/removing events to elements
+// a is element , b is event (string) , c is the function 
+if(document.addEventListener){
+	add_event = function( a , b, c ){ a.addEventListener(b, c, false); }
+	remove_event = function(a,b,c){ a.removeEventListener( b, c , false); }
+}else if(document.attachEvent){
+	add_event = function( a , b, c ){ a.attachEvent('on'+b, c); }
+	remove_event = function(a,b,c){ a.detachEvent("on"+b, c); }
+}
+
 
 function config2json(a, b, c){		// a is filename (string) , b is 0 or 1 , c is callback function
 	var opt = { method: 'get', asynchronous: true,



More information about the asterisk-gui-commits mailing list