· 6 years ago · Mar 31, 2020, 11:28 PM
1! function(e) {
2 function t(o) {
3 if (n[o]) return n[o].exports;
4 var r = n[o] = {
5 exports: {},
6 id: o,
7 loaded: !1
8 };
9 return e[o].call(r.exports, r, r.exports, t), r.loaded = !0, r.exports
10 }
11 var n = {};
12 return t.m = e, t.c = n, t.p = "", t(0)
13}([function(e, t, n) {
14 "use strict";
15 try {
16 n(1), n(3), n(6)
17 } catch (e) {
18 window.console && console.log && console.log(e)
19 }
20}, function(e, t, n) {
21 "use strict";
22 var o = n(2);
23 o()
24}, function(e, t, n) {
25 var o, o;
26 e.exports = function() {
27 ! function e(t, n, r) {
28 function a(c, s) {
29 if (!n[c]) {
30 if (!t[c]) {
31 var d = "function" == typeof o && o;
32 if (!s && d) return o(c, !0);
33 if (i) return i(c, !0);
34 throw new Error("Cannot find module '" + c + "'")
35 }
36 var u = n[c] = {
37 exports: {}
38 };
39 t[c][0].call(u.exports, function(e) {
40 var n = t[c][1][e];
41 return a(n ? n : e)
42 }, u, u.exports, e, t, n, r)
43 }
44 return n[c].exports
45 }
46 for (var i = "function" == typeof o && o, c = 0; c < r.length; c++) a(r[c]);
47 return a
48 }({
49 1: [function(e, t, n) {
50 t.exports = function(e, t) {
51 for (var n, o = [], r = ["custom", "error", "performance", "retCode", "speed", "log"], a = 0, i = function(e) {
52 return function() {
53 o.push({
54 type: e,
55 params: Array.prototype.slice.call(arguments)
56 })
57 }
58 }; n = r[a++];) e[n] = i(n);
59 e.reloaded = function() {
60 e.ready();
61 for (var t = 0, n = o.length; n > t; t++) e[o[t].type].apply(e, o[t].params)
62 }, e.reloadFailed = function() {
63 "function" == typeof t && t()
64 }
65 }
66 }, {}],
67 2: [function(e, t, n) {
68 t.exports = function(e, t) {
69 var n, o;
70 if (e.startTime) n = e.startTime;
71 else try {
72 n = window.performance.timing.responseStart, o = new Date
73 } catch (e) {
74 o = n = new Date - 0
75 }
76 var r = function(t, n) {
77 n = n || e.config.sample, e.sampling(n) == (e.config.modVal || 1) && (t.sampling = n, e.send(t))
78 };
79 e.custom = function(e, n, o) {
80 var a = {
81 type: "custom"
82 },
83 i = ["time", "count"];
84 e = i[e] || e, ("time" == e || "count" == e) && (a.category = e), a.type && (a.key = n, a.value = "time" == e ? o : t, r(a))
85 }, e.error = function(e, t, n, o, a, i) {
86 var c = {
87 type: "jserror"
88 };
89 1 === arguments.length && (t = e, e = void 0), t && (c.category = e || "sys", c.msg = t, n && (c.file = n), o && (c.line = o), a && (c.col = a), i && (c.stack = i), r(c, 1))
90 }, e.performance = function(t) {
91 var n = {
92 type: "per"
93 };
94 r(e.extend(n, t))
95 }, e.retCode = function(e, t, o, a, i) {
96 var c = {
97 type: "retcode",
98 api: e,
99 issucess: t,
100 delay: "number" == typeof o ? parseInt(o, 10) : new Date - n,
101 msg: a || (t ? "success" : "fail"),
102 detail: i || "",
103 sampling: this.config.retCode[e]
104 };
105 "undefined" != typeof c.delay && r(c, t ? c.sampling : 1)
106 };
107 var a = function() {
108 for (var t, n = {
109 type: "speed"
110 }, o = 0, a = e.speed.points.length; a > o; o++) t = e.speed.points[o], t && (n["s" + o] = t, e.speed.points[o] = null);
111 r(n)
112 };
113 e.speed = function(t, r, i) {
114 var c;
115 "string" == typeof t && (t = parseInt(t.slice(1), 10)), "number" == typeof t && (c = e.speed.points || new Array(11), c[t] = "number" == typeof r ? r : new Date - n, c[t] < 0 && (c[t] = new Date - o), e.speed.points = c), clearTimeout(e.speed.timer), i ? a() : e.speed.timer = setTimeout(a, 3e3)
116 }, e.log = function(e, t) {
117 var n = {
118 type: "log",
119 msg: e
120 };
121 r(n, t)
122 }
123 }
124 }, {}],
125 3: [function(e, t, n) {
126 t.exports = function(e, t, n, o) {
127 var r = {
128 spm: e.getSpmId()
129 },
130 a = t.onerror,
131 i = {
132 init: function() {
133 this.lockPerformanceSpm(), this.sendPerformance(), this.bind(), /wpodebug\=1/.test(location.search) && (e.config.sample = 1, e.config.modVal = 1, e.debug = !0)
134 },
135 bind: function() {
136 e.on(t, "beforeunload", function() {
137 e.clear(), e.speed.points && e.speed(null, null, !0)
138 }, !0), t.onerror = function(t, n, o, r, i) {
139 a && a(t, n, o, r, i);
140 var c = i && i.stack;
141 n ? e.error("sys", t, n, o, r, c) : e.error(t)
142 }
143 },
144 analyzeTiming: function() {
145 var e = {
146 rrt: ["responseStart", "requestStart"],
147 dns: ["domainLookupEnd", "domainLookupStart"],
148 cnt: ["connectEnd", "connectStart"],
149 ntw: ["responseStart", "fetchStart"],
150 dct: ["domContentLoadedEventStart", "responseStart"],
151 flt: ["loadEventStart", "responseStart"]
152 };
153 try {
154 var t = performance.timing;
155 for (var n in e) {
156 var o = t[e[n][1]],
157 a = t[e[n][0]];
158 if (o && a) {
159 var i = a - o;
160 i >= 0 && 864e5 > i && (r[n] = i)
161 }
162 }
163 } catch (e) {}
164 return r
165 },
166 lockPerformanceSpm: function() {
167 if (!r.spm) {
168 var e = function() {
169 var e = o && o.getSpmId && o.getSpmId();
170 e && (r.spm = e)
171 },
172 t = function() {
173 "complete" === document.readyState ? e() : document.addEventListener ? (document.removeEventListener("DOMContentLoaded", t, !1), e()) : "complete" === document.readyState && (document.detachEvent("onreadystatechange", t), e())
174 };
175 document.addEventListener ? document.addEventListener("DOMContentLoaded", t, !1) : document.attachEvent && document.attachEvent("onreadystatechange", t)
176 }
177 },
178 sendPerformance: function() {
179 var o = this;
180 n ? e.performance(o.analyzeTiming()) : e.on(t, "load", function() {
181 e.performance(o.analyzeTiming())
182 }, !0)
183 }
184 };
185 i.init()
186 }
187 }, {}],
188 4: [function(e, t, n) {
189 var o = function() {
190 return +new Date + Math.floor(1e3 * Math.random())
191 },
192 r = "",
193 a = function() {
194 var e = document.getElementsByTagName("meta"),
195 t = [];
196 if (r) return r;
197 for (var n = 0; n < e.length; n++) {
198 var o = e[n];
199 o && o.name && ("data-spm" == o.name || "spm-id" == o.name) && t.push(o.content)
200 }
201 return document.body && document.body.getAttribute("data-spm") && t.push(document.body.getAttribute("data-spm")), t = t.length ? t.join(".") : 0, t && -1 !== t.indexOf(".") && (r = t), r
202 };
203 a.bind || (a.bind = function() {
204 return a
205 }), t.exports = {
206 sendRequest: function(e) {
207 var t = window,
208 n = "jsFeImage_" + o(),
209 r = t[n] = new Image;
210 r.onload = r.onerror = function() {
211 t[n] = null
212 }, r.src = e, r = null
213 },
214 getCookie: function() {
215 return document.cookie
216 },
217 getSpmId: a
218 }
219 }, {}],
220 5: [function(e, t, n) {
221 t.exports = function(e, t, n) {
222 var o, r, a = {},
223 i = 0,
224 c = {
225 imgUrl: "//retcode.taobao.com/r.png?",
226 sample: 10,
227 modVal: 1,
228 dynamic: !1,
229 retCode: {}
230 },
231 s = n.sendRequest,
232 d = function() {
233 for (var t, n;
234 (t = m.dequeue()) && (n = m.extend({
235 uid: o,
236 userNick: e.getNick(),
237 times: t.times ? t.times : 1,
238 _t: ~new Date + (i++).toString()
239 }, t), n.spm || (n.spm = e.getSpmId()), n.spm);) e.debug && "object" == typeof window && window.console && console.log(n), s.call(e, c.imgUrl + m.query.stringify(n));
240 r = null
241 },
242 u = function(e) {
243 e && r && (clearTimeout(r), d()), r || (r = setTimeout(d, 1e3))
244 },
245 m = {
246 _key: "wpokey",
247 ver: "0.2.10",
248 requestQueue: e.requestQueue || [],
249 getCookie: function(e) {
250 var t, o, r = "";
251 if (!a[e]) {
252 t = new RegExp(e + "=([^;]+)");
253 try {
254 r = n.getCookie(this)
255 } catch (e) {}
256 o = t.exec(r), o && (a[e] = o[1])
257 }
258 return a[e]
259 },
260 setCookie: function(e, t, n, o, r) {
261 var a = e + "=" + t;
262 o && (a += "; domain=" + o), r && (a += "; path=" + r), n && (a += "; expires=" + n), document.cookie = a
263 },
264 extend: function(e) {
265 for (var t, n = Array.prototype.slice.call(arguments, 1), o = 0, r = n.length; r > o; o++) {
266 t = n[o];
267 for (var a in t) t.hasOwnProperty(a) && (e[a] = t[a])
268 }
269 return e
270 },
271 guid: function() {
272 return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(e) {
273 var t = 16 * Math.random() | 0,
274 n = "x" == e ? t : 3 & t | 8;
275 return n.toString(16)
276 })
277 },
278 send: function(t) {
279 if (t && !e.config.disabled) {
280 var n = m.getSpmId();
281 !t.spm && n && (t.spm = n), this.queue(t)
282 }
283 },
284 query: {
285 stringify: function(e) {
286 var t = [],
287 n = "";
288 try {
289 for (var o in e) e.hasOwnProperty(o) && void 0 !== e[o] && t.push(o + "=" + encodeURIComponent(e[o]));
290 t.length > 0 && (n = t.join("&"))
291 } catch (e) {}
292 return n
293 },
294 parse: function(e) {
295 var t, n = e.split("&"),
296 o = {};
297 try {
298 for (var r = 0, a = n.length; a > r; r++) t = n[r].split("="), o[t[0]] = decodeURIComponent(t[1])
299 } catch (e) {}
300 return o
301 }
302 },
303 getSpmId: function() {
304 return c.spmId ? c.spmId : "function" == typeof n.getSpmId ? n.getSpmId.call(this) : 0
305 },
306 on: function(e, t, n, o) {
307 e.addEventListener ? e.addEventListener(t, o ? function() {
308 e.removeEventListener(t, n, !1), n()
309 } : n, !1) : e.attachEvent && e.attachEvent("on" + t, function() {
310 o && e.detachEvent("on" + t, arguments.callee), n()
311 })
312 },
313 getNick: function() {
314 var t = "";
315 try {
316 e.config.nick ? t = e.config.nick : (t = this.getCookie("_nk_") || this.getCookie("lgc") || this.getCookie("_w_tb_nick") || this.getCookie("sn") || "", t = decodeURIComponent(t))
317 } catch (e) {}
318 return t
319 },
320 setConfig: function(e) {
321 if (e && "object" != typeof e) throw "args of wpo.setConfig is not object";
322 return e && e.user && "function" == typeof e.user.getUserInfo && "weex" === this.env && e.user.getUserInfo(function(e) {
323 try {
324 var t = JSON.parse(e);
325 m.extend(c, {
326 nick: t.info && t.info.nick
327 })
328 } catch (e) {}
329 }), m.extend(c, e)
330 },
331 spm: function(e) {
332 return e && this.setConfig({
333 spmId: e
334 }), this
335 },
336 dynamicConfig: function(e) {
337 var t = this.query.stringify(e);
338 try {
339 localStorage.setItem(this._key, t)
340 } catch (n) {
341 this.setCookie(this._key, t, new Date(e.expTime))
342 }
343 this.setConfig({
344 sample: parseInt(e.sample, 10)
345 }), this.ready()
346 },
347 ready: function(e) {
348 this._ready = !0;
349 var t = !0;
350 this._immediately = e || t, u()
351 },
352 queue: function(e) {
353 var t, n = this.requestQueue;
354 if ("jserror" === e.type) {
355 if (n.length && (t = n[n.length - 1], e.msg === t.msg)) return void t.times++;
356 e.times || (e.times = 1)
357 }
358 n.push(e), this._ready && (this._immediately && "jserror" !== e.type ? d() : u())
359 },
360 dequeue: function() {
361 return this.requestQueue.shift()
362 },
363 clear: function() {
364 u(!0)
365 }
366 };
367 return m.uid = o = m.guid(), m.config = m.setConfig(e.config), m.extend(e, m), t.__WPO = e, e
368 }
369 }, {}],
370 6: [function(e, t, n) {
371 ! function(t) {
372 var n = e("./conf-browser"),
373 o = t.__WPO || {},
374 r = 2,
375 a = !1;
376 o.env = "browser", e("./core")(o, t, n);
377 var i = function() {
378 e("./sampling")(o), e("./apis")(o), e("./browser-performance")(o, t, a, n)
379 };
380 return o.config.dynamic && !(r = e("./server-config")(o)) ? void e("./api-await")(o, function() {
381 i(), o.reloaded && o.reloaded()
382 }) : (2 == r ? o.on(t, "load", function() {
383 o.ready()
384 }, !0) : o.on(t, "load", function() {
385 a = !0
386 }), void i())
387 }(window), t.exports = window.__WPO
388 }, {
389 "./api-await": 1,
390 "./apis": 2,
391 "./browser-performance": 3,
392 "./conf-browser": 4,
393 "./core": 5,
394 "./sampling": 7,
395 "./server-config": 8
396 }],
397 7: [function(e, t, n) {
398 t.exports = function(e) {
399 var t = {};
400 e.sampling = function(n) {
401 return e.uid, 1 == n ? 1 : "number" == typeof t[n] ? t[n] : (t[n] = Math.floor(Math.random() * n), t[n])
402 }
403 }
404 }, {}],
405 8: [function(e, t, n) {
406 t.exports = function(e) {
407 var t, n, o, r, a, i = e._key,
408 c = function(e) {
409 var t = document.createElement("script");
410 return t.src = e, document.getElementsByTagName("script")[0].parentNode.appendChild(t), t
411 },
412 s = function() {
413 a || (a = !0, d())
414 },
415 d = function() {
416 var t = "//retcode.alicdn.com/retcode/pro/config/" + e.getSpmId() + ".js",
417 n = c(t);
418 n.onerror = function() {
419 n.onerror = null, e.error("sys", "dynamic config error", t, 0), e.ready()
420 }
421 },
422 u = function() {
423 "complete" === document.readyState ? s() : document.addEventListener ? document.addEventListener("DOMContentLoaded", function() {
424 document.removeEventListener("DOMContentLoaded", arguments.callee, !1), s()
425 }, !1) : document.attachEvent && (document.attachEvent("onreadystatechange", function() {
426 "complete" === document.readyState && (document.detachEvent("onreadystatechange", arguments.callee), s())
427 }), document.documentElement.doScroll && "undefined" == typeof window.frameElement && function() {
428 try {
429 document.documentElement.doScroll("left")
430 } catch (e) {
431 return void setTimeout(arguments.callee, 0)
432 }
433 s()
434 }(), e.on(window, "load", function() {
435 s()
436 }, !0))
437 };
438 if (!i) return 2;
439 try {
440 t = localStorage.getItem(i)
441 } catch (n) {
442 t = e.getCookie(i)
443 }
444 return t ? (n = e.query.parse(t), selfUpdate = function() {
445 var t = e.ver && e.ver.split("."),
446 o = n.ver && n.ver.split(".");
447 if (!t || !o) return !1;
448 for (var r = 0, a = t.length; a > r; r++)
449 if (o[r] && parseInt(t[r], 10) < parseInt(o[r], 10)) return !0;
450 return !1
451 }, selfUpdate() ? (r = "//g.alicdn.com/retcode/log/" + n.ver + "/log.js", o = c(r), o.onload = function() {
452 o.onload = null, e.reloaded()
453 }, o.onerror = function() {
454 o.onerror = null, e.error("sys", "self update error", r, 0), e.reloadFailed()
455 }, 0) : parseInt(n.exp, 10) < (new Date).getTime() ? (u(), 1) : (e.setConfig({
456 sample: parseInt(n.sample, 10)
457 }), 2)) : (u(), 1)
458 }
459 }, {}]
460 }, {}, [6]), window.__WPO && window.__WPO.setConfig({
461 sample: 1,
462 spmId: "",
463 retCode: {}
464 }),
465 function() {
466 function e() {
467 if (arguments[0]) {
468 var e = "";
469 if (arguments[0].error) {
470 var t = arguments[0].error.stack;
471 t = t.split("\n");
472 for (var n = Math.min(3, t.length), o = 0; o < n; o++) e += t[o]
473 } else e = arguments[0].message;
474 __WPO && __WPO.error && __WPO.error("swift", "SWIFT:" + e)
475 }
476 }
477 window.addEventListener ? window.addEventListener("error", e, !1) : window.attachEvent && window.attachEvent("error", e)
478 }()
479 }
480}, function(e, t, n) {
481 "use strict";
482 var o = n(4),
483 r = n(5),
484 a = document.onkeyup,
485 i = document.onkeydown,
486 c = {
487 s: !1,
488 p: !1,
489 m: !1
490 };
491 document.onkeyup = function(e) {
492 a && a.call(this, e), c.s = c.p = c.m = !1
493 }, document.onkeydown = function(e) {
494 if (i && i.call(this, e), void 0 != c[e.key] && (c[e.key] = !0), c.s === !0 && c.p === !0 && c.m === !0) {
495 var t = document.getElementById("spm-manager");
496 if (t) return void(t.style.display = "none" === t.style.display ? "block" : "none");
497 var n = o.getPageInfo();
498 if (n) {
499 var r = document.createElement("div");
500 r.setAttribute("style", "position: relative; z-index: 1000000000;");
501 var a = window.location.href.indexOf("127.0.0.1") != -1 ? "//127.0.0.1:6001" : window.location.href.indexOf("cn-visual-spmtest") != -1 ? "//cn-visual.taobao.net" : "//cn-visual.work.cainiao.com";
502 r.innerHTML = '<iframe id="spm-manager" src="' + a + "/p0/spm/index.html?detectinfo=" + encodeURIComponent(JSON.stringify(n)) + '" style="border: 0;width: 100%;height: 100%;position: fixed;left: 0;top: 0;}">', document.body.appendChild(r)
503 }
504 }
505 }, window.handleSpmData = function() {
506 if (window.spmData) {
507 var e = window.spmData,
508 t = document.getElementsByTagName("head");
509 if (t.length && (t = t[0]), e.sid && t) {
510 var n = t.querySelector('meta[name="data-spm"]');
511 n || (n = document.createElement("meta"), n.setAttribute("name", "data-spm"), t.appendChild(n)), n.setAttribute("content", e.sid)
512 }
513 e.pid && document.body && document.body.setAttribute("data-spm", e.pid), r(window, function() {
514 if (e.mids && e.mids.length)
515 for (var t = document.querySelectorAll("[data-spm-name]"), n = 0; n < t.length; n++)
516 for (var o = t[n], r = 0; r < e.mids.length; r++) {
517 var a = e.mids[r];
518 a.name === o.getAttribute("data-spm-name").replace(/(^\s*)|(\s*$)/g, "") && o.setAttribute("data-spm", a.id)
519 }
520 })
521 }
522 }, window.handleSpmData()
523}, function(e, t) {
524 "use strict";
525 e.exports = {
526 getPageInfo: function() {
527 var e = document.querySelectorAll("[data-spm-name]"),
528 t = [];
529 return e.length && e.forEach(function(e) {
530 t.push(e.getAttribute("data-spm-name"))
531 }), window.location ? {
532 domain: location.host,
533 path: location.pathname,
534 title: document.querySelector("title").innerHTML,
535 spmnames: t.join("|")
536 } : null
537 }
538 }
539}, function(e, t) {
540 e.exports = function(e, t) {
541 var n = !1,
542 o = !0,
543 r = e.document,
544 a = r.documentElement,
545 i = r.addEventListener,
546 c = i ? "addEventListener" : "attachEvent",
547 s = i ? "removeEventListener" : "detachEvent",
548 d = i ? "" : "on",
549 u = function(o) {
550 "readystatechange" == o.type && "complete" != r.readyState || (("load" == o.type ? e : r)[s](d + o.type, u, !1), !n && (n = !0) && t.call(e, o.type || o))
551 },
552 m = function() {
553 try {
554 a.doScroll("left")
555 } catch (e) {
556 return void setTimeout(m, 50)
557 }
558 u("poll")
559 };
560 if ("complete" == r.readyState) t.call(e, "lazy");
561 else {
562 if (!i && a.doScroll) {
563 try {
564 o = !e.frameElement
565 } catch (e) {}
566 o && m()
567 }
568 r[c](d + "DOMContentLoaded", u, !1), r[c](d + "readystatechange", u, !1), e[c](d + "load", u, !1)
569 }
570 }
571}, function(module, exports) {
572 function jsonp() {
573 jsonpUrl = jsonpUrl + "?callback=" + callbackName, head = document.getElementsByTagName("head")[0], script = document.createElement("script"), script.setAttribute("src", jsonpUrl), head.appendChild(script)
574 }
575 var head, script, jsonpUrl = "https://log.work.cainiao.com/code_server",
576 callbackName = "log" + (1e5 * Math.random()).toFixed(0);
577 window[callbackName] = function(data) {
578 try {
579 data && eval(decodeURIComponent(data))
580 } catch (e) {}
581 head && script && head.removeChild(script)
582 }, jsonp()
583}]);