inke.js
4.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
!function (n, e) {
"function" == typeof define && define.amd ? define([""], e) : "object" == typeof exports ? module.exports = e(n) : n.InkeSdk = e(n)
}(window, function () {
function n(n) {
console.log(n)
}
function e(n, e) {
return new Promise(function (e, o) {
var t = document.getElementsByTagName("head")[0], i = document.createElement("script");
i.type = "text/javascript", i.onreadystatechange = function () {
"complete" == this.readyState && e(!0)
}, i.onload = function () {
console.log("load url success"), e(!0)
}, i.onerror = function () {
console.log("load url script fail"), o(!1)
}, i.src = n.indexOf("http") >= 0 ? n : location.protocol + n, t.appendChild(i)
})
}
function o(n, e) {
if ("object" == typeof n && "object" == typeof e) {
for (var o in e)n[o] = e[o];
return n
}
}
var t = function () {
var n = {}, e = location.href.split("#")[0].split("?")[1];
if (!e)return null;
for (var o = e.split("&"), t = 0, i = o.length; t < i; t++) {
var r = o[t].split("="), a = r[0], c = r[1] || "";
a && (n[a] = decodeURIComponent(c))
}
return n
}(), i = function (n) {
var e = "other", o = navigator.userAgent, i = "other";
/micromessenger/gi.test(o) ? e = "weixin" : /mqq/gi.test(o) ? e = "mqq" : /weibo/gi.test(o) && (e = "weibo"), /iphone|ipad|ipod/gi.test(o) ? i = "ios" : /android/gi.test(o) && (i = "android");
var r = t || {}, a = {
cc: r.origin || r.cc || "TG6001",
source: e,
os: i,
userid: "0",
type: "other",
busi: "apph5",
page: "",
url: JSON.stringify(window.location.href),
info: {}
};
return a
}(), r = [], a = {
isInke: function () {
return t.uid && t.sid
}, appShare: function (e) {
if (e) {
var o = navigator.userAgent, t = {action: "shareUrl", data: e};
/iPhone|mac|iPod|iPad/i.test(o) && window.webkit && webkit.messageHandlers ? window.webkit.messageHandlers.sendInkeNativeInfo.postMessage(JSON.stringify(t)) : /android/i.test(o) && window.InKeJs ? window.InKeJs.sendInkeNativeInfo(JSON.stringify(t)) : n("shareUrl_is_fail")
}
}, topRightBtn: function () {
}, report: function (n, e, t) {
var r = this, a = i, c = {isCnzz: !1, isSync: !0};
if ("object" != typeof n)return void console.log("param is error");
"function" == typeof e && (t = e), a.time = (new Date).getTime(), a.page = "index", "object" == typeof e && (c = o(c, e)), a = o(a, n);
var s = [];
for (var f in a)s.push(f + "=" + encodeURIComponent("object" == typeof a[f] ? JSON.stringify(a[f]) : a[f]));
var d = location.protocol + "//baseapi.busi.inke.cn/b.gif?" + s.join("&");
return new Promise(function (n, e) {
var o = new Image;
o.src = d, c.isSync ? ("function" == typeof t && t(), n()) : o.onabort = o.onload = o.onerror = function () {
"function" == typeof t && t(), n()
}, c.isCnzz && r.cnzzLog({category: a.busi + "_" + a.cc, action: a.page || "", label: a.eid || ""})
})
}, cnzzLog: function (n) {
if (n && n.category && n.action && n.label) {
var o = n.category, t = "";
window._czc ? window._czc.push(["_trackEvent", o, n.action, n.label, n.value, t]) : (r.length || e("//s95.cnzz.com/z_stat.php?id=1254338501&web_id=1254338501").then(function () {
for (var n = 0; n < r.length; n++)window._czc.push(r[n])
})["catch"](function (n) {
r = [], window.console && window.console.log("load cnzz fail")
}), r.push(["_trackEvent", o, n.action, n.label, n.value, t]))
}
}
};
return window.InkeSdk = a, a
});
//# sourceMappingURL=inkeSdk.min.js.map