1//-----------------------------cookie------------------------------ 2var cookie = { 3 //milliseconds remaining today 4 leftTime: function() { 5 var curTamp = new Date().getTime(); 6 var curDate = new Date(); //191223 added 7 //The time stamp of the early morning of the day, minus one millisecond is to prevent the state that the subsequent time will not reach 00:00:00 8 var curWeeHours = new Date(curDate.toLocaleDateString()).getTime() - 1; 9 var passedTamp = curTamp - curWeeHours; 10 var leftTamp = 24 * 60 * 60 * 1000 - passedTamp; 11 return leftTamp; 12 }, 13 //n: key name, v: key value, exp: expiration time (ms) 14 setCookie: function(n, v, exp) { 15 var date = new Date() 16 date.setTime(date.getTime() + exp); 17 document.cookie = n + "=" + escape(v) + 18 ((exp == null) ? "" : ";expires=" + date.toGMTString()) 19 }, 20 //n is the key name of the key value you want to get 21 getCookie: function(n) { 22 var reg = /\s/g; 23 var result = document.cookie.replace(reg, ""); 24 var resultArr = result.split(";"); 25 for (var i = 0; i < resultArr.length; i++) { 26 var nameArr = resultArr[i].split("="); 27 if (nameArr[0] == n) { 28 return nameArr[1]; 29 } 30 } 31 } 32}; 33 34//generate the guid 35var guid = function() { 36 function S4() { 37 return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); 38 } 39 return (S4() + S4() + S4() + S4() + S4() + S4() + S4() + S4()); 40}; 41 42//If the guid does not exist, then generate the guid 43console.log(cookie.leftTime() / 1000 / 60 /60); 44!cookie.getCookie('guid') && cookie.setCookie('guid', guid(), cookie.leftTime()); 45 46/* 47 _ooOoo_ 48 o8888888o 49 88" . "88 50 (| -_- |) 51 O\ = /O 52 ____/`---'\____ 53 .' \\| |// `. 54 / \\||| : |||// \ 55 / _||||| -:- |||||- \ 56 | | \\\ - /// | | 57 | \_| ''\---/'' | | 58 \ .-\__ `-` ___/-. / 59 ___`. .' /--.--\ `. . __ 60 ."" '< `.___\_<|>_/___.' >'"". 61 | | : `- \`.;`\ _ /`;.`/ - ` : | | 62 \ \ `-. \_ __\ /__ _/ .-` / / 63======`-.____`-.___\_____/___.-`____.-'====== 64 `=---=' 65^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 66 ä½ç¥ä¿ä½ æ°¸æ BUG 67*/
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.