325 Rkns.Utils = { |
325 Rkns.Utils = { |
326 getUID : (function() { |
326 getUID : (function() { |
327 function pad(n){ |
327 function pad(n){ |
328 return n<10 ? '0'+n : n; |
328 return n<10 ? '0'+n : n; |
329 } |
329 } |
330 function fillrand(n) { |
330 function fillrand() { |
331 var _res = ''; |
331 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { |
332 for (var i=0; i<n; i++) { |
332 var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8); |
333 _res += Math.floor(16*Math.random()).toString(16); |
333 return v.toString(16); |
334 } |
334 }); |
335 return _res; |
|
336 } |
335 } |
337 var _d = new Date(), |
336 var _d = new Date(), |
338 ID_AUTO_INCREMENT = 0, |
337 ID_AUTO_INCREMENT = 0, |
339 ID_BASE = _d.getUTCFullYear() + '-' |
338 ID_BASE = _d.getUTCFullYear() + '-' |
340 + pad(_d.getUTCMonth()+1) + '-' |
339 + pad(_d.getUTCMonth()+1) + '-' |
341 + pad(_d.getUTCDate()) + '-' |
340 + pad(_d.getUTCDate()) + '-' |
342 + fillrand(16); |
341 + fillrand(); |
343 return function(_base) { |
342 return function(_base) { |
344 var _n = (++ID_AUTO_INCREMENT).toString(16), |
343 var _n = (++ID_AUTO_INCREMENT).toString(16), |
345 _base = (typeof _base === "undefined" ? "" : _base + "-" ); |
344 _base = (typeof _base === "undefined" ? "" : _base + "-" ); |
346 while (_n.length < 4) { _n = '0' + _n; } |
345 while (_n.length < 4) { _n = '0' + _n; } |
347 return _base + this._ID_BASE + '-' + _n; |
346 return _base + ID_BASE + '-' + _n; |
348 } |
347 } |
349 })(), |
348 })(), |
350 getFullURL : function(url) { |
349 getFullURL : function(url) { |
351 |
350 |
352 if(typeof(url) == 'undefined' || url == null ) { |
351 if(typeof(url) == 'undefined' || url == null ) { |