Commit e11f88aa authored by Leigh Stoller's avatar Leigh Stoller

Add cheesy newUIUD() method. For book keeping between server and client.

We never actually use it when adding to the database, we generate one we
trust.
parent 7e3631c9
...@@ -470,10 +470,23 @@ function ConfirmModal(args) ...@@ -470,10 +470,23 @@ function ConfirmModal(args)
return display; return display;
} }
// www.w3resource.com/javascript-exercises/javascript-math-exercise-23.php
function newUUID()
{
var dt = new Date().getTime();
var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = (dt + Math.random()*16)%16 | 0;
dt = Math.floor(dt/16);
return (c=='x' ? r :(r&0x3|0x8)).toString(16);
});
return uuid;
}
// Exports from this module for use elsewhere // Exports from this module for use elsewhere
return { return {
ParseURN: ParseURN, ParseURN: ParseURN,
IsUUID: IsUUID, IsUUID: IsUUID,
newUUID: newUUID,
ShowModal: ShowModal, ShowModal: ShowModal,
HideModal: HideModal, HideModal: HideModal,
ShowWaitWait: ShowWaitWait, ShowWaitWait: ShowWaitWait,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment