Scarab commit: svn commit: r10794 - trunk/src/webapp/scripts

Hussayn Dabbous <[email protected]>
Newsgroups gmane.comp.java.scarab.cvs
Message-ID <[email protected]>
Author: dabbous
Date: 2009-07-12 11:47:15-0700
New Revision: 10794

Modified:
   trunk/src/webapp/scripts/scarabutil.js
   trunk/src/webapp/scripts/sstree.js

Log:
SCB2979: IE6 sucks. Added missing functionality on arrays (forEach and filter)
rearranged the javascript a bit hoping that helps IE6 to clean startup...

Modified: trunk/src/webapp/scripts/scarabutil.js
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/scripts/scarabutil.js?view=diff&pathrev=10794&r1=10793&r2=10794
==============================================================================
--- trunk/src/webapp/scripts/scarabutil.js	(original)
+++ trunk/src/webapp/scripts/scarabutil.js	2009-07-12 11:47:15-0700
@@ -192,33 +192,3 @@
     setTimeout("stickyNavigationBar()",500);
   }
 
-//============================================================================================
-
-  function Observer() {
-      this.fns = [];
-  }
-  Observer.prototype = {
-      subscribe : function(fn) {
-          this.fns.push(fn);
-      },
-      unsubscribe : function(fn) {
-          this.fns = this.fns.filter(
-              function(el) {
-                  if ( el !== fn ) {
-                      return el;
-                  }
-              }
-          );
-      },
-      fire : function(o, thisObj) {
-          var scope = thisObj || window;
-          this.fns.forEach(
-              function(el) {
-                  el.call(scope, o);
-              }
-          );
-      }
-  };  
-
-  var observer = new Observer;
-

Modified: trunk/src/webapp/scripts/sstree.js
Url: http://scarab.tigris.org/source/browse/scarab/trunk/src/webapp/scripts/sstree.js?view=diff&pathrev=10794&r1=10793&r2=10794
==============================================================================
--- trunk/src/webapp/scripts/sstree.js	(original)
+++ trunk/src/webapp/scripts/sstree.js	2009-07-12 11:47:15-0700
@@ -136,6 +136,54 @@
 	}
 }
 
+//============================================================================================
+
+Array.prototype.forEach = function(fn, thisObj) {
+    var scope = thisObj || window;
+    for ( var i=0, j=this.length; i < j; ++i ) {
+        fn.call(scope, this[i], i, this);
+    }
+};
+
+Array.prototype.filter = function(fn, thisObj) {
+    var scope = thisObj || window;
+    var a = [];
+    for ( var i=0, j=this.length; i < j; ++i ) {
+        if ( !fn.call(scope, this[i], i, this) ) {
+            continue;
+        }
+        a.push(this[i]);
+    }
+    return a;
+};
+
+function Observer() {
+    this.fns = [];
+}
+Observer.prototype = {
+    subscribe : function(fn) {
+        this.fns.push(fn);
+    },
+    unsubscribe : function(fn) {
+        this.fns = this.fns.filter(
+            function(el) {
+                if ( el !== fn ) {
+                    return el;
+                }
+            }
+        );
+    },
+    fire : function(o, thisObj) {
+        var scope = thisObj || window;
+        this.fns.forEach(
+            function(el) {
+                el.call(scope, o);
+            }
+        );
+    }
+};  
+
+var observer = new Observer;
 
 function clickTree(attributeId, key, value, display) {
 	//alert(attributeId);

------------------------------------------------------
http://scarab.tigris.org/ds/viewMessage.do?dsForumId=3577&dsMessageId=2370783
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.