$.fn.uuid = function() {
this.each(function(i,element) {
;
var _uuid = "";
var _dobj = new Date();
var _yy = (_dobj.getFullYear()).toString(16).substring(1,3); // yyyy
var _mm = "0" + (255 - _dobj.getMonth() ).toString(16); // mm
var _dd = "0" + (252 - _dobj.getDate() ).toString(16); // dd
var _hh = (240 - _dobj.getHours() ).toString(16); // hh
var _mi = (192 - _dobj.getMinutes() ).toString(16); // mi
var _ss = ( 16 + _dobj.getSeconds() ).toString(16); // ss
var _r1 = Math.pow(Math.random()+1, 3) % 1;
var _r2 = Math.pow(Math.random()+1, 3) % 1;
var _d1 = Math.floor(_r1 * Math.pow(16,4)).toString(16);
while (_d1.length < 4 ) _d1 = "0" + _d1;
var _d2 = Math.floor(_r2 * Math.pow(16,12)).toString(16);
while (_d2.length < 12 ) _d2 = "0" + _d2;
_uuid += _yy + _mm + _dd + "-" + _hh + _mi + "-" + _ss + "00"
+ "-" + _d1 + "-" + _d2;
$(element).data("uuid" , _uuid);
console.log(_uuid);
});
return this;
};