diff options
Diffstat (limited to 'web/js/tools.js')
-rw-r--r-- | web/js/tools.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/web/js/tools.js b/web/js/tools.js index 22ef0a28..bb8310be 100644 --- a/web/js/tools.js +++ b/web/js/tools.js @@ -10,6 +10,15 @@ var tools = new function() { return http; }; + this.makeId = function() { + var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + var id = ""; + for (var count = 0; count < 16; ++count) { + id += chars.charAt(Math.floor(Math.random() * chars.length)); + } + return id; + }; + this.getCookie = function(name) { var matches = document.cookie.match(new RegExp( "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, "\\$1") + "=([^;]*)" // eslint-disable-line no-useless-escape |