From c9b5e9022854fcd0758ed448a5c04747fe8319ed Mon Sep 17 00:00:00 2001 From: shengyonggen Date: Mon, 19 Sep 2016 16:12:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0app=E5=92=8Cjs=E6=89=93?= =?UTF-8?q?=E9=80=9A=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- product/sensorsdata.js | 44 +++++++++++++++++++++++++++++++++++++++++- sensorsdata.min.js | 4 ++-- src/sdk.js | 41 +++++++++++++++++++++++++++++++++++++++ src/sensorsdata.js | 13 +++++++------ src/vendor.js | 8 ++++---- vtrack.min.js | 10 +++++----- 6 files changed, 102 insertions(+), 18 deletions(-) diff --git a/product/sensorsdata.js b/product/sensorsdata.js index 17a73b69..d7945019 100755 --- a/product/sensorsdata.js +++ b/product/sensorsdata.js @@ -7,6 +7,7 @@ // 防止重复引入 sd = window[sd]; + sd._t = sd._t || 1 * new Date(); if ((typeof sd !== 'function' && typeof sd !== 'object') || sd.has_load_sdk) { return false; @@ -613,7 +614,7 @@ if(typeof JSON!=='object'){JSON={}}(function(){'use strict';var rx_one=/^[\],:{} , slice = ArrayProto.slice , toString = ObjProto.toString , hasOwnProperty = ObjProto.hasOwnProperty - , LIB_VERSION = '1.5.11'; + , LIB_VERSION = '1.6'; sd.lib_version = LIB_VERSION; @@ -2134,12 +2135,53 @@ saEvent.send = function(p, callback) { }; + function app_js_bridge(){ + var app_info = null; + var todo = null; + function setAppInfo(data){ + app_info = data; + if(todo){ + todo(data); + } + } + //android + function getAndroid(){ + if(typeof window.SensorsData_APP_JS_Bridge === 'object' && window.SensorsData_APP_JS_Bridge.sensorsdata_call_app){ + app_info = SensorsData_APP_JS_Bridge.sensorsdata_call_app(); + } + } + //ios + window.sensorsdata_app_js_bridge_call_js = function(data){ + setAppInfo(data); + }; + sd.getAppStatus = function(func){ + //先获取能直接取到的安卓,ios是异步的不需要操作 + getAndroid(); + // 不传参数,直接返回数据 + if(!func){ + return app_info; + }else{ + //如果传参数,保存参数。如果有数据直接执行,没数据时保存 + if(app_info === null){ + todo = func; + }else{ + func(app_info); + } + } + }; + }; + + + sd.init = function() { + // 防止爬虫等异常情况 /* if(!_.hasStandardBrowserEnviroment()){ return false; }*/ + app_js_bridge(); + // 初始化referrer等页面属性 1.6 _.info.initPage(); diff --git a/sensorsdata.min.js b/sensorsdata.min.js index d763eba4..6d6fad8d 100755 --- a/sensorsdata.min.js +++ b/sensorsdata.min.js @@ -1,2 +1,2 @@ -!function(sd){if(sd=window[sd],"function"!=typeof sd&&"object"!=typeof sd||sd.has_load_sdk)return!1;sd.has_load_sdk=!0,"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var r,n,i,o,s,a=gap,c=t[e];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(e)),"function"==typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(o=c.length,r=0;o>r;r+=1)s[r]=str(r,c)||"null";return i=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,i}if(rep&&"object"==typeof rep)for(o=rep.length,r=0;o>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));else for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));return i=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,i}}var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,r){var n;if(gap="",indent="","number"==typeof r)for(n=0;r>n;n+=1)indent+=" ";else"string"==typeof r&&(indent=r);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var r,n,i=e[t];if(i&&"object"==typeof i)for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n=walk(i,r),void 0!==n?i[r]=n:delete i[r]);return reviver.call(e,t,i)}var j;if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();var _=sd._={};sd.para=sd.para||{},sd.para_default={max_referrer_string_length:500,max_string_length:1e3,cross_subdomain:!0,show_log:!0,debug_mode:!1,debug_mode_upload:!1,session_time:0,use_client_time:!1,source_channel:[],vtrack_ignore:{}};for(var i in sd.para_default)void 0===sd.para[i]&&(sd.para[i]=sd.para_default[i]);/sa\.gif[^\/]*$/.test(sd.para.server_url)||(sd.para.server_url=sd.para.server_url.replace(/\/sa$/,"/sa.gif").replace(/(\/sa)(\?[^\/]+)$/,"/sa.gif$2")),sd.para.debug_mode_url=sd.para.debug_mode_url||sd.para.server_url.replace("sa.gif","debug"),sd.para.noCache===!0?sd.para.noCache="?"+(new Date).getTime():sd.para.noCache="";var detector={};!function(){function e(e){return Object.prototype.toString.call(e)}function t(t){return"[object Object]"===e(t)}function r(t){return"[object Function]"===e(t)}function n(e,t){for(var r=0,n=e.length;n>r&&t.call(e,e[r],r)!==!1;r++);}function i(e){if(!_.test(e))return null;var t,r,n,i,o;if(-1!==e.indexOf("trident/")&&(t=/\btrident\/([0-9.]+)/.exec(e),t&&t.length>=2)){n=t[1];var s=t[1].split(".");s[0]=parseInt(s[0],10)+4,o=s.join(".")}t=_.exec(e),i=t[1];var a=t[1].split(".");return"undefined"==typeof o&&(o=i),a[0]=parseInt(a[0],10)-4,r=a.join("."),"undefined"==typeof n&&(n=r),{browserVersion:o,browserMode:i,engineVersion:n,engineMode:r,compatible:n!==r}}function o(e){if(f)try{var t=f.twGetRunPath.toLowerCase(),r=f.twGetSecurityID(u),n=f.twGetVersion(r);if(t&&-1===t.indexOf(e))return!1;if(n)return{version:n}}catch(i){}}function s(n,i,o){var s=r(i)?i.call(null,o):i;if(!s)return null;var a={name:n,version:c,codename:""},u=e(s);if(s===!0)return a;if("[object String]"===u){if(-1!==o.indexOf(s))return a}else{if(t(s))return s.hasOwnProperty("version")&&(a.version=s.version),a;if(s.exec){var f=s.exec(o);if(f)return f.length>=2&&f[1]?a.version=f[1].replace(/_/g,"."):a.version=c,a}}}function a(e,t,r,i){var o=S;n(t,function(t){var r=s(t[0],t[1],e);return r?(o=r,!1):void 0}),r.call(i,o.name,o.version)}var c="-1",u=window,f=u.external,d=u.navigator.userAgent||"",l=u.navigator.appVersion||"",p=u.navigator.vendor||"",_=/\b(?:msie |ie |trident\/[0-9].*rv[ :])([0-9.]+)/,g=/\bbb10\b.+?\bversion\/([\d.]+)/,h=/\bblackberry\b.+\bversion\/([\d.]+)/,b=/\bblackberry\d+\/([\d.]+)/,m=[["nokia",function(e){return-1!==e.indexOf("nokia ")?/\bnokia ([0-9]+)?/:/\bnokia([a-z0-9]+)?/}],["samsung",function(e){return-1!==e.indexOf("samsung")?/\bsamsung(?:[ \-](?:sgh|gt|sm))?-([a-z0-9]+)/:/\b(?:sgh|sch|gt|sm)-([a-z0-9]+)/}],["wp",function(e){return-1!==e.indexOf("windows phone ")||-1!==e.indexOf("xblwp")||-1!==e.indexOf("zunewp")||-1!==e.indexOf("windows ce")}],["pc","windows"],["ipad","ipad"],["ipod","ipod"],["iphone",/\biphone\b|\biph(\d)/],["mac","macintosh"],["mi",/\bmi[ \-]?([a-z0-9 ]+(?= build|\)))/],["hongmi",/\bhm[ \-]?([a-z0-9]+)/],["aliyun",/\baliyunos\b(?:[\-](\d+))?/],["meizu",function(e){return e.indexOf("meizu")>=0?/\bmeizu[\/ ]([a-z0-9]+)\b/:/\bm([0-9cx]{1,4})\b/}],["nexus",/\bnexus ([0-9s.]+)/],["huawei",function(e){var t=/\bmediapad (.+?)(?= build\/huaweimediapad\b)/;return-1!==e.indexOf("huawei-huawei")?/\bhuawei\-huawei\-([a-z0-9\-]+)/:t.test(e)?t:/\bhuawei[ _\-]?([a-z0-9]+)/}],["lenovo",function(e){return-1!==e.indexOf("lenovo-lenovo")?/\blenovo\-lenovo[ \-]([a-z0-9]+)/:/\blenovo[ \-]?([a-z0-9]+)/}],["zte",function(e){return/\bzte\-[tu]/.test(e)?/\bzte-[tu][ _\-]?([a-su-z0-9\+]+)/:/\bzte[ _\-]?([a-su-z0-9\+]+)/}],["vivo",/\bvivo(?: ([a-z0-9]+))?/],["htc",function(e){return/\bhtc[a-z0-9 _\-]+(?= build\b)/.test(e)?/\bhtc[ _\-]?([a-z0-9 ]+(?= build))/:/\bhtc[ _\-]?([a-z0-9 ]+)/}],["oppo",/\boppo[_]([a-z0-9]+)/],["konka",/\bkonka[_\-]([a-z0-9]+)/],["sonyericsson",/\bmt([a-z0-9]+)/],["coolpad",/\bcoolpad[_ ]?([a-z0-9]+)/],["lg",/\blg[\-]([a-z0-9]+)/],["android",/\bandroid\b|\badr\b/],["blackberry",function(e){return e.indexOf("blackberry")>=0?/\bblackberry\s?(\d+)/:"bb10"}]],v=[["wp",function(e){return-1!==e.indexOf("windows phone ")?/\bwindows phone (?:os )?([0-9.]+)/:-1!==e.indexOf("xblwp")?/\bxblwp([0-9.]+)/:-1!==e.indexOf("zunewp")?/\bzunewp([0-9.]+)/:"windows phone"}],["windows",/\bwindows nt ([0-9.]+)/],["macosx",/\bmac os x ([0-9._]+)/],["iPhone OS",function(e){return/\bcpu(?: iphone)? os /.test(e)?/\bcpu(?: iphone)? os ([0-9._]+)/:-1!==e.indexOf("iph os ")?/\biph os ([0-9_]+)/:/\bios\b/}],["yunos",/\baliyunos ([0-9.]+)/],["Android",function(e){return e.indexOf("android")>=0?/\bandroid[ \/-]?([0-9.x]+)?/:e.indexOf("adr")>=0?e.indexOf("mqqbrowser")>=0?/\badr[ ]\(linux; u; ([0-9.]+)?/:/\badr(?:[ ]([0-9.]+))?/:"android"}],["chromeos",/\bcros i686 ([0-9.]+)/],["linux","linux"],["windowsce",/\bwindows ce(?: ([0-9.]+))?/],["symbian",/\bsymbian(?:os)?\/([0-9.]+)/],["blackberry",function(e){var t=e.match(g)||e.match(h)||e.match(b);return t?{version:t[1]}:"blackberry"}]],y=[["edgehtml",/edge\/([0-9.]+)/],["trident",_],["blink",function(){return"chrome"in u&&"CSS"in u&&/\bapplewebkit[\/]?([0-9.+]+)/}],["webkit",/\bapplewebkit[\/]?([0-9.+]+)/],["gecko",function(e){var t;return(t=e.match(/\brv:([\d\w.]+).*\bgecko\/(\d+)/))?{version:t[1]+"."+t[2]}:void 0}],["presto",/\bpresto\/([0-9.]+)/],["androidwebkit",/\bandroidwebkit\/([0-9.]+)/],["coolpadwebkit",/\bcoolpadwebkit\/([0-9.]+)/],["u2",/\bu2\/([0-9.]+)/],["u3",/\bu3\/([0-9.]+)/]],w=[["edge",/edge\/([0-9.]+)/],["sogou",function(e){return e.indexOf("sogoumobilebrowser")>=0?/sogoumobilebrowser\/([0-9.]+)/:e.indexOf("sogoumse")>=0?!0:/ se ([0-9.x]+)/}],["theworld",function(){var e=o("theworld");return"undefined"!=typeof e?e:"theworld"}],["360",function(e){var t=o("360se");return"undefined"!=typeof t?t:-1!==e.indexOf("360 aphone browser")?/\b360 aphone browser \(([^\)]+)\)/:/\b360(?:se|ee|chrome|browser)\b/}],["maxthon",function(){try{if(f&&(f.mxVersion||f.max_version))return{version:f.mxVersion||f.max_version}}catch(e){}return/\b(?:maxthon|mxbrowser)(?:[ \/]([0-9.]+))?/}],["micromessenger",/\bmicromessenger\/([\d.]+)/],["qq",/\bm?qqbrowser\/([0-9.]+)/],["green","greenbrowser"],["tt",/\btencenttraveler ([0-9.]+)/],["liebao",function(e){if(e.indexOf("liebaofast")>=0)return/\bliebaofast\/([0-9.]+)/;if(-1===e.indexOf("lbbrowser"))return!1;var t;try{f&&f.LiebaoGetVersion&&(t=f.LiebaoGetVersion())}catch(r){}return{version:t||c}}],["tao",/\btaobrowser\/([0-9.]+)/],["coolnovo",/\bcoolnovo\/([0-9.]+)/],["saayaa","saayaa"],["baidu",/\b(?:ba?idubrowser|baiduhd)[ \/]([0-9.x]+)/],["ie",_],["mi",/\bmiuibrowser\/([0-9.]+)/],["opera",function(e){var t=/\bopera.+version\/([0-9.ab]+)/,r=/\bopr\/([0-9.]+)/;return t.test(e)?t:r}],["oupeng",/\boupeng\/([0-9.]+)/],["yandex",/yabrowser\/([0-9.]+)/],["ali-ap",function(e){return e.indexOf("aliapp")>0?/\baliapp\(ap\/([0-9.]+)\)/:/\balipayclient\/([0-9.]+)\b/}],["ali-ap-pd",/\baliapp\(ap-pd\/([0-9.]+)\)/],["ali-am",/\baliapp\(am\/([0-9.]+)\)/],["ali-tb",/\baliapp\(tb\/([0-9.]+)\)/],["ali-tb-pd",/\baliapp\(tb-pd\/([0-9.]+)\)/],["ali-tm",/\baliapp\(tm\/([0-9.]+)\)/],["ali-tm-pd",/\baliapp\(tm-pd\/([0-9.]+)\)/],["uc",function(e){return e.indexOf("ucbrowser/")>=0?/\bucbrowser\/([0-9.]+)/:e.indexOf("ubrowser/")>=0?/\bubrowser\/([0-9.]+)/:/\buc\/[0-9]/.test(e)?/\buc\/([0-9.]+)/:e.indexOf("ucweb")>=0?/\bucweb([0-9.]+)?/:/\b(?:ucbrowser|uc)\b/}],["chrome",/ (?:chrome|crios|crmo)\/([0-9.]+)/],["android",function(e){return-1!==e.indexOf("android")?/\bversion\/([0-9.]+(?: beta)?)/:void 0}],["blackberry",function(e){var t=e.match(g)||e.match(h)||e.match(b);return t?{version:t[1]}:"blackberry"}],["safari",/\bversion\/([0-9.]+(?: beta)?)(?: mobile(?:\/[a-z0-9]+)?)? safari\//],["webview",/\bcpu(?: iphone)? os (?:[0-9._]+).+\bapplewebkit\b/],["firefox",/\bfirefox\/([0-9.ab]+)/],["nokia",/\bnokiabrowser\/([0-9.]+)/]],S={name:"na",version:c},x=function(e){e=(e||"").toLowerCase();var t={};a(e,m,function(e,r){var n=parseFloat(r);t.device={name:e,version:n,fullVersion:r},t.device[e]=n},t),a(e,v,function(e,r){var n=parseFloat(r);t.os={name:e,version:n,fullVersion:r},t.os[e]=n},t);var r=i(e);return a(e,y,function(e,n){var i=n;r&&(n=r.engineVersion||r.engineMode,i=r.engineMode);var o=parseFloat(n);t.engine={name:e,version:o,fullVersion:n,mode:parseFloat(i),fullMode:i,compatible:r?r.compatible:!1},t.engine[e]=o},t),a(e,w,function(e,n){var i=n;r&&("ie"===e&&(n=r.browserVersion),i=r.browserMode);var o=parseFloat(n);t.browser={name:e,version:o,fullVersion:n,mode:parseFloat(i),fullMode:i,compatible:r?r.compatible:!1},t.browser[e]=o},t),t};detector=x(d+" "+l+" "+p)}();var ArrayProto=Array.prototype,FuncProto=Function.prototype,ObjProto=Object.prototype,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty,LIB_VERSION="1.5.11";sd.lib_version=LIB_VERSION;var error_msg=[],is_first_visitor=!1,source_channel_standard="utm_source utm_medium utm_campaign utm_content utm_term",logger="object"==typeof logger?logger:{};logger.info=function(){if(!sd.para.show_log)return!1;if("object"==typeof console&&console.log)try{return console.log.apply(console,arguments)}catch(e){console.log(arguments[0])}},function(){var e=(FuncProto.bind,ArrayProto.forEach),t=ArrayProto.indexOf,r=Array.isArray,n={},i=_.each=function(t,r,i){if(null==t)return!1;if(e&&t.forEach===e)t.forEach(r,i);else if(t.length===+t.length){for(var o=0,s=t.length;s>o;o++)if(o in t&&r.call(i,t[o],o,t)===n)return!1}else for(var a in t)if(hasOwnProperty.call(t,a)&&r.call(i,t[a],a,t)===n)return!1};_.logger=logger,_.extend=function(e){return i(slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&(e[r]=t[r])}),e},_.extend2Lev=function(e){return i(slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&(_.isObject(t[r])&&_.isObject(e[r])?_.extend(e[r],t[r]):e[r]=t[r])}),e},_.coverExtend=function(e){return i(slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&void 0===e[r]&&(e[r]=t[r])}),e},_.isArray=r||function(e){return"[object Array]"===toString.call(e)},_.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},_.isArguments=function(e){return!(!e||!hasOwnProperty.call(e,"callee"))},_.toArray=function(e){return e?e.toArray?e.toArray():_.isArray(e)?slice.call(e):_.isArguments(e)?slice.call(e):_.values(e):[]},_.values=function(e){var t=[];return null==e?t:(i(e,function(e){t[t.length]=e}),t)},_.include=function(e,r){var o=!1;return null==e?o:t&&e.indexOf===t?-1!=e.indexOf(r):(i(e,function(e){return o||(o=e===r)?n:void 0}),o)},_.includes=function(e,t){return-1!==e.indexOf(t)}}(),_.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},_.isObject=function(e){return"[object Object]"==toString.call(e)},_.isEmptyObject=function(e){if(_.isObject(e)){for(var t in e)if(hasOwnProperty.call(e,t))return!1;return!0}return!1},_.isUndefined=function(e){return void 0===e},_.isString=function(e){return"[object String]"==toString.call(e)},_.isDate=function(e){return"[object Date]"==toString.call(e)},_.isBoolean=function(e){return"[object Boolean]"==toString.call(e)},_.isNumber=function(e){return"[object Number]"==toString.call(e)&&/[\d\.]+/.test(String(e))},_.isJSONString=function(e){try{JSON.parse(e)}catch(t){return!1}return!0},_.encodeDates=function(e){return _.each(e,function(t,r){_.isDate(t)?e[r]=_.formatDate(t):_.isObject(t)&&(e[r]=_.encodeDates(t))}),e},_.formatDate=function(e){function t(e){return 10>e?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())},_.searchObjDate=function(e){_.isObject(e)&&_.each(e,function(t,r){_.isObject(t)?_.searchObjDate(e[r]):_.isDate(t)&&(e[r]=_.formatDate(t))})},_.formatString=function(e){return e.length>sd.para.max_string_length?(logger.info("字符串长度超过限制,已经做截取--"+e),e.slice(0,sd.para.max_string_length)):e},_.searchObjString=function(e){_.isObject(e)&&_.each(e,function(t,r){_.isObject(t)?_.searchObjString(e[r]):_.isString(t)&&(e[r]=_.formatString(t))})},_.unique=function(e){for(var t,r=[],n={},i=0;i0&&(t[r]=e)}),t},_.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n");var t,r,n,i="",o=0;for(t=r=0,o=e.length,n=0;o>n;n++){var s=e.charCodeAt(n),a=null;128>s?r++:a=s>127&&2048>s?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),null!==a&&(r>t&&(i+=e.substring(t,r)),i+=a,t=r=n+1)}return r>t&&(i+=e.substring(t,e.length)),i},_.detector=detector,_.base64Encode=function(e){var t,r,n,i,o,s,a,c,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,d=0,l="",p=[];if(!e)return e;e=_.utf8Encode(e);do t=e.charCodeAt(f++),r=e.charCodeAt(f++),n=e.charCodeAt(f++),c=t<<16|r<<8|n,i=c>>18&63,o=c>>12&63,s=c>>6&63,a=63&c,p[d++]=u.charAt(i)+u.charAt(o)+u.charAt(s)+u.charAt(a);while(f=4&&(s=t(s,o),o=[]);return o.length>0&&(s=t(s,o)),s.toString(16)};return function(){var n=String(screen.height*screen.width);return n=n&&/\d{5,}/.test(n)?n.toString(16):String(31242*Math.random()).replace(".","").slice(0,8),e()+"-"+t()+"-"+r()+"-"+n+"-"+e()}}(),_.getQueryParam=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r="[\\?&]"+t+"=([^&#]*)",n=new RegExp(r),i=n.exec(e);return null===i||i&&"string"!=typeof i[1]&&i[1].length?"":decodeURIComponent(i[1]).replace(/\+/g," ")},_.urlParse=function(e){var t=function(e){this._fields={Username:4,Password:5,Port:7,Protocol:2,Host:6,Path:8,URL:0,QueryString:9,Fragment:10},this._values={},this._regex=null,this._regex=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,"undefined"!=typeof e&&this._parse(e)};return t.prototype.setUrl=function(e){this._parse(e)},t.prototype._initValues=function(){for(var e in this._fields)this._values[e]=""},t.prototype.getUrl=function(){var e="";return e+=this._values.Origin,e+=this._values.Port?":"+this._values.Port:"",e+=this._values.Path,e+=this._values.QueryString?"?"+this._values.QueryString:""},t.prototype._parse=function(e){this._initValues();var t=this._regex.exec(e);if(!t)throw"DPURLParser::_parse -> Invalid URL";for(var r in this._fields)"undefined"!=typeof t[this._fields[r]]&&(this._values[r]=t[this._fields[r]]);this._values.Hostname=this._values.Host.replace(/:\d+$/,""),this._values.Origin=this._values.Protocol+"://"+this._values.Hostname},new t(e)},_.referringDomain=function(e){var t=e.split("/");return t.length>=3?t[2]:""},_.getDomainByHost=function(e){if("string"==typeof e&&e.split(".").length>=2){var t=e.match(/[^\.]+\.[^.]+$/);return t&&t[0]?t[0]:""}return""},_.hasStandardBrowserEnviroment=function(){return window?document?navigator?screen?void 0:"screen":"navigator":"document":"window"},_.cookie={get:function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n=200&&r.status<300||304==r.status?e.success(t(r.responseText)):e.error(t(r.responseText),r.status),r.onreadystatechange=null,r.onload=null)},r.open(e.type,e.url,!0);try{if(r.withCredentials=!0,_.isObject(e.header))for(var n in e.header)r.setRequestHeader(n,e.header[n]);e.data&&(r.setRequestHeader("X-Requested-With","XMLHttpRequest"),"application/json"===e.contentType?r.setRequestHeader("Content-type","application/json; charset=UTF-8"):r.setRequestHeader("Content-type","application/x-www-form-urlencoded"))}catch(i){}r.send(e.data||null)},_.info={initPage:function(){var e=document.referrer,t=e?_.referringDomain(e):e,r=_.getDomainByHost(t),n=location.href,i=n?_.referringDomain(n):n,o=_.getDomainByHost(i);this.pageProp={referrer:e,referrer_host:t,referrer_domain:r,url:n,url_host:i,url_domain:o}},pageProp:{},campaignParams:function(){var e=source_channel_standard.split(" "),t="",r={};return _.isArray(sd.para.source_channel)&&sd.para.source_channel.length>0&&(e=e.concat(sd.para.source_channel),e=_.unique(e)),_.each(e,function(e){t=_.getQueryParam(location.href,e),t.length&&(r[e]=t)}),r},campaignParamsStandard:function(){var e=_.info.campaignParams(),t={},r={};for(var n in e)-1!==(" "+source_channel_standard+" ").indexOf(" "+n+" ")?t["$"+n]=e[n]:r[n]=e[n];return{$utms:t,otherUtms:r}},properties:function(){return{$os:detector.os.name,$model:detector.device.name,$os_version:String(detector.os.version),$screen_height:Number(screen.height)||0,$screen_width:Number(screen.width)||0,$lib:"js",$lib_version:String(LIB_VERSION),$browser:detector.browser.name,$browser_version:String(detector.browser.version)}},currentProps:{},register:function(e){_.extend(_.info.currentProps,e)}},sd.sendState={},sd.sendState._complete=0,sd.sendState._receive=0,sd.sendState.getSendCall=function(e,t){++this._receive;var r="_state"+this._receive,n=this;this[r]=document.createElement("img"),this[r].onload=this[r].onerror=function(e){n[r].onload=null,n[r].onerror=null,delete n[r],++n._complete,"function"==typeof t&&t()},e._nocache=(String(Math.random())+String(Math.random())+String(Math.random())).slice(2,15),logger.info(e),e=JSON.stringify(e),-1!==sd.para.server_url.indexOf("?")?this[r].src=sd.para.server_url+"&data="+encodeURIComponent(_.base64Encode(e)):this[r].src=sd.para.server_url+"?data="+encodeURIComponent(_.base64Encode(e))};var saNewUser={checkIsAddSign:function(e){"track"===e.type&&(null!==_.cookie.get("sensorsdata_is_new_user")?e.properties.$is_first_day=!0:e.properties.$is_first_day=!1)},is_first_visit_time:!1,checkIsFirstTime:function(e){"track"===e.type&&(this.is_first_visit_time?(e.properties.$is_first_time=!0,this.is_first_visit_time=!1):e.properties.$is_first_time=!1)},storeInitCheck:function(){if(is_first_visitor){var e=new Date,t={h:23-e.getHours(),m:59-e.getMinutes(),s:59-e.getSeconds()};_.cookie.set("sensorsdata_is_new_user","true",3600*t.h+60*t.m+t.s+"s"),this.is_first_visit_time=!0}else null===_.cookie.get("sensorsdata_is_new_user")&&(this.checkIsAddSign=function(e){"track"===e.type&&(e.properties.$is_first_day=!1)}),this.checkIsFirstTime=function(e){"track"===e.type&&(e.properties.$is_first_time=!1)}},checkIsFirstLatest:function(){var e=_.info.pageProp.url_domain,t=_.info.pageProp.referrer_domain;""!==e&&e!==t&&sa.register({$latest_referrer:_.info.pageProp.referrer,$latest_referrer_host:_.info.pageProp.referrer_host});var r=_.info.campaignParamsStandard().$utms;_.isEmptyObject(r)||sd.register(r)}},saEvent={};saEvent.checkOption={regChecks:{regName:/^((?!^distinct_id$|^original_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$)[a-zA-Z_$][a-zA-Z\d_$]{0,99})$/i},checkPropertiesKey:function(e){var t=this,r=!0;return _.each(e,function(e,n){t.regChecks.regName.test(n)||(r=!1)}),r},check:function(e,t){return"string"==typeof this[e]?this[this[e]](t):this[e](t)},str:function(e){return _.isString(e)?!0:(logger.info("请检查参数格式,必须是字符串"),!0)},properties:function(e){return _.strip_sa_properties(e),e?_.isObject(e)?this.checkPropertiesKey(e)?!0:(logger.info("properties里的key必须是由字符串数字_组成,且不能是系统保留字"),!0):(logger.info("properties可以没有,但有的话必须是对象"),!0):!0},propertiesMust:function(e){return _.strip_sa_properties(e),void 0===e||!_.isObject(e)||_.isEmptyObject(e)?(logger.info("properties必须是对象且有值"),!0):this.checkPropertiesKey(e)?!0:(logger.info("properties里的key必须是由字符串数字_组成,且不能是系统保留字"),!0)},event:function(e){return _.isString(e)&&this.regChecks.regName.test(e)?!0:(logger.info("请检查参数格式,必须是字符串,且eventName必须是字符串_开头,且不能是系统保留字"),!0)},test_id:"str",group_id:"str",distinct_id:function(e){return _.isString(e)&&/^.{1,255}$/.test(e)?!0:(logger.info("distinct_id必须是不能为空,且小于255位的字符串"),!1)}},saEvent.check=function(e){var t=!0;for(var r in e)if(!this.checkOption.check(r,e[r]))return!1;return t},saEvent.send=function(e,t){var r={distinct_id:store.getDistinctId(),lib:{$lib:"js",$lib_method:"code",$lib_version:String(LIB_VERSION)},properties:{}};if("string"!=typeof store.getDistinctId()||""==typeof store.getDistinctId()){var n="";switch(store.getDistinctId()){case null:n="null";break;case void 0:n="undefined";break;case"":n="空";break;default:n=String(store.getDistinctId())}error_msg.push("distinct_id_wrong"+n+"-"+(new Date).getTime())}_.extend(r,e),error_msg.length>0&&(r.jssdk_error=error_msg.join("--")),_.isObject(e.properties)&&!_.isEmptyObject(e.properties)&&_.extend(r.properties,e.properties),_.isObject(t)&&_.extend(r.lib,t),e.type&&"profile"===e.type.slice(0,7)||(r.properties=_.extend({},_.info.properties(),store.getProps(),store.getSessionProps(),_.info.currentProps,r.properties)),r.properties.$time&&_.isDate(r.properties.$time)?(r.time=1*r.properties.$time,delete r.properties.$time):sd.para.use_client_time&&(r.time=1*new Date),_.searchObjDate(r),_.searchObjString(r),saNewUser.checkIsAddSign(r),saNewUser.checkIsFirstTime(r),sd.para.debug_mode===!0?(logger.info(r),this.debugPath(JSON.stringify(r),t)):sd.sendState.getSendCall(r,t)},saEvent.debugPath=function(e,t){var r="";r=-1!==sd.para.debug_mode_url.indexOf("?")?sd.para.debug_mode_url+"&data="+encodeURIComponent(_.base64Encode(e)):sd.para.debug_mode_url+"?data="+encodeURIComponent(_.base64Encode(e)),_.ajax({url:r,type:"GET",cors:!0,header:{"Dry-Run":String(sd.para.debug_mode_upload)}})};var store=sd.store={getProps:function(){return this._state.props},getSessionProps:function(){return this._sessionState},getDistinctId:function(){return this._state.distinct_id},toState:function(e){var t=null;null!==e&&"object"==typeof(t=JSON.parse(e))?t.distinct_id?this._state=t:(this.set("distinct_id",_.UUID()),error_msg.push("parseCookieDistinctJSSDKError")):(this.set("distinct_id",_.UUID()),error_msg.push("parseCookieJSSDKError"))},initSessionState:function(){var e=_.cookie.get("sensorsdata2015session"),t=null;null!==e&&"object"==typeof(t=JSON.parse(e))&&(this._sessionState=t)},setOnce:function(e,t){e in this._state||this.set(e,t)},set:function(e,t){this._state[e]=t,this.save()},change:function(e,t){this._state[e]=t},setSessionProps:function(e){var t=this._sessionState;_.extend(t,e),this.sessionSave(t)},setSessionPropsOnce:function(e){var t=this._sessionState;_.coverExtend(t,e),this.sessionSave(t)},setProps:function(e){var t=this._state.props||{};_.extend(t,e),this.set("props",t)},setPropsOnce:function(e){var t=this._state.props||{};_.coverExtend(t,e),this.set("props",t)},sessionSave:function(e){this._sessionState=e,_.cookie.set("sensorsdata2015session",JSON.stringify(this._sessionState),0)},save:function(){_.cookie.set("sensorsdata2015jssdkcross",JSON.stringify(this._state),730,sd.para.cross_subdomain)},_sessionState:{},_state:{},init:function(){navigator.cookieEnabled||(error_msg.push("cookieNotEnable"),_.localStorage.isSupport||error_msg.push("localStorageNotEnable")),this.initSessionState();var e=_.cookie.get(sd.para.cross_subdomain?"sensorsdata2015jssdkcross":"sensorsdata2015jssdk");null===e?(is_first_visitor=!0,this.set("distinct_id",_.UUID())):this.toState(e),saNewUser.storeInitCheck()}},commonWays={getUtm:function(){return _.info.campaignParams()},getStayTime:function(){return(new Date-sd._t)/1e3},setInitReferrer:function(){var e=document.referrer.slice(0,sd.para.max_referrer_string_length);sd.setOnceProfile({_init_referrer:e,_init_referrer_domain:_.referringDomain(e)})},setSessionReferrer:function(){var e=document.referrer.slice(0,sd.para.max_referrer_string_length);store.setSessionPropsOnce({_session_referrer:e,_session_referrer_domain:_.referringDomain(e)})},setDefaultAttr:function(){_.info.register({_current_url:location.href,_referrer:document.referrer.slice(0,sd.para.max_referrer_string_length),_referring_domain:_.referringDomain(document.referrer)})},autoTrack:function(){var e=_.info.campaignParams(),t={};for(var r in e)-1!==(" "+source_channel_standard+" ").indexOf(" "+r+" ")?t["$"+r]=e[r]:t[r]=e[r];is_first_visitor&&sd.setOnceProfile(_.extend({$first_visit_time:new Date,$first_referrer:document.referrer.slice(0,sd.para.max_referrer_string_length),$first_browser_language:navigator.language,$first_referrer_host:_.referringDomain(document.referrer)},t)),sd.track("$pageview",_.extend({$referrer:document.referrer.slice(0,sd.para.max_referrer_string_length),$referrer_host:_.referringDomain(document.referrer),$url:location.href,$url_path:location.pathname,$title:document.title},t))}};sd.quick=function(){var e=slice.call(arguments),t=e[0],r=e.slice(1);return"string"==typeof t&&commonWays[t]?commonWays[t].apply(sd,r):void("function"==typeof t?t.apply(sd,r):logger.info("quick方法中没有这个功能"+e[0]))},sd.track=function(e,t,r){saEvent.check({event:e,properties:t})&&saEvent.send({type:"track",event:e,properties:t},r)},sd.setProfile=function(e,t){saEvent.check({propertiesMust:e})&&saEvent.send({type:"profile_set",properties:e},t)},sd.setOnceProfile=function(e,t){saEvent.check({propertiesMust:e})&&saEvent.send({type:"profile_set_once",properties:e},t)},sd.appendProfile=function(e,t){saEvent.check({propertiesMust:e})&&(_.each(e,function(t,r){_.isString(t)?e[r]=[t]:_.isArray(t)||(delete e[r],logger.info("appendProfile属性的值必须是字符串或者数组"))}),_.isEmptyObject(e)||saEvent.send({type:"profile_append",properties:e},t))},sd.incrementProfile=function(e,t){function r(e){for(var t in e)if(!/-*\d+/.test(String(e[t])))return!1;return!0}var n=e;_.isString(e)&&(e={},e[n]=1),saEvent.check({propertiesMust:e})&&(r(e)?saEvent.send({type:"profile_increment",properties:e},t):logger.info("profile_increment的值只能是数字"))},sd.deleteProfile=function(e){saEvent.send({type:"profile_delete"},e),store.set("distinct_id",_.UUID())},sd.unsetProfile=function(e,t){var r=e,n={};_.isString(e)&&(e=[],e.push(r)),_.isArray(e)?(_.each(e,function(e){_.isString(e)?n[e]=!0:logger.info("profile_unset给的数组里面的值必须时string,已经过滤掉",e)}),saEvent.send({type:"profile_unset",properties:n},t)):logger.info("profile_unset的参数是数组")},sd.identify=function(e,t){"undefined"==typeof e?store.set("distinct_id",_.UUID()):saEvent.check({distinct_id:e})?t===!0?store.set("distinct_id",e):store.change("distinct_id",e):logger.info("identify的参数必须是字符串")},sd.trackSignup=function(e,t,r,n){saEvent.check({distinct_id:e,event:t,properties:r})&&(saEvent.send({original_id:store.getDistinctId(),distinct_id:e,type:"track_signup",event:t,properties:r},n),store.set("distinct_id",e))},sd.trackAbtest=function(e,t){},sd.registerPage=function(e){saEvent.check({properties:e})?_.extend(_.info.currentProps,e):logger.info("register输入的参数有误"); -},sd.register=function(e){saEvent.check({properties:e})?store.setProps(e):logger.info("register输入的参数有误")},sd.registerOnce=function(e){saEvent.check({properties:e})?store.setPropsOnce(e):logger.info("registerOnce输入的参数有误")},sd.registerSession=function(e){saEvent.check({properties:e})?store.setSessionProps(e):logger.info("registerSession输入的参数有误")},sd.registerSessionOnce=function(e){saEvent.check({properties:e})?store.setSessionPropsOnce(e):logger.info("registerSessionOnce输入的参数有误")},sd.init=function(){_.info.initPage(),store.init(),_.each(sd._q,function(e){sd[e[0]].apply(sd,slice.call(e[1]))})},sd.init()}(window.sensorsDataAnalytic201505); \ No newline at end of file +!function(sd){function app_js_bridge(){function e(e){r=e,n&&n(e)}function t(){"object"==typeof window.SensorsData_APP_JS_Bridge&&window.SensorsData_APP_JS_Bridge.sensorsdata_call_app&&(r=SensorsData_APP_JS_Bridge.sensorsdata_call_app())}var r=null,n=null;window.sensorsdata_app_js_bridge_call_js=function(t){e(t)},sd.getAppStatus=function(e){return t(),e?void(null===r?n=e:e(r)):r}}if(sd=window[sd],sd._t=sd._t||1*new Date,"function"!=typeof sd&&"object"!=typeof sd||sd.has_load_sdk)return!1;sd.has_load_sdk=!0,"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var r,n,i,o,s,a=gap,c=t[e];switch(c&&"object"==typeof c&&"function"==typeof c.toJSON&&(c=c.toJSON(e)),"function"==typeof rep&&(c=rep.call(t,e,c)),typeof c){case"string":return quote(c);case"number":return isFinite(c)?String(c):"null";case"boolean":case"null":return String(c);case"object":if(!c)return"null";if(gap+=indent,s=[],"[object Array]"===Object.prototype.toString.apply(c)){for(o=c.length,r=0;o>r;r+=1)s[r]=str(r,c)||"null";return i=0===s.length?"[]":gap?"[\n"+gap+s.join(",\n"+gap)+"\n"+a+"]":"["+s.join(",")+"]",gap=a,i}if(rep&&"object"==typeof rep)for(o=rep.length,r=0;o>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));else for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(i=str(n,c),i&&s.push(quote(n)+(gap?": ":":")+i));return i=0===s.length?"{}":gap?"{\n"+gap+s.join(",\n"+gap)+"\n"+a+"}":"{"+s.join(",")+"}",gap=a,i}}var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,r){var n;if(gap="",indent="","number"==typeof r)for(n=0;r>n;n+=1)indent+=" ";else"string"==typeof r&&(indent=r);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var r,n,i=e[t];if(i&&"object"==typeof i)for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n=walk(i,r),void 0!==n?i[r]=n:delete i[r]);return reviver.call(e,t,i)}var j;if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}();var _=sd._={};sd.para=sd.para||{},sd.para_default={max_referrer_string_length:500,max_string_length:1e3,cross_subdomain:!0,show_log:!0,debug_mode:!1,debug_mode_upload:!1,session_time:0,use_client_time:!1,source_channel:[],vtrack_ignore:{}};for(var i in sd.para_default)void 0===sd.para[i]&&(sd.para[i]=sd.para_default[i]);/sa\.gif[^\/]*$/.test(sd.para.server_url)||(sd.para.server_url=sd.para.server_url.replace(/\/sa$/,"/sa.gif").replace(/(\/sa)(\?[^\/]+)$/,"/sa.gif$2")),sd.para.debug_mode_url=sd.para.debug_mode_url||sd.para.server_url.replace("sa.gif","debug"),sd.para.noCache===!0?sd.para.noCache="?"+(new Date).getTime():sd.para.noCache="";var detector={};!function(){function e(e){return Object.prototype.toString.call(e)}function t(t){return"[object Object]"===e(t)}function r(t){return"[object Function]"===e(t)}function n(e,t){for(var r=0,n=e.length;n>r&&t.call(e,e[r],r)!==!1;r++);}function i(e){if(!_.test(e))return null;var t,r,n,i,o;if(-1!==e.indexOf("trident/")&&(t=/\btrident\/([0-9.]+)/.exec(e),t&&t.length>=2)){n=t[1];var s=t[1].split(".");s[0]=parseInt(s[0],10)+4,o=s.join(".")}t=_.exec(e),i=t[1];var a=t[1].split(".");return"undefined"==typeof o&&(o=i),a[0]=parseInt(a[0],10)-4,r=a.join("."),"undefined"==typeof n&&(n=r),{browserVersion:o,browserMode:i,engineVersion:n,engineMode:r,compatible:n!==r}}function o(e){if(f)try{var t=f.twGetRunPath.toLowerCase(),r=f.twGetSecurityID(u),n=f.twGetVersion(r);if(t&&-1===t.indexOf(e))return!1;if(n)return{version:n}}catch(i){}}function s(n,i,o){var s=r(i)?i.call(null,o):i;if(!s)return null;var a={name:n,version:c,codename:""},u=e(s);if(s===!0)return a;if("[object String]"===u){if(-1!==o.indexOf(s))return a}else{if(t(s))return s.hasOwnProperty("version")&&(a.version=s.version),a;if(s.exec){var f=s.exec(o);if(f)return f.length>=2&&f[1]?a.version=f[1].replace(/_/g,"."):a.version=c,a}}}function a(e,t,r,i){var o=S;n(t,function(t){var r=s(t[0],t[1],e);return r?(o=r,!1):void 0}),r.call(i,o.name,o.version)}var c="-1",u=window,f=u.external,d=u.navigator.userAgent||"",p=u.navigator.appVersion||"",l=u.navigator.vendor||"",_=/\b(?:msie |ie |trident\/[0-9].*rv[ :])([0-9.]+)/,g=/\bbb10\b.+?\bversion\/([\d.]+)/,h=/\bblackberry\b.+\bversion\/([\d.]+)/,b=/\bblackberry\d+\/([\d.]+)/,m=[["nokia",function(e){return-1!==e.indexOf("nokia ")?/\bnokia ([0-9]+)?/:/\bnokia([a-z0-9]+)?/}],["samsung",function(e){return-1!==e.indexOf("samsung")?/\bsamsung(?:[ \-](?:sgh|gt|sm))?-([a-z0-9]+)/:/\b(?:sgh|sch|gt|sm)-([a-z0-9]+)/}],["wp",function(e){return-1!==e.indexOf("windows phone ")||-1!==e.indexOf("xblwp")||-1!==e.indexOf("zunewp")||-1!==e.indexOf("windows ce")}],["pc","windows"],["ipad","ipad"],["ipod","ipod"],["iphone",/\biphone\b|\biph(\d)/],["mac","macintosh"],["mi",/\bmi[ \-]?([a-z0-9 ]+(?= build|\)))/],["hongmi",/\bhm[ \-]?([a-z0-9]+)/],["aliyun",/\baliyunos\b(?:[\-](\d+))?/],["meizu",function(e){return e.indexOf("meizu")>=0?/\bmeizu[\/ ]([a-z0-9]+)\b/:/\bm([0-9cx]{1,4})\b/}],["nexus",/\bnexus ([0-9s.]+)/],["huawei",function(e){var t=/\bmediapad (.+?)(?= build\/huaweimediapad\b)/;return-1!==e.indexOf("huawei-huawei")?/\bhuawei\-huawei\-([a-z0-9\-]+)/:t.test(e)?t:/\bhuawei[ _\-]?([a-z0-9]+)/}],["lenovo",function(e){return-1!==e.indexOf("lenovo-lenovo")?/\blenovo\-lenovo[ \-]([a-z0-9]+)/:/\blenovo[ \-]?([a-z0-9]+)/}],["zte",function(e){return/\bzte\-[tu]/.test(e)?/\bzte-[tu][ _\-]?([a-su-z0-9\+]+)/:/\bzte[ _\-]?([a-su-z0-9\+]+)/}],["vivo",/\bvivo(?: ([a-z0-9]+))?/],["htc",function(e){return/\bhtc[a-z0-9 _\-]+(?= build\b)/.test(e)?/\bhtc[ _\-]?([a-z0-9 ]+(?= build))/:/\bhtc[ _\-]?([a-z0-9 ]+)/}],["oppo",/\boppo[_]([a-z0-9]+)/],["konka",/\bkonka[_\-]([a-z0-9]+)/],["sonyericsson",/\bmt([a-z0-9]+)/],["coolpad",/\bcoolpad[_ ]?([a-z0-9]+)/],["lg",/\blg[\-]([a-z0-9]+)/],["android",/\bandroid\b|\badr\b/],["blackberry",function(e){return e.indexOf("blackberry")>=0?/\bblackberry\s?(\d+)/:"bb10"}]],v=[["wp",function(e){return-1!==e.indexOf("windows phone ")?/\bwindows phone (?:os )?([0-9.]+)/:-1!==e.indexOf("xblwp")?/\bxblwp([0-9.]+)/:-1!==e.indexOf("zunewp")?/\bzunewp([0-9.]+)/:"windows phone"}],["windows",/\bwindows nt ([0-9.]+)/],["macosx",/\bmac os x ([0-9._]+)/],["iPhone OS",function(e){return/\bcpu(?: iphone)? os /.test(e)?/\bcpu(?: iphone)? os ([0-9._]+)/:-1!==e.indexOf("iph os ")?/\biph os ([0-9_]+)/:/\bios\b/}],["yunos",/\baliyunos ([0-9.]+)/],["Android",function(e){return e.indexOf("android")>=0?/\bandroid[ \/-]?([0-9.x]+)?/:e.indexOf("adr")>=0?e.indexOf("mqqbrowser")>=0?/\badr[ ]\(linux; u; ([0-9.]+)?/:/\badr(?:[ ]([0-9.]+))?/:"android"}],["chromeos",/\bcros i686 ([0-9.]+)/],["linux","linux"],["windowsce",/\bwindows ce(?: ([0-9.]+))?/],["symbian",/\bsymbian(?:os)?\/([0-9.]+)/],["blackberry",function(e){var t=e.match(g)||e.match(h)||e.match(b);return t?{version:t[1]}:"blackberry"}]],y=[["edgehtml",/edge\/([0-9.]+)/],["trident",_],["blink",function(){return"chrome"in u&&"CSS"in u&&/\bapplewebkit[\/]?([0-9.+]+)/}],["webkit",/\bapplewebkit[\/]?([0-9.+]+)/],["gecko",function(e){var t;return(t=e.match(/\brv:([\d\w.]+).*\bgecko\/(\d+)/))?{version:t[1]+"."+t[2]}:void 0}],["presto",/\bpresto\/([0-9.]+)/],["androidwebkit",/\bandroidwebkit\/([0-9.]+)/],["coolpadwebkit",/\bcoolpadwebkit\/([0-9.]+)/],["u2",/\bu2\/([0-9.]+)/],["u3",/\bu3\/([0-9.]+)/]],w=[["edge",/edge\/([0-9.]+)/],["sogou",function(e){return e.indexOf("sogoumobilebrowser")>=0?/sogoumobilebrowser\/([0-9.]+)/:e.indexOf("sogoumse")>=0?!0:/ se ([0-9.x]+)/}],["theworld",function(){var e=o("theworld");return"undefined"!=typeof e?e:"theworld"}],["360",function(e){var t=o("360se");return"undefined"!=typeof t?t:-1!==e.indexOf("360 aphone browser")?/\b360 aphone browser \(([^\)]+)\)/:/\b360(?:se|ee|chrome|browser)\b/}],["maxthon",function(){try{if(f&&(f.mxVersion||f.max_version))return{version:f.mxVersion||f.max_version}}catch(e){}return/\b(?:maxthon|mxbrowser)(?:[ \/]([0-9.]+))?/}],["micromessenger",/\bmicromessenger\/([\d.]+)/],["qq",/\bm?qqbrowser\/([0-9.]+)/],["green","greenbrowser"],["tt",/\btencenttraveler ([0-9.]+)/],["liebao",function(e){if(e.indexOf("liebaofast")>=0)return/\bliebaofast\/([0-9.]+)/;if(-1===e.indexOf("lbbrowser"))return!1;var t;try{f&&f.LiebaoGetVersion&&(t=f.LiebaoGetVersion())}catch(r){}return{version:t||c}}],["tao",/\btaobrowser\/([0-9.]+)/],["coolnovo",/\bcoolnovo\/([0-9.]+)/],["saayaa","saayaa"],["baidu",/\b(?:ba?idubrowser|baiduhd)[ \/]([0-9.x]+)/],["ie",_],["mi",/\bmiuibrowser\/([0-9.]+)/],["opera",function(e){var t=/\bopera.+version\/([0-9.ab]+)/,r=/\bopr\/([0-9.]+)/;return t.test(e)?t:r}],["oupeng",/\boupeng\/([0-9.]+)/],["yandex",/yabrowser\/([0-9.]+)/],["ali-ap",function(e){return e.indexOf("aliapp")>0?/\baliapp\(ap\/([0-9.]+)\)/:/\balipayclient\/([0-9.]+)\b/}],["ali-ap-pd",/\baliapp\(ap-pd\/([0-9.]+)\)/],["ali-am",/\baliapp\(am\/([0-9.]+)\)/],["ali-tb",/\baliapp\(tb\/([0-9.]+)\)/],["ali-tb-pd",/\baliapp\(tb-pd\/([0-9.]+)\)/],["ali-tm",/\baliapp\(tm\/([0-9.]+)\)/],["ali-tm-pd",/\baliapp\(tm-pd\/([0-9.]+)\)/],["uc",function(e){return e.indexOf("ucbrowser/")>=0?/\bucbrowser\/([0-9.]+)/:e.indexOf("ubrowser/")>=0?/\bubrowser\/([0-9.]+)/:/\buc\/[0-9]/.test(e)?/\buc\/([0-9.]+)/:e.indexOf("ucweb")>=0?/\bucweb([0-9.]+)?/:/\b(?:ucbrowser|uc)\b/}],["chrome",/ (?:chrome|crios|crmo)\/([0-9.]+)/],["android",function(e){return-1!==e.indexOf("android")?/\bversion\/([0-9.]+(?: beta)?)/:void 0}],["blackberry",function(e){var t=e.match(g)||e.match(h)||e.match(b);return t?{version:t[1]}:"blackberry"}],["safari",/\bversion\/([0-9.]+(?: beta)?)(?: mobile(?:\/[a-z0-9]+)?)? safari\//],["webview",/\bcpu(?: iphone)? os (?:[0-9._]+).+\bapplewebkit\b/],["firefox",/\bfirefox\/([0-9.ab]+)/],["nokia",/\bnokiabrowser\/([0-9.]+)/]],S={name:"na",version:c},x=function(e){e=(e||"").toLowerCase();var t={};a(e,m,function(e,r){var n=parseFloat(r);t.device={name:e,version:n,fullVersion:r},t.device[e]=n},t),a(e,v,function(e,r){var n=parseFloat(r);t.os={name:e,version:n,fullVersion:r},t.os[e]=n},t);var r=i(e);return a(e,y,function(e,n){var i=n;r&&(n=r.engineVersion||r.engineMode,i=r.engineMode);var o=parseFloat(n);t.engine={name:e,version:o,fullVersion:n,mode:parseFloat(i),fullMode:i,compatible:r?r.compatible:!1},t.engine[e]=o},t),a(e,w,function(e,n){var i=n;r&&("ie"===e&&(n=r.browserVersion),i=r.browserMode);var o=parseFloat(n);t.browser={name:e,version:o,fullVersion:n,mode:parseFloat(i),fullMode:i,compatible:r?r.compatible:!1},t.browser[e]=o},t),t};detector=x(d+" "+p+" "+l)}();var ArrayProto=Array.prototype,FuncProto=Function.prototype,ObjProto=Object.prototype,slice=ArrayProto.slice,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty,LIB_VERSION="1.6";sd.lib_version=LIB_VERSION;var error_msg=[],is_first_visitor=!1,source_channel_standard="utm_source utm_medium utm_campaign utm_content utm_term",logger="object"==typeof logger?logger:{};logger.info=function(){if(!sd.para.show_log)return!1;if("object"==typeof console&&console.log)try{return console.log.apply(console,arguments)}catch(e){console.log(arguments[0])}},function(){var e=(FuncProto.bind,ArrayProto.forEach),t=ArrayProto.indexOf,r=Array.isArray,n={},i=_.each=function(t,r,i){if(null==t)return!1;if(e&&t.forEach===e)t.forEach(r,i);else if(t.length===+t.length){for(var o=0,s=t.length;s>o;o++)if(o in t&&r.call(i,t[o],o,t)===n)return!1}else for(var a in t)if(hasOwnProperty.call(t,a)&&r.call(i,t[a],a,t)===n)return!1};_.logger=logger,_.extend=function(e){return i(slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&(e[r]=t[r])}),e},_.extend2Lev=function(e){return i(slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&(_.isObject(t[r])&&_.isObject(e[r])?_.extend(e[r],t[r]):e[r]=t[r])}),e},_.coverExtend=function(e){return i(slice.call(arguments,1),function(t){for(var r in t)void 0!==t[r]&&void 0===e[r]&&(e[r]=t[r])}),e},_.isArray=r||function(e){return"[object Array]"===toString.call(e)},_.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},_.isArguments=function(e){return!(!e||!hasOwnProperty.call(e,"callee"))},_.toArray=function(e){return e?e.toArray?e.toArray():_.isArray(e)?slice.call(e):_.isArguments(e)?slice.call(e):_.values(e):[]},_.values=function(e){var t=[];return null==e?t:(i(e,function(e){t[t.length]=e}),t)},_.include=function(e,r){var o=!1;return null==e?o:t&&e.indexOf===t?-1!=e.indexOf(r):(i(e,function(e){return o||(o=e===r)?n:void 0}),o)},_.includes=function(e,t){return-1!==e.indexOf(t)}}(),_.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},_.isObject=function(e){return"[object Object]"==toString.call(e)},_.isEmptyObject=function(e){if(_.isObject(e)){for(var t in e)if(hasOwnProperty.call(e,t))return!1;return!0}return!1},_.isUndefined=function(e){return void 0===e},_.isString=function(e){return"[object String]"==toString.call(e)},_.isDate=function(e){return"[object Date]"==toString.call(e)},_.isBoolean=function(e){return"[object Boolean]"==toString.call(e)},_.isNumber=function(e){return"[object Number]"==toString.call(e)&&/[\d\.]+/.test(String(e))},_.isJSONString=function(e){try{JSON.parse(e)}catch(t){return!1}return!0},_.encodeDates=function(e){return _.each(e,function(t,r){_.isDate(t)?e[r]=_.formatDate(t):_.isObject(t)&&(e[r]=_.encodeDates(t))}),e},_.formatDate=function(e){function t(e){return 10>e?"0"+e:e}return e.getFullYear()+"-"+t(e.getMonth()+1)+"-"+t(e.getDate())+" "+t(e.getHours())+":"+t(e.getMinutes())+":"+t(e.getSeconds())+"."+t(e.getMilliseconds())},_.searchObjDate=function(e){_.isObject(e)&&_.each(e,function(t,r){_.isObject(t)?_.searchObjDate(e[r]):_.isDate(t)&&(e[r]=_.formatDate(t))})},_.formatString=function(e){return e.length>sd.para.max_string_length?(logger.info("字符串长度超过限制,已经做截取--"+e),e.slice(0,sd.para.max_string_length)):e},_.searchObjString=function(e){_.isObject(e)&&_.each(e,function(t,r){_.isObject(t)?_.searchObjString(e[r]):_.isString(t)&&(e[r]=_.formatString(t))})},_.unique=function(e){for(var t,r=[],n={},i=0;i0&&(t[r]=e)}),t},_.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n");var t,r,n,i="",o=0;for(t=r=0,o=e.length,n=0;o>n;n++){var s=e.charCodeAt(n),a=null;128>s?r++:a=s>127&&2048>s?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),null!==a&&(r>t&&(i+=e.substring(t,r)),i+=a,t=r=n+1)}return r>t&&(i+=e.substring(t,e.length)),i},_.detector=detector,_.base64Encode=function(e){var t,r,n,i,o,s,a,c,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,d=0,p="",l=[];if(!e)return e;e=_.utf8Encode(e);do t=e.charCodeAt(f++),r=e.charCodeAt(f++),n=e.charCodeAt(f++),c=t<<16|r<<8|n,i=c>>18&63,o=c>>12&63,s=c>>6&63,a=63&c,l[d++]=u.charAt(i)+u.charAt(o)+u.charAt(s)+u.charAt(a);while(f=4&&(s=t(s,o),o=[]);return o.length>0&&(s=t(s,o)),s.toString(16)};return function(){var n=String(screen.height*screen.width);return n=n&&/\d{5,}/.test(n)?n.toString(16):String(31242*Math.random()).replace(".","").slice(0,8),e()+"-"+t()+"-"+r()+"-"+n+"-"+e()}}(),_.getQueryParam=function(e,t){t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var r="[\\?&]"+t+"=([^&#]*)",n=new RegExp(r),i=n.exec(e);return null===i||i&&"string"!=typeof i[1]&&i[1].length?"":decodeURIComponent(i[1]).replace(/\+/g," ")},_.urlParse=function(e){var t=function(e){this._fields={Username:4,Password:5,Port:7,Protocol:2,Host:6,Path:8,URL:0,QueryString:9,Fragment:10},this._values={},this._regex=null,this._regex=/^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/,"undefined"!=typeof e&&this._parse(e)};return t.prototype.setUrl=function(e){this._parse(e)},t.prototype._initValues=function(){for(var e in this._fields)this._values[e]=""},t.prototype.getUrl=function(){var e="";return e+=this._values.Origin,e+=this._values.Port?":"+this._values.Port:"",e+=this._values.Path,e+=this._values.QueryString?"?"+this._values.QueryString:""},t.prototype._parse=function(e){this._initValues();var t=this._regex.exec(e);if(!t)throw"DPURLParser::_parse -> Invalid URL";for(var r in this._fields)"undefined"!=typeof t[this._fields[r]]&&(this._values[r]=t[this._fields[r]]);this._values.Hostname=this._values.Host.replace(/:\d+$/,""),this._values.Origin=this._values.Protocol+"://"+this._values.Hostname},new t(e)},_.referringDomain=function(e){var t=e.split("/");return t.length>=3?t[2]:""},_.getDomainByHost=function(e){if("string"==typeof e&&e.split(".").length>=2){var t=e.match(/[^\.]+\.[^.]+$/);return t&&t[0]?t[0]:""}return""},_.hasStandardBrowserEnviroment=function(){return window?document?navigator?screen?void 0:"screen":"navigator":"document":"window"},_.cookie={get:function(e){for(var t=e+"=",r=document.cookie.split(";"),n=0;n=200&&r.status<300||304==r.status?e.success(t(r.responseText)):e.error(t(r.responseText),r.status),r.onreadystatechange=null,r.onload=null)},r.open(e.type,e.url,!0);try{if(r.withCredentials=!0,_.isObject(e.header))for(var n in e.header)r.setRequestHeader(n,e.header[n]);e.data&&(r.setRequestHeader("X-Requested-With","XMLHttpRequest"),"application/json"===e.contentType?r.setRequestHeader("Content-type","application/json; charset=UTF-8"):r.setRequestHeader("Content-type","application/x-www-form-urlencoded"))}catch(i){}r.send(e.data||null)},_.info={initPage:function(){var e=document.referrer,t=e?_.referringDomain(e):e,r=_.getDomainByHost(t),n=location.href,i=n?_.referringDomain(n):n,o=_.getDomainByHost(i);this.pageProp={referrer:e,referrer_host:t,referrer_domain:r,url:n,url_host:i,url_domain:o}},pageProp:{},campaignParams:function(){var e=source_channel_standard.split(" "),t="",r={};return _.isArray(sd.para.source_channel)&&sd.para.source_channel.length>0&&(e=e.concat(sd.para.source_channel),e=_.unique(e)),_.each(e,function(e){t=_.getQueryParam(location.href,e),t.length&&(r[e]=t)}),r},campaignParamsStandard:function(){var e=_.info.campaignParams(),t={},r={};for(var n in e)-1!==(" "+source_channel_standard+" ").indexOf(" "+n+" ")?t["$"+n]=e[n]:r[n]=e[n];return{$utms:t,otherUtms:r}},properties:function(){return{$os:detector.os.name,$model:detector.device.name,$os_version:String(detector.os.version),$screen_height:Number(screen.height)||0,$screen_width:Number(screen.width)||0,$lib:"js",$lib_version:String(LIB_VERSION),$browser:detector.browser.name,$browser_version:String(detector.browser.version)}},currentProps:{},register:function(e){_.extend(_.info.currentProps,e)}},sd.sendState={},sd.sendState._complete=0,sd.sendState._receive=0,sd.sendState.getSendCall=function(e,t){++this._receive;var r="_state"+this._receive,n=this;this[r]=document.createElement("img"),this[r].onload=this[r].onerror=function(e){n[r].onload=null,n[r].onerror=null,delete n[r],++n._complete,"function"==typeof t&&t()},e._nocache=(String(Math.random())+String(Math.random())+String(Math.random())).slice(2,15),logger.info(e),e=JSON.stringify(e),-1!==sd.para.server_url.indexOf("?")?this[r].src=sd.para.server_url+"&data="+encodeURIComponent(_.base64Encode(e)):this[r].src=sd.para.server_url+"?data="+encodeURIComponent(_.base64Encode(e))};var saNewUser={checkIsAddSign:function(e){"track"===e.type&&(null!==_.cookie.get("sensorsdata_is_new_user")?e.properties.$is_first_day=!0:e.properties.$is_first_day=!1)},is_first_visit_time:!1,checkIsFirstTime:function(e){"track"===e.type&&(this.is_first_visit_time?(e.properties.$is_first_time=!0,this.is_first_visit_time=!1):e.properties.$is_first_time=!1)},storeInitCheck:function(){if(is_first_visitor){var e=new Date,t={h:23-e.getHours(),m:59-e.getMinutes(),s:59-e.getSeconds()};_.cookie.set("sensorsdata_is_new_user","true",3600*t.h+60*t.m+t.s+"s"),this.is_first_visit_time=!0}else null===_.cookie.get("sensorsdata_is_new_user")&&(this.checkIsAddSign=function(e){"track"===e.type&&(e.properties.$is_first_day=!1)}),this.checkIsFirstTime=function(e){"track"===e.type&&(e.properties.$is_first_time=!1)}},checkIsFirstLatest:function(){var e=_.info.pageProp.url_domain,t=_.info.pageProp.referrer_domain;""!==e&&e!==t&&sa.register({$latest_referrer:_.info.pageProp.referrer,$latest_referrer_host:_.info.pageProp.referrer_host});var r=_.info.campaignParamsStandard().$utms;_.isEmptyObject(r)||sd.register(r)}},saEvent={};saEvent.checkOption={regChecks:{regName:/^((?!^distinct_id$|^original_id$|^time$|^properties$|^id$|^first_id$|^second_id$|^users$|^events$|^event$|^user_id$|^date$|^datetime$)[a-zA-Z_$][a-zA-Z\d_$]{0,99})$/i},checkPropertiesKey:function(e){var t=this,r=!0;return _.each(e,function(e,n){t.regChecks.regName.test(n)||(r=!1)}),r},check:function(e,t){return"string"==typeof this[e]?this[this[e]](t):this[e](t)},str:function(e){return _.isString(e)?!0:(logger.info("请检查参数格式,必须是字符串"),!0)},properties:function(e){return _.strip_sa_properties(e),e?_.isObject(e)?this.checkPropertiesKey(e)?!0:(logger.info("properties里的key必须是由字符串数字_组成,且不能是系统保留字"),!0):(logger.info("properties可以没有,但有的话必须是对象"),!0):!0},propertiesMust:function(e){return _.strip_sa_properties(e),void 0===e||!_.isObject(e)||_.isEmptyObject(e)?(logger.info("properties必须是对象且有值"),!0):this.checkPropertiesKey(e)?!0:(logger.info("properties里的key必须是由字符串数字_组成,且不能是系统保留字"),!0)},event:function(e){return _.isString(e)&&this.regChecks.regName.test(e)?!0:(logger.info("请检查参数格式,必须是字符串,且eventName必须是字符串_开头,且不能是系统保留字"),!0)},test_id:"str",group_id:"str",distinct_id:function(e){return _.isString(e)&&/^.{1,255}$/.test(e)?!0:(logger.info("distinct_id必须是不能为空,且小于255位的字符串"),!1)}},saEvent.check=function(e){var t=!0;for(var r in e)if(!this.checkOption.check(r,e[r]))return!1;return t},saEvent.send=function(e,t){var r={distinct_id:store.getDistinctId(),lib:{$lib:"js",$lib_method:"code",$lib_version:String(LIB_VERSION)},properties:{}};if("string"!=typeof store.getDistinctId()||""==typeof store.getDistinctId()){var n="";switch(store.getDistinctId()){case null:n="null";break;case void 0:n="undefined";break;case"":n="空";break;default:n=String(store.getDistinctId())}error_msg.push("distinct_id_wrong"+n+"-"+(new Date).getTime())}_.extend(r,e),error_msg.length>0&&(r.jssdk_error=error_msg.join("--")),_.isObject(e.properties)&&!_.isEmptyObject(e.properties)&&_.extend(r.properties,e.properties),_.isObject(t)&&_.extend(r.lib,t),e.type&&"profile"===e.type.slice(0,7)||(r.properties=_.extend({},_.info.properties(),store.getProps(),store.getSessionProps(),_.info.currentProps,r.properties)),r.properties.$time&&_.isDate(r.properties.$time)?(r.time=1*r.properties.$time,delete r.properties.$time):sd.para.use_client_time&&(r.time=1*new Date),_.searchObjDate(r),_.searchObjString(r),saNewUser.checkIsAddSign(r),saNewUser.checkIsFirstTime(r),sd.para.debug_mode===!0?(logger.info(r),this.debugPath(JSON.stringify(r),t)):sd.sendState.getSendCall(r,t)},saEvent.debugPath=function(e,t){var r="";r=-1!==sd.para.debug_mode_url.indexOf("?")?sd.para.debug_mode_url+"&data="+encodeURIComponent(_.base64Encode(e)):sd.para.debug_mode_url+"?data="+encodeURIComponent(_.base64Encode(e)),_.ajax({url:r,type:"GET",cors:!0,header:{"Dry-Run":String(sd.para.debug_mode_upload)}})};var store=sd.store={getProps:function(){return this._state.props},getSessionProps:function(){return this._sessionState},getDistinctId:function(){return this._state.distinct_id},toState:function(e){var t=null;null!==e&&"object"==typeof(t=JSON.parse(e))?t.distinct_id?this._state=t:(this.set("distinct_id",_.UUID()),error_msg.push("parseCookieDistinctJSSDKError")):(this.set("distinct_id",_.UUID()),error_msg.push("parseCookieJSSDKError"))},initSessionState:function(){var e=_.cookie.get("sensorsdata2015session"),t=null;null!==e&&"object"==typeof(t=JSON.parse(e))&&(this._sessionState=t)},setOnce:function(e,t){e in this._state||this.set(e,t)},set:function(e,t){this._state[e]=t,this.save()},change:function(e,t){this._state[e]=t},setSessionProps:function(e){var t=this._sessionState;_.extend(t,e),this.sessionSave(t)},setSessionPropsOnce:function(e){var t=this._sessionState;_.coverExtend(t,e),this.sessionSave(t)},setProps:function(e){var t=this._state.props||{};_.extend(t,e),this.set("props",t)},setPropsOnce:function(e){var t=this._state.props||{};_.coverExtend(t,e),this.set("props",t)},sessionSave:function(e){this._sessionState=e,_.cookie.set("sensorsdata2015session",JSON.stringify(this._sessionState),0)},save:function(){_.cookie.set("sensorsdata2015jssdkcross",JSON.stringify(this._state),730,sd.para.cross_subdomain)},_sessionState:{},_state:{},init:function(){navigator.cookieEnabled||(error_msg.push("cookieNotEnable"),_.localStorage.isSupport||error_msg.push("localStorageNotEnable")),this.initSessionState();var e=_.cookie.get(sd.para.cross_subdomain?"sensorsdata2015jssdkcross":"sensorsdata2015jssdk");null===e?(is_first_visitor=!0,this.set("distinct_id",_.UUID())):this.toState(e),saNewUser.storeInitCheck()}},commonWays={getUtm:function(){return _.info.campaignParams()},getStayTime:function(){return(new Date-sd._t)/1e3},setInitReferrer:function(){var e=document.referrer.slice(0,sd.para.max_referrer_string_length);sd.setOnceProfile({_init_referrer:e,_init_referrer_domain:_.referringDomain(e)})},setSessionReferrer:function(){var e=document.referrer.slice(0,sd.para.max_referrer_string_length);store.setSessionPropsOnce({_session_referrer:e,_session_referrer_domain:_.referringDomain(e)})},setDefaultAttr:function(){_.info.register({_current_url:location.href,_referrer:document.referrer.slice(0,sd.para.max_referrer_string_length),_referring_domain:_.referringDomain(document.referrer)})},autoTrack:function(){var e=_.info.campaignParams(),t={};for(var r in e)-1!==(" "+source_channel_standard+" ").indexOf(" "+r+" ")?t["$"+r]=e[r]:t[r]=e[r];is_first_visitor&&sd.setOnceProfile(_.extend({$first_visit_time:new Date,$first_referrer:document.referrer.slice(0,sd.para.max_referrer_string_length),$first_browser_language:navigator.language,$first_referrer_host:_.referringDomain(document.referrer)},t)),sd.track("$pageview",_.extend({$referrer:document.referrer.slice(0,sd.para.max_referrer_string_length),$referrer_host:_.referringDomain(document.referrer),$url:location.href,$url_path:location.pathname,$title:document.title},t))}};sd.quick=function(){var e=slice.call(arguments),t=e[0],r=e.slice(1);return"string"==typeof t&&commonWays[t]?commonWays[t].apply(sd,r):void("function"==typeof t?t.apply(sd,r):logger.info("quick方法中没有这个功能"+e[0]))},sd.track=function(e,t,r){saEvent.check({event:e,properties:t})&&saEvent.send({type:"track",event:e,properties:t},r)},sd.setProfile=function(e,t){saEvent.check({propertiesMust:e})&&saEvent.send({type:"profile_set",properties:e},t)},sd.setOnceProfile=function(e,t){saEvent.check({propertiesMust:e})&&saEvent.send({type:"profile_set_once",properties:e},t)},sd.appendProfile=function(e,t){saEvent.check({propertiesMust:e})&&(_.each(e,function(t,r){_.isString(t)?e[r]=[t]:_.isArray(t)||(delete e[r],logger.info("appendProfile属性的值必须是字符串或者数组"))}),_.isEmptyObject(e)||saEvent.send({type:"profile_append",properties:e},t))},sd.incrementProfile=function(e,t){function r(e){for(var t in e)if(!/-*\d+/.test(String(e[t])))return!1;return!0}var n=e;_.isString(e)&&(e={},e[n]=1),saEvent.check({propertiesMust:e})&&(r(e)?saEvent.send({type:"profile_increment",properties:e},t):logger.info("profile_increment的值只能是数字"))},sd.deleteProfile=function(e){saEvent.send({type:"profile_delete"},e),store.set("distinct_id",_.UUID())},sd.unsetProfile=function(e,t){var r=e,n={};_.isString(e)&&(e=[],e.push(r)),_.isArray(e)?(_.each(e,function(e){_.isString(e)?n[e]=!0:logger.info("profile_unset给的数组里面的值必须时string,已经过滤掉",e)}),saEvent.send({type:"profile_unset",properties:n},t)):logger.info("profile_unset的参数是数组")},sd.identify=function(e,t){"undefined"==typeof e?store.set("distinct_id",_.UUID()):saEvent.check({distinct_id:e})?t===!0?store.set("distinct_id",e):store.change("distinct_id",e):logger.info("identify的参数必须是字符串"); +},sd.trackSignup=function(e,t,r,n){saEvent.check({distinct_id:e,event:t,properties:r})&&(saEvent.send({original_id:store.getDistinctId(),distinct_id:e,type:"track_signup",event:t,properties:r},n),store.set("distinct_id",e))},sd.trackAbtest=function(e,t){},sd.registerPage=function(e){saEvent.check({properties:e})?_.extend(_.info.currentProps,e):logger.info("register输入的参数有误")},sd.register=function(e){saEvent.check({properties:e})?store.setProps(e):logger.info("register输入的参数有误")},sd.registerOnce=function(e){saEvent.check({properties:e})?store.setPropsOnce(e):logger.info("registerOnce输入的参数有误")},sd.registerSession=function(e){saEvent.check({properties:e})?store.setSessionProps(e):logger.info("registerSession输入的参数有误")},sd.registerSessionOnce=function(e){saEvent.check({properties:e})?store.setSessionPropsOnce(e):logger.info("registerSessionOnce输入的参数有误")},sd.init=function(){app_js_bridge(),_.info.initPage(),store.init(),_.each(sd._q,function(e){sd[e[0]].apply(sd,slice.call(e[1]))})},sd.init()}(window.sensorsDataAnalytic201505); \ No newline at end of file diff --git a/src/sdk.js b/src/sdk.js index 3c346d90..493e8045 100644 --- a/src/sdk.js +++ b/src/sdk.js @@ -1531,12 +1531,53 @@ saEvent.send = function(p, callback) { }; + function app_js_bridge(){ + var app_info = null; + var todo = null; + function setAppInfo(data){ + app_info = data; + if(todo){ + todo(data); + } + } + //android + function getAndroid(){ + if(typeof window.SensorsData_APP_JS_Bridge === 'object' && window.SensorsData_APP_JS_Bridge.sensorsdata_call_app){ + app_info = SensorsData_APP_JS_Bridge.sensorsdata_call_app(); + } + } + //ios + window.sensorsdata_app_js_bridge_call_js = function(data){ + setAppInfo(data); + }; + sd.getAppStatus = function(func){ + //先获取能直接取到的安卓,ios是异步的不需要操作 + getAndroid(); + // 不传参数,直接返回数据 + if(!func){ + return app_info; + }else{ + //如果传参数,保存参数。如果有数据直接执行,没数据时保存 + if(app_info === null){ + todo = func; + }else{ + func(app_info); + } + } + }; + }; + + + sd.init = function() { + // 防止爬虫等异常情况 /* if(!_.hasStandardBrowserEnviroment()){ return false; }*/ + app_js_bridge(); + // 初始化referrer等页面属性 1.6 _.info.initPage(); diff --git a/src/sensorsdata.js b/src/sensorsdata.js index abfd78eb..fd9f0142 100755 --- a/src/sensorsdata.js +++ b/src/sensorsdata.js @@ -7,22 +7,23 @@ // 防止重复引入 sd = window[sd]; + sd._t = sd._t || 1 * new Date(); if ((typeof sd !== 'function' && typeof sd !== 'object') || sd.has_load_sdk) { return false; } sd.has_load_sdk = true; -@@include('src/json2.js') +@@include('sa-sdk-javascript/src/json2.js') @@if (sensorsdata_mode === 'vtrack') { - @@include('src/promise.min.js') + @@include('sa-sdk-javascript/src/promise.min.js') } var _ = sd._ = {}; @@if (sensorsdata_mode === 'vtrack') { - @@include('src/jquery.js') + @@include('sa-sdk-javascript/src/jquery.js') sd.$ = $; sd.customEv = $({}); @@ -71,12 +72,12 @@ } // 是否需要给可视化埋点加前缀 - @@include('src/detector.min.js') + @@include('sa-sdk-javascript/src/detector.min.js') - @@include('src/sdk.js') + @@include('sa-sdk-javascript/src/sdk.js') @@if (sensorsdata_mode === 'vtrack') { - @@include('src/vtrack.sdk.js') + @@include('sa-sdk-javascript/src/vtrack.sdk.js') } @@if (sensorsdata_mode !== 'vtrack') { diff --git a/src/vendor.js b/src/vendor.js index a52db39d..c4f55f62 100644 --- a/src/vendor.js +++ b/src/vendor.js @@ -16,17 +16,17 @@ var SAS = sdkMain.SAS; var doT = {}; -@@include('src/template.js') +@@include('sa-sdk-javascript/src/template.js') sd.template = doT.gtemplate; //json格式化 - @@include('src/jsontree.js') + @@include('sa-sdk-javascript/src/jsontree.js') sd.JSONTree = JSONTree; // suggest - @@include('src/suggest.js') + @@include('sa-sdk-javascript/src/suggest.js') var Utils = {}; Utils.Formatting = { @@ -52,7 +52,7 @@ }; -@@include('src/modal.js') +@@include('sa-sdk-javascript/src/modal.js') $.fn.gSelectBox = function() { return $(this).each(function(a, b) { diff --git a/vtrack.min.js b/vtrack.min.js index ca789cb5..7bbac400 100755 --- a/vtrack.min.js +++ b/vtrack.min.js @@ -1,5 +1,5 @@ -!function(sd){function SdkMain(){this.SAS={},this.SAS.IGNORE={tag:"sensors_ignore_tag",iself:"self",iall:"all",iclass:{"sensors-outline-highlight-frame":!0,"sensors-outline-highlight-frame-deployed":!0,"sensors-outline-highlight-frame-select":!0}},this.jsonpCallback="sensorsDataAnalytic201505callback";var e;sd.para.web_url?(e=new _.urlParse(sd.para.web_url),e._values.Path="/api"):(e=new _.urlParse(sd.para.config_url),e._values.Path="/api"),this.apiDomain=e.getUrl();var t=sd.para.config_url.split("?");2===t.length?this.deployUrl=t[0].replace(/\/$/,"")+"/Web.json?"+t[1]:1===t.length?this.deployUrl=t[0].replace(/\/$/,"")+"/Web.json":logger.info("config_url不合法"),e._values.Path="/api/vtrack/edit_mode",this.tokenUrl=e.getUrl(),e._values.Path="/api/vtrack/event",this.defineUrl=e.getUrl(),e._values.Path="/api/vtrack/binding/Web.json",this.getAllVtrackUrl=e.getUrl(),e._values.Path="/api/vtrack/events/all",this.vtrackEventsUrl=e.getUrl(),e._values.Path="/api/vtrack/triggers",this.vtrackDeleteUrl=e.getUrl(),e._values.Path="/api/vtrack/deploy/Web",this.vtrackDeployUrl=e.getUrl(),this.visualCookie="sensorsdata2015_visual_mode",this.visualCookieExistTime="1200s",this.visualSearchName="?sensorsdata_visual_mode_in",this.visualCookieNavStatusName="navStatus",this.visualStorageName="sensorsdata_vtrack_data";var n=sd.para.sdk_url.replace(/\/[^\/]+$/,""),r=sd.para.sdk_url.match(/\/[^\/]+$/,"")[0].replace(/^\/[^\.]+/,"").replace(/[^.]+$/,"");this.sdkJsUrl=sd.para.vtrack_js_file||n+"/vendor"+r+"js"+sd.para.noCache,this.sdkCssUrl=sd.para.vtrack_css_file||n+"/vendor"+r+"css"+sd.para.noCache,this.deployData=null,this.init()}if(sd=window[sd],"function"!=typeof sd&&"object"!=typeof sd||sd.has_load_sdk)return!1;sd.has_load_sdk=!0,"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,o,a,s=gap,u=t[e];switch(u&&"object"==typeof u&&"function"==typeof u.toJSON&&(u=u.toJSON(e)),"function"==typeof rep&&(u=rep.call(t,e,u)),typeof u){case"string":return quote(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(u)){for(o=u.length,n=0;o>n;n+=1)a[n]=str(n,u)||"null";return i=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+s+"]":"["+a.join(",")+"]",gap=s,i}if(rep&&"object"==typeof rep)for(o=rep.length,n=0;o>n;n+=1)"string"==typeof rep[n]&&(r=rep[n],i=str(r,u),i&&a.push(quote(r)+(gap?": ":":")+i));else for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(i=str(r,u),i&&a.push(quote(r)+(gap?": ":":")+i));return i=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+s+"}":"{"+a.join(",")+"}",gap=s,i}}var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;n>r;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,t){var n,r,i=e[t];if(i&&"object"==typeof i)for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r=walk(i,n),void 0!==r?i[n]=r:delete i[n]);return reviver.call(e,t,i)}var j;if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}(),function(e,t,n){t[e]=t[e]||n()}("Promise",window,function(){"use strict";function e(e,t){d.add(e,t),f||(f=h(d.drain))}function t(e){var t,n=typeof e;return null==e||"object"!=n&&"function"!=n||(t=e.then),"function"==typeof t?t:!1}function n(){for(var e=0;e0&&e(n,u))}catch(c){o.call(new s(u),c)}}}function o(t){var r=this;r.triggered||(r.triggered=!0,r.def&&(r=r.def),r.msg=t,r.state=2,r.chain.length>0&&e(n,r))}function a(e,t,n,r){for(var i=0;i0&&t-1 in e}function n(e,t,n){if(re.isFunction(t))return re.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return re.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(fe.test(t))return re.filter(t,e,n);t=re.filter(t,e)}return re.grep(e,function(e){return re.inArray(e,t)>=0!==n})}function r(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function i(e){var t=be[e]={};return re.each(e.match(ye)||[],function(e,n){t[n]=!0}),t}function o(){pe.addEventListener?(pe.removeEventListener("DOMContentLoaded",a,!1),e.removeEventListener("load",a,!1)):(pe.detachEvent("onreadystatechange",a),e.detachEvent("onload",a))}function a(){(pe.addEventListener||"load"===event.type||"complete"===pe.readyState)&&(o(),re.ready())}function s(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(Se,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:ke.test(n)?re.parseJSON(n):n}catch(i){}re.data(e,t,n)}else n=void 0}return n}function u(e){var t;for(t in e)if(("data"!==t||!re.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function c(e,t,n,r){if(re.acceptData(e)){var i,o,a=re.expando,s=e.nodeType,u=s?re.cache:e,c=s?e[a]:e[a]&&a;if(c&&u[c]&&(r||u[c].data)||void 0!==n||"string"!=typeof t)return c||(c=s?e[a]=X.pop()||re.guid++:a),u[c]||(u[c]=s?{}:{toJSON:re.noop}),("object"==typeof t||"function"==typeof t)&&(r?u[c]=re.extend(u[c],t):u[c].data=re.extend(u[c].data,t)),o=u[c],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[re.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[re.camelCase(t)])):i=o,i}}function l(e,t,n){if(re.acceptData(e)){var r,i,o=e.nodeType,a=o?re.cache:e,s=o?e[re.expando]:re.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){re.isArray(t)?t=t.concat(re.map(t,re.camelCase)):t in r?t=[t]:(t=re.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!u(r):!re.isEmptyObject(r))return}(n||(delete a[s].data,u(a[s])))&&(o?re.cleanData([e],!0):te.deleteExpando||a!=a.window?delete a[s]:a[s]=null)}}}function f(){return!0}function d(){return!1}function p(){try{return pe.activeElement}catch(e){}}function h(e){var t=$e.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function g(e,t){var n,r,i=0,o=typeof e.getElementsByTagName!==we?e.getElementsByTagName(t||"*"):typeof e.querySelectorAll!==we?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||re.nodeName(r,t)?o.push(r):re.merge(o,g(r,t));return void 0===t||t&&re.nodeName(e,t)?re.merge([e],o):o}function m(e){je.test(e.type)&&(e.defaultChecked=e.checked)}function v(e,t){return re.nodeName(e,"table")&&re.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function y(e){return e.type=(null!==re.find.attr(e,"type"))+"/"+e.type,e}function b(e){var t=Je.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function _(e,t){for(var n,r=0;null!=(n=e[r]);r++)re._data(n,"globalEval",!t||re._data(t[r],"globalEval"))}function x(e,t){if(1===t.nodeType&&re.hasData(e)){var n,r,i,o=re._data(e),a=re._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)re.event.add(t,n,s[n][r])}a.data&&(a.data=re.extend({},a.data))}}function w(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!te.noCloneEvent&&t[re.expando]){i=re._data(t);for(r in i.events)re.removeEvent(t,r,i.handle);t.removeAttribute(re.expando)}"script"===n&&t.text!==e.text?(y(t).text=e.text,b(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),te.html5Clone&&e.innerHTML&&!re.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&je.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function k(t,n){var r,i=re(n.createElement(t)).appendTo(n.body),o=e.getDefaultComputedStyle&&(r=e.getDefaultComputedStyle(i[0]))?r.display:re.css(i[0],"display");return i.detach(),o}function S(e){var t=pe,n=Qe[e];return n||(n=k(e,t),"none"!==n&&n||(Ke=(Ke||re("