From: Tim Düsterhus Date: Mon, 18 May 2015 22:38:43 +0000 (+0200) Subject: Add WoltLab/WCF/Core.getUUID() X-Git-Tag: 3.0.0_Beta_1~2385^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=600d580f4f8d16c6c18b26e280ae0eb1466ef7d6;p=GitHub%2FWoltLab%2FWCF.git Add WoltLab/WCF/Core.getUUID() --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 2a7060bf3f..3ad13d7cb9 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -703,10 +703,7 @@ $.extend(WCF, { }, /** - * Returns a RFC4122 version 4 compilant UUID. - * - * @see http://stackoverflow.com/a/2117523 - * @return string + * @deprecated Use WoltLab/WCF/Core.getUUID() */ getUUID: function() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Core.js b/wcfsetup/install/files/js/WoltLab/WCF/Core.js index 2fb807aa83..6ef38d1e82 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Core.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Core.js @@ -44,6 +44,19 @@ define([], function() { return out; }, + /** + * 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); + }); + }, + triggerEvent: function(el, eventName) { var ev; if (document.createEvent) { diff --git a/wcfsetup/install/files/js/WoltLab/WCF/Event/Handler.js b/wcfsetup/install/files/js/WoltLab/WCF/Event/Handler.js index 74720dbc02..aab7048367 100644 --- a/wcfsetup/install/files/js/WoltLab/WCF/Event/Handler.js +++ b/wcfsetup/install/files/js/WoltLab/WCF/Event/Handler.js @@ -6,7 +6,7 @@ * @license GNU Lesser General Public License * @module WoltLab/WCF/Event/Handler */ -define(['Dictionary'], function(Dictionary) { +define(['Core', 'Dictionary'], function(Core, Dictionary) { "use strict"; var _listeners = new Dictionary(); @@ -41,7 +41,7 @@ define(['Dictionary'], function(Dictionary) { actions.set(action, callbacks); } - var uuid = WCF.getUUID(); + var uuid = Core.getUUID(); callbacks.set(uuid, callback); return uuid;