Merge branch 'next' of github.com:WoltLab/WCF into next
authorAlexander Ebert <ebert@woltlab.com>
Tue, 19 May 2015 13:42:06 +0000 (15:42 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 19 May 2015 13:42:06 +0000 (15:42 +0200)
Conflicts:
wcfsetup/install/files/js/WoltLab/WCF/Core.js

1  2 
wcfsetup/install/files/js/WoltLab/WCF/Core.js

index 7f78bb42551c53d30a9d55e286ef7e4b3c04665b,836d1e8a7058f20fd64bc27b0ff5ae3486ac31d5..b52d5e333ba72965135e739d9e8801ff37501c24
@@@ -70,49 -44,19 +70,62 @@@ define([], function() 
                        return out;
                },
                
 +              /**
 +               * Returns the object's class name.
 +               * 
 +               * @param       {object}        obj     target object
 +               * @return      {string}        object class name
 +               */
 +              getType: function(obj) {
 +                      return Object.prototype.toString.call(obj).replace(/^\[object (.+)\]$/, '$1');
 +              },
 +              
+               /**
+                * Returns a RFC4122 version 4 compilant UUID.
+                * 
+                * @see         http://stackoverflow.com/a/2117523
+                * @return      {string}
+                */
+               getUuid: function() {
+                       return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
+                               var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
+                               return v.toString(16);
+                       });
+               },
+               
 +              /**
 +               * Recursively serializes an object into an encoded URI parameter string.
 +               *  
 +               * @param       {object}        obj     target object
 +               * @return      encoded parameter string
 +               */
 +              serialize: function(obj) {
 +                      var parameters = [];
 +                      
 +                      for (var key in obj) {
 +                              if (obj.hasOwnProperty(key)) {
 +                                      var value = obj[key];
 +                                      
 +                                      if (Array.isArray(value)) {
 +                                              for (var i = 0, length = value.length; i < length; i++) {
 +                                                      parameters.push(key + '[]=' + encodeURIComponent(value[i]));
 +                                              }
 +                                              
 +                                              continue;
 +                                      }
 +                                      else if (this.getType(value) === 'Object') {
 +                                              parameters.push(this.serialize(value));
 +                                              
 +                                              continue;
 +                                      }
 +                                      
 +                                      parameters.push(key + '=' + encodeURIComponent(value));
 +                              }
 +                      }
 +                      
 +                      return parameters.join('&');
 +              },
 +              
                triggerEvent: function(el, eventName) {
                        var ev;
                        if (document.createEvent) {