{"size": 7941, "ext": "js", "max_stars_repo_path": "h5tracker.min.js", "max_stars_repo_name": "zswang/h5tracker", "max_stars_repo_stars_event_min_datetime": "2016-05-07T01:45:33.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-28T10:44:10.000Z", "max_issues_repo_path": "h5tracker.min.js", "max_issues_repo_name": "zswang/h5tracker", "max_issues_repo_issues_event_min_datetime": "2016-03-03T06:17:06.000Z", "max_issues_repo_issues_event_max_datetime": "2016-07-28T13:11:46.000Z", "max_forks_repo_path": "h5tracker.min.js", "max_forks_repo_name": "zswang/h5tracker", "max_forks_repo_forks_event_min_datetime": "2016-05-09T05:24:57.000Z", "max_forks_repo_forks_event_max_datetime": "2017-03-03T01:49:25.000Z"}
{"max_stars_count": 5, "max_issues_count": 1, "max_forks_count": 2, "avg_line_length": 7941.0, "max_line_length": 7941, "alphanum_fraction": 0.6552071528}
!function(e,n){function t(e){if(!e||"string"!=typeof e)return e;var n=h[e];return n?n:(n=e.indexOf("-")<0&&e.indexOf("_")<0?e:e.replace(/[-_]+([a-z])/gi,function(e,n){return n.toUpperCase()}),h[e]=n,n)}function i(e,n,i){var o=function(r,s){var a,c;if("function"==typeof r)return c=r["-jsets-params"],c||(c=[],String(r).replace(/\(\s*([^()]+?)\s*\)/,function(e,n){c=n.split(/\s*,\s*/)}),r["-jsets-params"]=c),o(c,r);if("string"==typeof r||"number"==typeof r)return r=i?t(r):r,"function"==typeof s?(s.call(e,n(r)),e):n(r);if("object"==typeof r){if(r instanceof Array)return"function"==typeof s?(a=[],r.forEach(function(e){a.push(n(i?t(e):e))}),s.apply(e,a),e):(a={},r.forEach(function(e){a[e]=n(i?t(e):e)}),a);var u;if("function"==typeof s){a=[];for(u in r)a.push(n(i?t(u):u)||r[u]);return e}a={};for(u in r)a[u]=n(i?t(u):u)||r[u];return a}};return o}function o(e,n){return e.replace(/#\{(.*?)\}/g,function(e,t){return n&&t in n?n[t]:""})}function r(){function e(e,n){return r.push({event:e,fn:n}),o}function n(e,n){return r=r.filter(function(t){return!(t.event===e&&t.fn===n)}),o}function t(t,i){function r(){n(t,r),i.apply(o,arguments)}return e(t,r),o}function i(e){var n=[].slice.call(arguments,1);return r.filter(function(n){return n.event===e}).forEach(function(e){e.fn.apply(o,n)}),o}var o={},r=[];return o.on=e,o.off=n,o.once=t,o.emit=i,o}function s(e,n,t,r){function s(){if(v[h]!==E&&(p=null),!p)try{p=JSON.parse(v[b]||"[]"),E=v[h]}catch(e){p=[]}}function a(){v[h]=m(),v[b]=JSON.stringify(p)}function c(e){s();for(var n=m(),t=Date.now();p.length>=r.storageMaxCount;)p.shift();return p.push({id:n,birthday:t,expires:r.storageExpires,tried:0,data:e}),a(),n}function u(){return s(),p.slice()}function f(){s();var e=0,n=Date.now();if(null!==x){if(!(n>x))return e;x=null}return p=p.filter(function(t){var i=t.birthday+1e3*t.expires;return n>i?(e++,!1):(x=null!==x?Math.min(x,i):i,!0)}),a(),e}function l(e){s(),p=p.filter(function(n){return e===n.id?(n.birthday+1e3*n.expires===x&&(x=null),!1):!0}),a()}function d(e,n){var t=g.get(e);if(t)return Object.keys(n).forEach(function(e){t[e]=n[e]}),a(),!0}var p,v=r.localStorageProxy,g={},y={name:t,app:e,tracker:n},h=o(S.storageListTS,y),b=o(S.storageList,y),E=null,x=null;return g.push=c,g.toArray=u,g.clean=f,g.remove=l,g.update=d,g.get=i(g,function(e){s();var n;return p.some(function(t){return e===t.id?(n=t,t):void 0}),n},!0),g}function a(e){var n=[];return Object.keys(e).forEach(function(t){null!==e[t]&&void 0!==e[t]&&n.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]))}),n.join("&")}function c(e,n,t){function i(e){f.clean();var n=f.push(e);return c.emit("log"),n}function o(e,n,t){u.clean();var i=u.push({accept:n,acceptStyle:t,query:a(e)});return c.emit("send"),i}var c=r(),u=s(e,n,"send",t),f=s(e,n,"log",t);return c.log=i,c.send=o,c}function u(e,n,i){return function(o,r){if("string"==typeof o||"number"==typeof o)n(i?t(o):o,r);else if("object"==typeof o)if(o instanceof Array)o.forEach(function(e,t){n(t,e)});else for(var s in o)n(i?t(s):s,o[s]);return e}}function f(e,n,t,o,s){function a(e){if(h)return void h.push({name:"send",data:e});var n={rid:m(),uid:t.get("uid"),sid:t.get("sid"),seq:t.get("seq"),time:(Date.now()-t.get("birthday")).toString(36)};y.data&&Object.keys(y.data).forEach(function(e){n[e]=y.data[e]}),Object.keys(g).forEach(function(e){n[e]=g[e]}),"string"==typeof e&&(e={ht:e}),Object.keys(e).forEach(function(t){n[t]=e[t]}),d("send",n),v.send(n,y.accept,y.acceptStyle)}function f(e){if("string"==typeof e&&(e={message:e,level:"debug"}),h)return void h.push({name:"log",data:e});var n={};Object.keys(e).forEach(function(t){n[t]=e[t]}),d("log",n),v.log(n)}function l(e){y=e;var n=h;h=null,n.forEach(function(e){p[e.name](e.data)})}function d(e){if(y&&y.event){var n=y.event[e];"function"==typeof n&&n.apply(p,[].slice.call(arguments,1))}p.emit.apply(p,arguments)}var p=r();p.name=n;var v=c(e,n,s);v.on("send",function(){o.scan()});var g={};p.set=u(p,function(e,n){g[e]=n},!0),p.get=i(p,function(e){return g[e]},!0);var y,h=[];return p.send=a,p.log=f,["debug","info","warn","error","fatal"].forEach(function(e){p[e]=function(n){f({level:e,message:n})}}),p.create=l,p.emitEvent=d,p}function l(n){function t(c){c=c||0,o&&clearTimeout(o),o=setTimeout(function(){if(o=null,i=[],Object.keys(n.localStorageProxy).forEach(function(e){var t=e.match(/^h5t@storageList\/(\w+)\/(\w+)\/send$/);if(t){var o=t[1],r=t[2],c=a[[o,r]];c||(a[[o,r]]=c=s(o,r,"send",n));var u=c.toArray();u.forEach(function(e){e.storageDict=[o,r].toString()}),i=i.concat(u)}}),!(i.length<=0)){i.sort(function(e,n){return e.tried===n.tried?n.birthday-e.birthday:e.tried-n.tried});var c=i.shift();if(a[c.storageDict].update(c.id,{tried:(c.tried||0)+1}),c.data.accept){var u=e.createElement("img");u.onload=function(){a[c.storageDict].remove(c.id),delete r[c.id],t(1e3)},u.onerror=function(){delete r[c.id],t(3e5)};var f,l=c.data.accept.match(/^([^?]+)(?:\?(.*))?$/),d=l[1],p=l[2];f="path"===c.data.acceptStyle?d+(/\/$/.test(d)?"":"/")+c.data.query.replace(/[&=]/g,"/")+(p?"?"+p:""):d+"?"+c.data.query+(p?"&"+p:""),u.src=f,r[c.id]=u}}},c)}var i,o,r={},a={};return r.scan=t,r}function d(n){function t(){u[S.sessionId]&&c.emit("destroySession");var e=Date.now();u[S.sessionId]=m(),null===u[S.sessionSeq]||isNaN(u[S.sessionSeq])?u[S.sessionSeq]=0:u[S.sessionSeq]=parseInt(u[S.sessionSeq])+1,u[S.sessionBirthday]=e,u[S.sessionLiveTime]=e,c.emit("createSession")}function o(){u[S.sessionId]&&(delete u[S.sessionId],delete u[S.sessionBirthday],delete u[S.sessionLiveTime],c.emit("destroySession"))}function s(){u[S.sessionId]||t()}function a(e){var i=Date.now();i-u[S.sessionLiveTime]>=1e3*n.sessionExpires?t():setTimeout(function(){u[S.sessionLiveTime]=i})}var c=r(),u=n.sessionStorageProxy,f={sid:S.sessionId,seq:S.sessionSeq,birthday:S.sessionBirthday,liveTime:S.sessionLiveTime},l=n.localStorageProxy[S.userId];return l||(l=n.localStorageProxy[S.userId]=m()),c.get=i(c,function(e){return"uid"===e?l:("undefined"==typeof u[S.sessionId]&&(console.info("sessionManager get createSession"),t()),u[f[e]])},!0),c.createSession=t,c.destroySession=o,c.init=s,["keydown","input","keyup","click","contextmenu","mousemove","touchstart","touchend","touchmove"].forEach(function(n){e.addEventListener(n,a,!1)}),c}function p(e,n){function t(){s.emit("init"),r.init();var e=a;a=null,e.forEach(function(e){i.apply(s,e)}),o.scan()}function i(t){var i,c=t.match(/^(?:([\w$_]+)\.)?(\w+)$/),u=c[1],l=c[2];return u?(i=b[u],i||(i=b[u]=f(e,u,r,o,n))):i=s,"function"==typeof i[l]?"send"!==l&&"log"!==l||!a?i[l].apply(i,[].slice.call(arguments,1)):void a.push(arguments):void 0}e=e||"h5t";var o=l(n),r=d(n);r.on("createSession",function(){Object.keys(b).forEach(function(e){b[e].emitEvent("createSession")})}),r.on("destroySession",function(){Object.keys(b).forEach(function(e){b[e].emitEvent("destroySession")})});var s=f(e,e,r,o,n);b[e]=s;var a=[];return s.init=t,s.cmd=i,s}var v=n.h5tObjectName||"h5t",g=n[v];if(!g||!g.defined){var y={localStorageProxy:n.localStorage||{setItem:function(e,n){this[e]=String(n)},removeItem:function(e){delete this[e]}},sessionStorageProxy:n.sessionStorage||{},sessionExpires:30,storageExpires:864e3,storageMaxCount:200},h={},m=function(){var e=parseInt(36*Math.random());return function(){return Date.now().toString(36)+(e++%36).toString(36)+Math.random().toString(36).slice(2,4)}}(),S=function(){var e="h5t@";return{userId:e+"global/userId",scanTime:e+"global/scanTime",sessionId:e+"global/sessionId",sessionSeq:e+"global/sessionSeq",sessionBirthday:e+"global/sessionBirthday",sessionLiveTime:e+"global/sessionLiveTime",storageList:e+"storageList/#{app}/#{tracker}/#{name}",storageListTS:e+"storageList/#{app}/#{tracker}/#{name}/ts"}}(),b={},E=p(v,y),x=function(){E.cmd.apply(E,arguments)};if(x.app=E,x.defined=!0,x.h5t=!0,g){var I=g.queue;x.beginning=g.beginning,g.queue=null,x.queue={push:function(e){x.apply(x,e)}},I.forEach(function(e){x.apply(x,e)})}n[v]=x,E.init()}}(document,window);