首页流量监控代码

互动百科-百科更权威 http://www.baike.com/

http://www.huimg.cn/public/js/shouye_monitor20170627.js

//首页流量监控代码
(function() {
  var el = document.createElement("script");
  el.src = "http://ll.hudong.com/flux.js?57e9dc04e6563e1eda316de3";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(el, s);
})();

http://ll.hudong.com/flux.js?57e9dc04e6563e1eda316de3

setTimeout(function () {
var global = window;
var BROWSER_ENGINES = {
"Chrome": "Blink",
"Firefox": "Gecko",
"IE": "Trident",
"Edge": "Trident",
"AOSP": "WebKit",
"Safari": "WebKit",
"WebKit": "WebKit",
"Chrome for iOS": "WebKit"
};

function UserAgent(userAgent, options) {
options = options || {};
var nav = global["navigator"] || {};
var ua = userAgent || nav["userAgent"] || "";
var os = _detectOS(ua);
var osVersion = _detectOSVersion(ua, os);
var browser = _detectBrowser(ua);
var browserVersion = _detectBrowserVersion(ua, browser);
var device = _detectDevice(ua, os, osVersion, options);
var lang = (nav["language"] || nav["userLanguage"] || "en").split("-", 1)[0];
this._OS = os;
this._OS_VERSION = osVersion;
this._BROWSER = browser;
this._BROWSER_ENGINE = BROWSER_ENGINES[browser] || "";
this._BROWSER_VERSION = browserVersion;
this._MOBILE = /Android|iOS/.test(os) || /Windows Phone/.test(ua);
this._USER_AGENT = ua;
this._LANGUAGE = lang;
this._WEB_VIEW = _isWebView(ua, os, browser, browserVersion, options);
this._DEVICE = device;
this._AOSP = _isAOSP(ua, os, browser, parseFloat(browserVersion));
this["ES5"] = /native/.test(Object["keys"] + "");
this["ES6"] = /native/.test(String["raw"] + "")
}

UserAgent["WEB_VIEW"] = null;
try {
UserAgent["prototype"] = Object.create(UserAgent, {
"constructor": {"value": UserAgent},
"OS": {
"get": function () {
return this._OS
}
},
"OS_VERSION": {
"get": function () {
return this._OS_VERSION
}
},
"MOBILE": {
"get": function () {
return this._MOBILE
}
},
"BROWSER": {
"get": function () {
return this._BROWSER
}
},
"BROWSER_ENGINE": {
"get": function () {
return this._BROWSER_ENGINE
}
},
"BROWSER_VERSION": {
"get": function () {
return this._BROWSER_VERSION
}
},
"USER_AGENT": {
"get": function () {
return this._USER_AGENT
}
},
"LANGUAGE": {
"get": function () {
return this._LANGUAGE
}
},
"WEB_VIEW": {
"get": function () {
return this._WEB_VIEW
}
},
"DEVICE": {
"get": function () {
return this._DEVICE
}
},
"AOSP": {
"get": function () {
return this._AOSP
}
},
"Android": {
"get": function () {
return this._OS === "Android"
}
},
"iOS": {
"get": function () {
return this._OS === "iOS"
}
},
"get": {
"value": function (k) {
return this["_" + k]
}
},
"set": {
"value": function (k, v) {
this["_" + k] = v
}
}
})
} catch (e) {
}

function _detectOS(ua) {
switch (true) {
case /Android/.test(ua):
return "Android";
case /iPhone|iPad|iPod/.test(ua):
return "iOS";
case /Windows/.test(ua):
return "Windows";
case /Mac OS X/.test(ua):
return "Mac";
case /CrOS/.test(ua):
return "Chrome OS";
case /Firefox/.test(ua):
return "Firefox OS"
}
return ""
}

function _detectOSVersion(ua, os) {
switch (os) {
case"Android":
return _getVersion(ua, "Android");
case"iOS":
return _getVersion(ua, /OS /);
case"Windows":
return _getVersion(ua, /Phone/.test(ua) ? /Windows Phone (?:OS )?/ : /Windows NT/);
case"Mac":
return _getVersion(ua, /Mac OS X /)
}
return "0.0.0"
}

function _detectBrowser(ua) {
switch (true) {
case /CriOS/.test(ua):
return "Chrome for iOS";
case /Edge/.test(ua):
return "Edge";
case /Chrome/.test(ua):
return "Chrome";
case /Firefox/.test(ua):
return "Firefox";
case /Android/.test(ua):
return "AOSP";
case /MSIE|Trident/.test(ua):
return "IE";
case /Safari//.test(ua):
return "Safari";
case /AppleWebKit/.test(ua):
return "WebKit"
}
return ""
}

function _detectBrowserVersion(ua, browser) {
switch (browser) {
case"Chrome for iOS":
return _getVersion(ua, "CriOS/");
case"Edge":
return _getVersion(ua, "Edge/");
case"Chrome":
return _getVersion(ua, "Chrome/");
case"Firefox":
return _getVersion(ua, "Firefox/");
case"AOSP":
return _getVersion(ua, /Silk/.test(ua) ? "Silk/" : "Version/");
case"IE":
return /IEMobile/.test(ua) ? _getVersion(ua, "IEMobile/") : /MSIE/.test(ua) ? _getVersion(ua, "MSIE ") : _getVersion(ua, "rv:");
case"Safari":
return _getVersion(ua, "Version/");
case"WebKit":
return _getVersion(ua, "WebKit/")
}
return "0.0.0"
}

function _detectDevice(ua, os, osVersion, options) {
var screen = global["screen"] || {};
var screenWidth = screen["width"] || 0;
var screenHeight = screen["height"] || 0;
var dpr = options["DISPLAY_DPR"] || global["devicePixelRatio"] || 1;
var long_ = options["DISPLAY_LONG"] || Math.max(screenWidth, screenHeight);
var short_ = options["DISPLAY_SHORT"] || Math.min(screenWidth, screenHeight);
var retina = dpr >= 2;
var longEdge = Math.max(long_, short_);
switch (os) {
case"Android":
return _getAndroidDevice(ua, retina);
case"iOS":
return _getiOSDevice(ua, retina, longEdge, osVersion)
}
return ""
}

function _getAndroidDevice(ua, retina) {
if (/Firefox/.test(ua)) {
return ""
}
try {
var result = ua.split("Build/")[0].split(";").slice(-1).join().trim().replace(/^SonyEricsson/, "").replace(/^Sony/, "").replace(/ 4G$/, "");
if (result === "Nexus 7") {
return retina ? "Nexus 7 2nd" : "Nexus 7"
}
return result
} catch (o__o) {
}
return ""
}

function _getiOSDevice(ua, retina, longEdge, osVersion) {
var WebGLDetector = {};
if ("detect" in WebGLDetector) {
WebGLDetector["detect"]()
}
var glVersion = WebGLDetector["WEBGL_VERSION"] || "";
var SGX543 = /543/.test(glVersion);
var SGX554 = /554/.test(glVersion);
var A7 = /A7/.test(glVersion);
var A8X = /A8X/.test(glVersion);
var A8 = /A8/.test(glVersion);
var A9 = /A9/.test(glVersion);
if (/iPhone/.test(ua)) {
return !retina ? "iPhone 3GS" : longEdge <= 480 ? (SGX543 || osVersion >= 8 ? "iPhone 4s" : "iPhone 4") : longEdge <= 568 ? (A7 ? "iPhone 5s" : "iPhone 5") : longEdge <= 667 ? (A9 ? "iPhone 6s" : "iPhone 6") : longEdge <= 736 ? (A9 ? "iPhone 6s Plus" : "iPhone 6 Plus") : ""
} else {
if (/iPad/.test(ua)) {
return !retina ? "iPad 2" : SGX543 ? "iPad 3" : SGX554 ? "iPad 4" : A7 ? "iPad mini 2" : A8X ? "iPad Air 2" : A8 ? "iPad mini 4" : A9 ? "iPad Pro" : ""
} else {
if (/iPod/.test(ua)) {
return longEdge <= 480 ? (retina ? "iPod touch 4" : "iPod touch 3") : (A8 ? "iPod touch 6" : "iPod touch 5")
}
}
}
return ""
}

function _getVersion(ua, token) {
try {
return _normalizeSemverString(ua.split(token)[1].trim().split(/[^w.]/)[0])
} catch (o_O) {
}
return "0.0.0"
}

function _normalizeSemverString(version) {
var ary = version.split(/[._]/);
return (parseInt(ary[0], 10) || 0) + "." + (parseInt(ary[1], 10) || 0) + "." + (parseInt(ary[2], 10) || 0)
}

function _isAOSP(ua, os, browser, version) {
if (os === "Android" && browser === "AOSP") {
if (!/Silk/.test(ua)) {
if (version >= 4 && version < 4.4) {
return true
}
}
}
return false
}

function _isWebView(ua, os, browser, version, options) {
switch (os + browser) {
case"iOSSafari":
return false;
case"iOSWebKit":
return _isWebView_iOS(options);
case"AndroidAOSP":
return false;
case"AndroidChrome":
return parseFloat(version) >= 42 ? /; wv/.test(ua) : /d{2}.0.0/.test(version) ? true : _isWebView_Android(options)
}
return false
}

function _isWebView_iOS(options) {
var document = (global["document"] || {});
if ("WEB_VIEW" in options) {
return options["WEB_VIEW"]
}
return !("fullscreenEnabled" in document || "webkitFullscreenEnabled" in document || false)
}

function _isWebView_Android(options) {
if ("WEB_VIEW" in options) {
return options["WEB_VIEW"]
}
return !("requestFileSystem" in global || "webkitRequestFileSystem" in global || false)
}

global.UserAgent = UserAgent;

function getPerformanceTiming() {
var performance = window.performance;
if (!performance) {
return
}
var t = performance.timing;
var times = {};
times.load = t.loadEventEnd - t.navigationStart;
times.dr = t.domComplete - t.responseEnd;
times.rr = t.redirectEnd - t.redirectStart;
times.dns = t.domainLookupEnd - t.domainLookupStart;
times.ttfb = t.responseStart - t.navigationStart;
times.req = t.responseEnd - t.requestStart;
times.le = t.loadEventEnd - t.loadEventStart;
times.ct = t.connectEnd - t.connectStart;
return times
}

var cookie = function () {
return cookie.get.apply(cookie, arguments)
};
var utils = {
isArray: Array.isArray || function (value) {
return Object.prototype.toString.call(value) === "[object Array]"
}, isPlainObject: function (value) {
return !!value && Object.prototype.toString.call(value) === "[object Object]"
}, toArray: function (value) {
return Array.prototype.slice.call(value)
}, getKeys: Object.keys || function (obj) {
var keys = [], key = "";
for (key in obj) {
if (obj.hasOwnProperty(key)) {
keys.push(key)
}
}
return keys
}, encode: function (value) {
return String(value).replace(/[,;"\=s%]/g, function (character) {
return encodeURIComponent(character)
})
}, decode: function (value) {
return decodeURIComponent(value)
}, retrieve: function (value, fallback) {
return value == null ? fallback : value
}
};
var cookie = {};
cookie.enabled = function () {
if (navigator.cookieEnabled) {
return true
}
var ret = cookie.set("_", "_").get("_") === "_";
cookie.remove("_");
return ret
};
cookie.set = function (key, value, options) {
var d;
options.expires && (d = new Date, d.setTime(d.getTime() + options.expires));
document.cookie = utils.encode(key) + "=" + utils.encode(value) + (options.domain ? "; domain=" + options.domain : "") + (options.path ? "; path=" + options.path : "") + (d ? "; expires=" + d.toGMTString() : "") + (options.secure ? "; secure" : "")
};
cookie.get = function (a, d) {
return (a = RegExp("(^| )" + a + "=([^;]*)(;|$)").exec(document.cookie)) ? a[2] : (d || "")
};
var now = Math.round(new Date / 1000);
var data;
if (/(MSIE 6)/i.test(navigator.userAgent)) {
data = {
mi: /(Mobile)/i.test(navigator.userAgent) ? 1 : 0,
os: "Windows",
osv: "6.0",
bs: "IE",
bsv: "6.0",
sc: screen.width + "," + screen.height,
ce: cookie.enabled() ? 1 : 0,
lg: navigator.language,
ps: [],
ft: now,
rt: now,
j: navigator.javaEnabled(),
ti: document.title,
ref: document.referrer,
url: location.href,
c: window.screen.colorDepth || 0
}
} else {
if (/(MSIE 7)/i.test(navigator.userAgent)) {
data = {
mi: /(Mobile)/i.test(navigator.userAgent) ? 1 : 0,
os: "Windows",
osv: "6.0",
bs: "IE",
bsv: "7.0",
sc: screen.width + "," + screen.height,
ce: cookie.enabled() ? 1 : 0,
lg: navigator.language,
ps: [],
ft: now,
rt: now,
j: navigator.javaEnabled(),
ti: document.title,
ref: document.referrer,
url: location.href,
c: window.screen.colorDepth || 0
}
} else {
if (/(MSIE 8)/i.test(navigator.userAgent)) {
data = {
mi: /(Mobile)/i.test(navigator.userAgent) ? 1 : 0,
os: "Windows",
osv: "6.0",
bs: "IE",
bsv: "8.0",
sc: screen.width + "," + screen.height,
ce: cookie.enabled() ? 1 : 0,
lg: navigator.language,
ps: [],
ft: now,
rt: now,
j: navigator.javaEnabled(),
ti: document.title,
ref: document.referrer,
url: location.href,
c: window.screen.colorDepth || 0
}
} else {
var ua = new UserAgent();
data = {
mi: /(Mobile)/i.test(ua.USER_AGENT) ? 1 : 0,
os: ua.OS,
osv: ua.OS_VERSION,
bs: ua.BROWSER,
bsv: ua.BROWSER_VERSION,
sc: screen.width + "," + screen.height,
ce: cookie.enabled() ? 1 : 0,
lg: ua.LANGUAGE,
ps: [],
ft: now,
rt: now,
j: navigator.javaEnabled(),
ti: document.title,
ref: document.referrer,
url: location.href,
c: window.screen.colorDepth || 0
}
}
}
}
if (data.bs === "IE") {
data.ie = data.bs + parseInt(data.bsv, 10)
}
var plugins = navigator.plugins;
var i = 0, obj, map = {};
while (obj = plugins[i]) {
if (!map[obj.name]) {
data.ps.push(obj.name)
}
map[obj.name] = 1;
i++
}

function log(s) {
if (/debug/i.test(location.href) && console) {
console.log(s)
}
}

function loadScript(url, cb) {
var el = document.createElement("script");
el.charset = "utf-8";
cb && (typeof cb === "function") && (el.readyState ? el.onreadystatechange = function () {
if ("loaded" === el.readyState || "complete" === el.readyState) {
el.onreadystatechange = s, cb()
}
} : el.onload = function () {
cb()
});
el.src = url;
var fsel = document.getElementsByTagName("script")[0];
fsel.parentNode.insertBefore(el, fsel)
}

var submitlog = function (data, cb) {
var img = new Image;
img.onload = img.onerror = img.onabort = function () {
img.onload = img.onerror = img.onabort = null;
img = null;
cb && (typeof cb === "function") && cb(url)
};
img.src = "http://" + fluxDomain + "/api/flux?site=" + siteId + "&data=" + encodeURIComponent(JSON.stringify(data))
};
var heatmaplog = function (data, cb) {
var img = new Image;
img.onload = img.onerror = img.onabort = function () {
img.onload = img.onerror = img.onabort = null;
img = null;
cb && (typeof cb === "function") && cb(url)
};
img.src = "http://" + fluxDomain + "/api/flux?site=" + siteId + "&click=1&data=" + encodeURIComponent(JSON.stringify(data))
};

function getSiteId() {
var scripts = document.getElementsByTagName("script");
var el, url, re = /^http[s]?://([w.]+?)/flux.js?(w{1,50})$/i;
for (var i = scripts.length - 1; i >= 0; i--) {
el = scripts[i];
url = el ? el.src : "";
if (url) {
var matchs = url.match(re);
if (matchs) {
fluxDomain = matchs[1];
siteId = matchs[2]
}
}
}
}

var fluxDomain;
var siteId;
getSiteId();
var __ft = "__ft_" + siteId;
var __rt = "__rt_" + siteId;
var __cn = "__cn_" + siteId;
var ft = cookie.get(__ft, "");
var rt = cookie.get(__rt, "");
var postcount = cookie.get(__cn, 0);
if (!postcount) {
postcount = 0
}
postcount = parseInt(postcount, 10);
postcount += 1;
if (ft) {
data.ft = ft
} else {
data.ft = now;
cookie.set(__ft, now, {path: "/", expires: 86400000})
}
if (rt) {
data.rt = rt
} else {
data.rt = now;
cookie.set(__rt, now, {path: "/", expires: 86400})
}
cookie.set(__cn, postcount, {path: "/", expires: 86400000});
data.cn = postcount;
submitlog(data);
var Flux = {};
Flux.SiteId = siteId;
Flux.domain = fluxDomain;
Flux.submitlog = submitlog;
Flux.heatmaplog = heatmaplog;
Flux.loadScript = loadScript;
Flux.data = data;
window.Flux = Flux
}, 0);
setTimeout(function () {
var Flux = window.Flux;
var data = Flux.data;
var blankPoints = [];

function getPoint(x, y, isLink, target) {
var clientWidth = document.documentElement.clientWidth || document.body.clientWidth;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
var oX = Math.round(clientWidth / 2);
var point = {x: (x - oX), y: (y + scrollTop)};
if (target.id) {
point.id = target.id
}
return point
}

var eventHandle = function (e) {
var target = e.target || e.srcElement;
var isLink = /a/i.test(target.tagName);
blankPoints.push(getPoint(e.clientX, e.clientY, isLink, target));
if (isLink || blankPoints.length > 2) {
data.cp = blankPoints;
Flux.heatmaplog(data);
blankPoints = []
}
};
if (document.addEventListener) {
document.addEventListener("mousedown", eventHandle, false)
} else {
if (document.attachEvent) {
document.attachEvent("onmousedown", eventHandle)
}
}
}, 0);
setTimeout(function () {
var loadScript = Flux.loadScript;
var url = location.href;
var linkmap = {};

function showText(el, text) {
var html = '<span style="position:absolute; top:0; left:0; 100%; height:25px; color:#fff; opacity:.8; display:inline-block;" title="' + text + '">' + text + "</span>";
$(el).css("position", "relative").append(html)
}

function showText2(el, text) {
var html = "";
var scrollLeft = document.documentElement.scrollLeft;
var scrollTop = document.documentElement.scrollTop;
var left = el.getBoundingClientRect().left;
var top = el.getBoundingClientRect().top;
var right = el.getBoundingClientRect().right;
var width = right - left;
top += scrollTop;
left += scrollLeft;
if (top && left) {
html = '<div style="position:absolute; top: ' + top + "px; left:" + left + "px; " + width + 'px; color:#fff; opacity:.9; display:inline-block;" title="' + text + '">' + text + "</div>"
}
return html
}

function showLinkmap(data) {
var htmlList = [];
data.forEach(function (item) {
var elList = null;
if (elList = linkmap[item[0]]) {
elList.forEach(function (el) {
showText(el, item[1] + "(" + item[2] + ")")
})
}
})
}

(url.indexOf("heatlink=1") > 0) && setTimeout(function () {
var page = "";
var et = "";
var st = "";
var matchs = url.match(/[&?]page=(w+)/);
if (matchs) {
page = matchs[1]
}
matchs = url.match(/[&?]st=(w+)/);
if (matchs) {
st = matchs[1]
}
matchs = url.match(/[&?]et=(w+)/);
if (matchs) {
et = matchs[1]
}
var links = document.getElementsByTagName("a");
Array.prototype.forEach.call(links, function (el) {
if (linkmap[el.href]) {
linkmap[el.href].push(el)
} else {
linkmap[el.href] = [el]
}
});
window.fluxShowLinkmap = showLinkmap;
Flux.loadScript("http://" + Flux.domain + "/page-clickmap/data-linkmap?page=" + page + "&et=" + et + "&st=" + st + "&callback=fluxShowLinkmap")
}, 0)
}, 0);
setTimeout(function () {
(function (name, definition) {
this[name] = definition()
})("$script", function () {
var doc = document, head = doc.getElementsByTagName("head")[0], s = "string", f = false, push = "push",
readyState = "readyState", onreadystatechange = "onreadystatechange", list = {}, ids = {}, delay = {},
scripts = {}, scriptpath, urlArgs;

function every(ar, fn) {
for (var i = 0, j = ar.length; i < j; ++i) {
if (!fn(ar[i])) {
return f
}
}
return 1
}

function each(ar, fn) {
every(ar, function (el) {
fn(el);
return 1
})
}

function $script(paths, idOrDone, optDone) {
paths = paths[push] ? paths : [paths];
var idOrDoneIsDone = idOrDone && idOrDone.call, done = idOrDoneIsDone ? idOrDone : optDone,
id = idOrDoneIsDone ? paths.join("") : idOrDone, queue = paths.length;

function loopFn(item) {
return item.call ? item() : list[item]
}

function callback() {
if (!--queue) {
list[id] = 1;
done && done();
for (var dset in delay) {
every(dset.split("|"), loopFn) && !each(delay[dset], loopFn) && (delay[dset] = [])
}
}
}

setTimeout(function () {
each(paths, function loading(path, force) {
if (path === null) {
return callback()
}
if (!force && !/^https?:///.test(path) && scriptpath) {
path = (path.indexOf(".js") === -1) ? scriptpath + path + ".js" : scriptpath + path
}
if (scripts[path]) {
if (id) {
ids[id] = 1
}
return (scripts[path] == 2) ? callback() : setTimeout(function () {
loading(path, true)
}, 0)
}
scripts[path] = 1;
if (id) {
ids[id] = 1
}
create(path, callback)
})
}, 0);
return $script
}

function create(path, fn) {
var el = doc.createElement("script"), loaded;
el.onload = el.onerror = el[onreadystatechange] = function () {
if ((el[readyState] && !(/^c|loade/.test(el[readyState]))) || loaded) {
return
}
el.onload = el[onreadystatechange] = null;
loaded = 1;
scripts[path] = 2;
fn()
};
el.async = 1;
el.src = urlArgs ? path + (path.indexOf("?") === -1 ? "?" : "&") + urlArgs : path;
head.insertBefore(el, head.lastChild)
}

$script.get = create;
$script.order = function (scripts, id, done) {
(function callback(s) {
s = scripts.shift();
!scripts.length ? $script(s, id, done) : $script(s, callback)
}())
};
$script.path = function (p) {
scriptpath = p
};
$script.urlArgs = function (str) {
urlArgs = str
};
$script.ready = function (deps, ready, req) {
deps = deps[push] ? deps : [deps];
var missing = [];
!each(deps, function (dep) {
list[dep] || missing[push](dep)
}) && every(deps, function (dep) {
return list[dep]
}) ? ready() : !function (key) {
delay[key] = delay[key] || [];
delay[key][push](ready);
req && req(missing)
}(deps.join("|"));
return $script
};
$script.done = function (idOrDone) {
$script([null], idOrDone)
};
return $script
});
(function ($) {
function safe_add(x, y) {
var lsw = (x & 65535) + (y & 65535);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 65535)
}

function bit_rol(num, cnt) {
return (num << cnt) | (num >>> (32 - cnt))
}

function md5_cmn(q, a, b, x, s, t) {
return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b)
}

function md5_ff(a, b, c, d, x, s, t) {
return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t)
}

function md5_gg(a, b, c, d, x, s, t) {
return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t)
}

function md5_hh(a, b, c, d, x, s, t) {
return md5_cmn(b ^ c ^ d, a, b, x, s, t)
}

function md5_ii(a, b, c, d, x, s, t) {
return md5_cmn(c ^ (b | (~d)), a, b, x, s, t)
}

function binl_md5(x, len) {
x[len >> 5] |= 128 << (len % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var i;
var olda;
var oldb;
var oldc;
var oldd;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for (i = 0; i < x.length; i += 16) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = md5_ff(a, b, c, d, x[i], 7, -680876936);
d = md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = md5_gg(b, c, d, a, x[i], 20, -373897302);
a = md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = md5_hh(d, a, b, c, x[i], 11, -358537222);
c = md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = md5_ii(a, b, c, d, x[i], 6, -198630844);
d = md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd)
}
return [a, b, c, d]
}

function binl2rstr(input) {
var i;
var output = "";
for (i = 0; i < input.length * 32; i += 8) {
output += String.fromCharCode((input[i >> 5] >>> (i % 32)) & 255)
}
return output
}

function rstr2binl(input) {
var i;
var output = [];
output[(input.length >> 2) - 1] = undefined;
for (i = 0; i < output.length; i += 1) {
output[i] = 0
}
for (i = 0; i < input.length * 8; i += 8) {
output[i >> 5] |= (input.charCodeAt(i / 8) & 255) << (i % 32)
}
return output
}

function rstr_md5(s) {
return binl2rstr(binl_md5(rstr2binl(s), s.length * 8))
}

function rstr_hmac_md5(key, data) {
var i;
var bkey = rstr2binl(key);
var ipad = [];
var opad = [];
var hash;
ipad[15] = opad[15] = undefined;
if (bkey.length > 16) {
bkey = binl_md5(bkey, key.length * 8)
}
for (i = 0; i < 16; i += 1) {
ipad[i] = bkey[i] ^ 909522486;
opad[i] = bkey[i] ^ 1549556828
}
hash = binl_md5(ipad.concat(rstr2binl(data)), 512 + data.length * 8);
return binl2rstr(binl_md5(opad.concat(hash), 512 + 128))
}

function rstr2hex(input) {
var hex_tab = "0123456789abcdef";
var output = "";
var x;
var i;
for (i = 0; i < input.length; i += 1) {
x = input.charCodeAt(i);
output += hex_tab.charAt((x >>> 4) & 15) + hex_tab.charAt(x & 15)
}
return output
}

function str2rstr_utf8(input) {
return unescape(encodeURIComponent(input))
}

function raw_md5(s) {
return rstr_md5(str2rstr_utf8(s))
}

function hex_md5(s) {
return rstr2hex(raw_md5(s))
}

function raw_hmac_md5(k, d) {
return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))
}

function hex_hmac_md5(k, d) {
return rstr2hex(raw_hmac_md5(k, d))
}

function md5(string, key, raw) {
if (!key) {
if (!raw) {
return hex_md5(string)
}
return raw_md5(string)
}
if (!raw) {
return hex_hmac_md5(key, string)
}
return raw_hmac_md5(key, string)
}

$.md5 = md5
}(window.Flux))
}, 0);
if (typeof JSON !== "object") {
JSON = {}
}
(function () {
var rx_one = /^[],:{}s]*$/;
var rx_two = /\(?:["\/bfnrt]|u[0-9a-fA-F]{4})/g;
var rx_three = /"[^"\ ]*"|true|false|null|-?d+(?:.d*)?(?:[eE][+-]?d+)?/g;
var rx_four = /(?:^|:|,)(?:s*[)+/g;
var rx_escapable = /[\"u0000-u001fu007f-u009fu00adu0600-u0604u070fu17b4u17b5u200c-u200fu2028-u202fu2060-u206fufeffufff0-uffff]/g;
var rx_dangerous = /[u0000u00adu0600-u0604u070fu17b4u17b5u200c-u200fu2028-u202fu2060-u206fufeffufff0-uffff]/g;

function f(n) {
return n < 10 ? "0" + n : n
}

function this_value() {
return this.valueOf()
}

if (typeof Date.prototype.toJSON !== "function") {
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;
var indent;
var meta;
var rep;

function quote(string) {
rx_escapable.lastIndex = 0;
return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function (a) {
var c = meta[a];
return typeof c === "string" ? c : "\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
}) + '"' : '"' + string + '"'
}

function str(key, holder) {
var i;
var k;
var v;
var length;
var mind = gap;
var partial;
var value = holder[key];
if (value && typeof value === "object" && typeof value.toJSON === "function") {
value = value.toJSON(key)
}
if (typeof rep === "function") {
value = rep.call(holder, key, value)
}
switch (typeof value) {
case"string":
return quote(value);
case"number":
return isFinite(value) ? String(value) : "null";
case"boolean":
case"null":
return String(value);
case"object":
if (!value) {
return "null"
}
gap += indent;
partial = [];
if (Object.prototype.toString.apply(value) === "[object Array]") {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || "null"
}
v = partial.length === 0 ? "[]" : gap ? "[ " + gap + partial.join(", " + gap) + " " + mind + "]" : "[" + partial.join(",") + "]";
gap = mind;
return v
}
if (rep && typeof rep === "object") {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === "string") {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ": " : ":") + v)
}
}
}
} else {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ": " : ":") + v)
}
}
}
}
v = partial.length === 0 ? "{}" : gap ? "{ " + gap + partial.join(", " + gap) + " " + mind + "}" : "{" + partial.join(",") + "}";
gap = mind;
return v
}
}

if (typeof JSON.stringify !== "function") {
meta = {"": "\b", " ": "\t", " ": "\n", "f": "\f", " ": "\r", '"': '\"', "\": "\\"};
JSON.stringify = function (value, replacer, space) {
var i;
gap = "";
indent = "";
if (typeof space === "number") {
for (i = 0; i < space; i += 1) {
indent += " "
}
} else {
if (typeof space === "string") {
indent = space
}
}
rep = replacer;
if (replacer && typeof replacer !== "function" && (typeof replacer !== "object" || typeof replacer.length !== "number")) {
throw new Error("JSON.stringify")
}
return str("", {"": value})
}
}
if (typeof JSON.parse !== "function") {
JSON.parse = function (text, reviver) {
var j;

function walk(holder, key) {
var k;
var v;
var value = holder[key];
if (value && typeof value === "object") {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v
} else {
delete value[k]
}
}
}
}
return reviver.call(holder, key, value)
}

text = String(text);
rx_dangerous.lastIndex = 0;
if (rx_dangerous.test(text)) {
text = text.replace(rx_dangerous, function (a) {
return "\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4)
})
}
if (rx_one.test(text.replace(rx_two, "@").replace(rx_three, "]").replace(rx_four, ""))) {
j = eval("(" + text + ")");
return (typeof reviver === "function") ? walk({"": j}, "") : j
}
throw new SyntaxError("JSON.parse")
}
}
}());


原文地址:https://www.cnblogs.com/rsapaper/p/9842602.html