Moved `String.prototype.hashCode()`
authorAlexander Ebert <ebert@woltlab.com>
Sat, 22 Jul 2017 19:55:44 +0000 (21:55 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 22 Jul 2017 19:55:44 +0000 (21:55 +0200)
The dev tools indirectly require this method to be loaded a bit earlier.

wcfsetup/install/files/js/WCF.js
wcfsetup/install/files/js/wcf.globalHelper.js

index 2da297143e41f0eb337672fc82753b3bef9aad4d..eb77a7100676734be2f084ad4b1e6776ab283c03 100755 (executable)
        }
 })();
 
-
-
-/**
- * Provides a hashCode() method for strings, similar to Java's String.hashCode().
- * 
- * @see        http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
- */
-String.prototype.hashCode = function() {
-       var $char;
-       var $hash = 0;
-       
-       if (this.length) {
-               for (var $i = 0, $length = this.length; $i < $length; $i++) {
-                       $char = this.charCodeAt($i);
-                       $hash = (($hash << 5) - $hash) + $char;
-                       $hash = $hash & $hash; // convert to 32bit integer
-               }
-       }
-       
-       return $hash;
-};
-
 /**
  * Adds a Fisher-Yates shuffle algorithm for arrays.
  * 
index e18ffbcc5c751d3899caa289b414d7c1837d0634..48fdc94474de40e43d506a5ed9e11cf80230bf7c 100644 (file)
                        }
                });
        })();
+       
+       /**
+        * Provides a hashCode() method for strings, similar to Java's String.hashCode().
+        *
+        * @see http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/
+        */
+       window.String.prototype.hashCode = function() {
+               var $char;
+               var $hash = 0;
+               
+               if (this.length) {
+                       for (var $i = 0, $length = this.length; $i < $length; $i++) {
+                               $char = this.charCodeAt($i);
+                               $hash = (($hash << 5) - $hash) + $char;
+                               $hash = $hash & $hash; // convert to 32bit integer
+                       }
+               }
+               
+               return $hash;
+       };
 })(window, document);