Skip to content

Instantly share code, notes, and snippets.

@icai
Last active April 3, 2023 03:17
Show Gist options
  • Save icai/8e8723e7e10b94d01df64af27e303798 to your computer and use it in GitHub Desktop.
Save icai/8e8723e7e10b94d01df64af27e303798 to your computer and use it in GitHub Desktop.
weibo login flow
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
<title>新浪通行证</title>
<script charset="utf-8" src="https://i.sso.sina.com.cn/js/ssologin.js"></script>
</head>
<body>
正在登录 ...
<script>
try{sinaSSOController.setCrossDomainUrlList({"retcode":0,"arrURL":["https:\/\/passport.weibo.com\/wbsso\/login?ticket=ST-DSBMTZNjg1YTE5Nw%3D%3D-1533906487-tc-F0D951292A632B8774412019DBB041AD-1&ssosavestate=1565442486","https:\/\/passport.97973.com\/sso\/crossdomain?action=login&savestate=1565442486","https:\/\/passport.krcom.cn\/sso\/crossdomain?service=krvideo&savestate=1&ticket=ST-DSBMTZNjg1YTE5Nw%3D%3D-1533906487-tc-sa-1&ssosavestate=1565442486","https:\/\/passport.weibo.cn\/sso\/crossdomain?action=login&savestate=1"]});}
catch(e){
var msg = e.message;
var img = new Image();
var type = 1;
img.src = 'https://login.sina.com.cn/sso/debuglog?msg=' + msg +'&type=' + type;
}try{sinaSSOController.crossDomainAction('login',function(){location.replace('https://passport.weibo.com/wbsso/login?ssosavestate=1565442486&url=https%3A%2F%2Fweibo.com%2F328765211%3Freason%3D%26retcode%3D%26sudaref%3Dpassport.weibo.com&display=0&ticket=ST-DSBMTZNjg1YTE5Nw==-1533906486-tc-C8C983A878F4776588C4C2126BF9AE5A-1&retcode=0');});}
catch(e){
var msg = e.message;
var img = new Image();
var type = 2;
img.src = 'https://login.sina.com.cn/sso/debuglog?msg=' + msg +'&type=' + type;
}
</script>
</body>
</html>
https://weibo.com/doamin
https://login.sina.com.cn/sso/login.php?url=https%3A%2F%2Fweibo.com%2F328765211&_rand=1533906258.5319&gateway=1&service=miniblog&entry=miniblog&useticket=1&returntype=META&_client_version=0.6.28
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.6.1
Date: Fri, 10 Aug 2018 13:04:21 GMT
Content-Type: text/html
Connection: keep-alive
Pragma: public
Cache-Control: maxage=1
Expires: Fri, 10 Aug 2018 13:04:22 GMT
Set-Cookie: SCF=AtxWufj_eXAOYb0zRubs8otDDrTRUAehFaa-aC26kkaQLLkEIsdpeFsg-NmUGraA4P10JtaJcfM3razzy3s0oiGDyGU.; expires=Monday, 07-Aug-2028 13:04:21 GMT; path=/; domain=.weibo.com; httponly
Set-Cookie: SUB=_2A252af0FDezzRhGedN7lQZ9SfNwjuIHXVVH2nNrDV8PUJbmtAKLWulkW9NWzzip6eJLGAeQqHiIObqgatkL6133F4lLw; Path=/; Domain=.weibo.com; HttpOnly
Set-Cookie: SUBP=0033WrSXqPxfM725Ws9jqgMF55529P9D9WhWAAyJrssscw_6mZmv0qquTTp5JpX5K-hUgL.Fo20SKqRSK.p1KM2dJLoIEBLxKqL1-eLBKnLxKqLBozL1K5LxK.L1-zLBKnLxKML1hzLBo.t; expires=Saturday, 10-Aug-2019 13:04:21 GMT; path=/; domain=.weibo.com
Set-Cookie: SUHB=0rrK1Q-H5Yvlsw; expires=Saturday, 10-Aug-2019 13:04:21 GMT; path=/; domain=.weibo.com
Set-Cookie: SRT=D.QqHBJZ4psRdRnM!Mb4cYGSdMKi-oMdZbOS!u3TePHNEYdP!XpU!upMERt4EP1RcsrA4kJP3PjTsVuObW9VDSbN!oGAdPMV4Y9N4y8VdWYWFkaJiZmqJrRrUmo3*B.vAflW-P9Rc0lR-ykZDvnJqiQVbiRVPBtS!r3JsssZPQVqbgVasdWiMZ4saiOzu4DbmKPWfPrEB549pR3WaicsTUQRnVQEsPEMni49ndDPIIdYPSrnlMc0pJEiIVPHONpunJ4kiJcM1OFyHM4HJ5mkoODmkS4oCN-uJ5mkoOmH65!noNqPJ5mjlODmk5!oCN-uJ5mkiODEf5!oCUpur; expires=Monday, 07-Aug-2028 13:04:21 GMT; path=/; domain=.passport.weibo.com; httponly
Set-Cookie: SRF=1533906261; expires=Monday, 07-Aug-2028 13:04:21 GMT; path=/; domain=.passport.weibo.com
Set-Cookie: ALF=1565442258; expires=Sat, 10-Aug-2019 13:04:18 GMT; Max-Age=31535997; path=/; domain=.weibo.com
Set-Cookie: SSOLoginState=1533906261; path=/; domain=.weibo.com
P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
Location: https://weibo.com/328765211
DPOOL_HEADER: lich241
Set-Cookie: login=a902e3917463sc116c832438zd20c9245191; Path=/
Content-Length: 0
<!--
https://passport.weibo.com/wbsso/login?ssosavestate=1565442258&url=https%3A%2F%2Fweibo.com%2F328765211&display=0&ticket=ST-ss==-1533906261-tc-zz-1&retcode=0
-->
HTTP/1.1 302 Moved Temporarily
Server: nginx/1.6.1
Date: Fri, 10 Aug 2018 13:04:21 GMT
Content-Type: text/html
Connection: keep-alive
Pragma: public
Cache-Control: maxage=1
Expires: Fri, 10 Aug 2018 13:04:22 GMT
Set-Cookie: SCF=AtxWufj_eXAOYb0zRub8ossatDDrTRUAehFaa-z-NmUGrA4P10JataJcfM3rzsay3s0oiGDyGU.; expires=Monday, 07-Aug-2028 13:04:21 GMT; path=/; domain=.weibo.com; httponly
Set-Cookie: SUB=_2A252af0FDeRhGedN7lQZ9SfNwjuIHXVVH2nNrDV8PUJbmtAKLWudlksW9NWip6eJLGAeQqHiIObqgatkL6133F4lLw; Path=/; Domain=.weibo.com; HttpOnly
Set-Cookie: SUBP=0033WrSXqPxfM725sGWs9jqgMF55529P9D9WhWAAyJrcw_6mZmv0qquTTzp5JpX5K-hUgL.Fo20SKqRSK.p1KM2IEBLxKqL1-eLBKnLxLBozL1K5LxK.L1-zLBKnLxKML1hzLBo.t; expires=Saturday, 10-Aug-2019 13:04:21 GMT; path=/; domain=.weibo.com
Set-Cookie: SUHB=0rrKs1Q-H5Yvlsw; expires=Saturday, 10-Aug-2019 13:04:21 GMT; path=/; domain=.weibo.com
Set-Cookie: SRT=D.z!Mb4cYGSdMKi-oMdZbOS!u3TePHNEYdP!XpU!s!a*B.vAflW-P9Rc0lR-ykZDvnJqiQVbiRVPBtS!r3JZPQVqbgVdWiMZ4siOzu4DsfPrEB549pR3WaicsTUQRnVQEsPEMni49nsdDPIIdYPSrnlMc0pJEiIVPHONpunJ4kiJcM1OFyHM4HJ5mkoODmkS4oCN-uJ5mkoOmH65!noNjlODmk5!oCN-uJ5mkiODEf5!oCUpur; expires=Monday, 07-Aug-2028 13:04:21 GMT; path=/; domain=.passport.weibo.com; httponly
Set-Cookie: SRF=1533906261; expires=Monday, 07-Aug-2028 13:04:21 GMT; path=/; domain=.passport.weibo.com
Set-Cookie: ALF=1565442258; expires=Sat, 10-Aug-2019 13:04:18 GMT; Max-Age=31535997; path=/; domain=.weibo.com
Set-Cookie: SSOLoginState=1533906261; path=/; domain=.weibo.com
P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"
Location: https://weibo.com/328765211
DPOOL_HEADER: lich241
Set-Cookie: login=a902e3917463c16c83238d20c9245191; Path=/
Content-Length: 0
P3P
http://www.w3.org/P3P/validator.html
https://login.sina.com.cn/sso/login.php?entry=sso&alt=ALT-DSBMTZNjg1YTE5Nw==-1533906486-tc-s-1&returntype=META&gateway=1&savestate=365&url=https%3A%2F%2Fweibo.com%2F328765211%3Freason%3D%26retcode%3D
<html>
<head>
<title>新浪通行证</title>
<meta http-equiv="refresh" content="0; url=&#39;https://login.sina.com.cn/crossdomain2.php?action=login&entry=sso&r=https%3A%2F%2Fpassport.weibo.com%2Fwbsso%2Flogin%3Fssosavestate%3D1565442486%26url%3Dhttps%253A%252F%252Fweibo.com%252F328765211%253Freason%253D%2526retcode%253D%2526sudaref%253Dpassport.weibo.com%26display%3D0%26ticket%3DST-DSBMTZNjg1YTE5Nw%3D%3D-1533906486-tc-gd-1%26retcode%3D0&login_time=1533566767&sign=2eff500a2dd5be08&#39;"/>
<meta http-equiv="Content-Type" content="text/html; charset=GBK" />
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000cc" vlink="#551a8b" alink="#ff0000">
<script type="text/javascript" language="javascript">
location.replace("https://login.sina.com.cn/crossdomain2.php?action=login&entry=sso&r=https%3A%2F%2Fpassport.weibo.com%2Fwbsso%2Flogin%3Fssosavestate%3D1565442486%26url%3Dhttps%253A%252F%252Fweibo.com%252F328765211%253Freason%253D%2526retcode%253D%2526sudaref%253Dpassport.weibo.com%26display%3D0%26ticket%3DST-DSBMTZNjg1YTE5Nw%3D%3D-1533906486-tc-gz-1%26retcode%3D0&login_time=1533566767&sign=2eff500a2dd5be08");
</script>
</body>
</html>
window.ufp = window.ufp || {};
window.ufp.config = {
platforms: [
["Win", 1],
["Mac", 2],
["Linux", 3],
["FreeBSD", 4],
["iPhone", 21.1],
["iPod", 21.2],
["iPad", 21.3],
["Win.*CE", 12.1],
["Win.*Mobile", 12.2],
["Pocket\\s*PC", 12.3],
["", 999]
],
plugins: {
'\u9a71\u52a8\u7cbe\u7075\u5728\u7ebf\u72481.0.0.5': {
classid: 'clsid:A9EA64C1-D146-4B99-86A7-68B1786D82C0',
filename: "dgweb.dll",
name: "\u9a71\u52a8\u7cbe\u7075\u5728\u7ebf\u7248",
version: '1.0.0.5'
},
'PPLive Lite Class ver 3.1.8.6046': {
classid: 'clsid:EF0D1A14-1033-41A2-A589-240C01EDC078',
filename: "pplugin2.dll",
name: "PPLive Lite Class",
version: '3.1.8.6046'
},
'baiduplayer Browser Plugin': {
classid: 'clsid:02E2D748-67F8-48B4-8AB4-0A085374BB99',
filename: "npxbdyy.dll",
name: "BaiduPlayer Browser Plugin"
},
'webmod Class': {
classid: 'clsid:FEE3C8C5-9BEA-4079-AB36-63ECABFC7392',
filename: "Alidcp.dll"
}
},
Detectable_Components_in_Internet_Explorer_by_capclient: {
"Address Book": "7790769C-0471-11D2-AF11-00C04FA35D02",
"Windows Desktop Update NT": "89820200-ECBD-11CF-8B85-00AA005B4340",
"DirectAnimation": "283807B5-2C60-11D0-A31D-00AA00B92C03",
"DirectAnimation Java Classes": "4F216970-C90C-11D1-B5C7-0000F8051515",
"DirectShow": "44BBA848-CC51-11CF-AAFA-00AA00B6015C",
"Dynamic HTML Data Binding": "9381D8F2-0288-11D0-9501-00AA00B911A5",
"Dynamic HTML Data Binding for Java": "4F216970-C90C-11D1-B5C7-0000F8051515",
"Internet Connection Wizard": "5A8D6EE0-3E18-11D0-821E-444553540000",
"Internet Explorer 5 Browser": "89820200-ECBD-11CF-8B85-00AA005B4383",
"Windows Internet Explorer Classes for Java": "08B0E5C0-4FCB-11CF-AAA5-00401C608555",
"Internet Explorer Help": "45EA75A0-A269-11D1-B5BF-0000F8051515",
"Internet Explorer Help Engine": "DE5AED00-A4BF-11D1-9948-00C04F98BBC9",
"Windows Media Player": "22D6F312-B0F6-11D0-94AB-0080C74C7E95",
"NetMeeting NT": "44BBA842-CC51-11CF-AAFA-00AA00B6015B",
"Offline Browsing Pack": "3AF36230-A269-11D1-B5BF-0000F8051515",
"Outlook Express": "44BBA840-CC51-11CF-AAFA-00AA00B6015C",
"Task Scheduler": "CC2A9BA0-3BDD-11D0-821E-444553540000",
"Microsoft virtual machine": "08B0E5C0-4FCB-11CF-AAA5-00401C608500"
},
//pull from http://sjs.sinajs.cn/blog7swf/fonts.swf for ssl reason
flashUrl_fonts: "/images/visitor/fonts.swf",
fpPostInterface: "visitor/genvisitor",
fpCollectInterface: "visitor/record"
};
/* SWFObject v2.2 <http://code.google.com/p/swfobject/>
is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject = function () {
var D = "undefined", r = "object", S = "Shockwave Flash", W = "ShockwaveFlash.ShockwaveFlash", q = "application/x-shockwave-flash", R = "SWFObjectExprInst", x = "onreadystatechange", O = window, j = document, t = navigator, T = false, U = [h], o = [], N = [], I = [], l, Q, E, B, J = false, a = false, n, G, m = true, M = function () {
var aa = typeof j.getElementById != D && typeof j.getElementsByTagName != D && typeof j.createElement != D, ah = t.userAgent.toLowerCase(), Y = t.platform.toLowerCase(), ae = Y ? /win/.test(Y) : /win/.test(ah), ac = Y ? /mac/.test(Y) : /mac/.test(ah), af = /webkit/.test(ah) ? parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, X = !+"\v1", ag = [0, 0, 0], ab = null;
if (typeof t.plugins != D && typeof t.plugins[S] == r) {
ab = t.plugins[S].description;
if (ab && !(typeof t.mimeTypes != D && t.mimeTypes[q] && !t.mimeTypes[q].enabledPlugin)) {
T = true;
X = false;
ab = ab.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
ag[0] = parseInt(ab.replace(/^(.*)\..*$/, "$1"), 10);
ag[1] = parseInt(ab.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
ag[2] = /[a-zA-Z]/.test(ab) ? parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/, "$1"), 10) : 0
}
} else {
if (typeof O.ActiveXObject != D) {
try {
var ad = new ActiveXObject(W);
if (ad) {
ab = ad.GetVariable("$version");
if (ab) {
X = true;
ab = ab.split(" ")[1].split(",");
ag = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)]
}
}
} catch (Z) {
}
}
}
return{w3: aa, pv: ag, wk: af, ie: X, win: ae, mac: ac}
}(), k = function () {
if (!M.w3) {
return
}
if ((typeof j.readyState != D && j.readyState == "complete") || (typeof j.readyState == D && (j.getElementsByTagName("body")[0] || j.body))) {
f()
}
if (!J) {
if (typeof j.addEventListener != D) {
j.addEventListener("DOMContentLoaded", f, false)
}
if (M.ie && M.win) {
j.attachEvent(x, function () {
if (j.readyState == "complete") {
j.detachEvent(x, arguments.callee);
f()
}
});
if (O == top) {
(function () {
if (J) {
return
}
try {
j.documentElement.doScroll("left")
} catch (X) {
setTimeout(arguments.callee, 0);
return
}
f()
})()
}
}
if (M.wk) {
(function () {
if (J) {
return
}
if (!/loaded|complete/.test(j.readyState)) {
setTimeout(arguments.callee, 0);
return
}
f()
})()
}
s(f)
}
}();
function f() {
if (J) {
return
}
try {
var Z = j.getElementsByTagName("body")[0].appendChild(C("span"));
Z.parentNode.removeChild(Z)
} catch (aa) {
return
}
J = true;
var X = U.length;
for (var Y = 0; Y < X; Y++) {
U[Y]()
}
}
function K(X) {
if (J) {
X()
} else {
U[U.length] = X
}
}
function s(Y) {
if (typeof O.addEventListener != D) {
O.addEventListener("load", Y, false)
} else {
if (typeof j.addEventListener != D) {
j.addEventListener("load", Y, false)
} else {
if (typeof O.attachEvent != D) {
i(O, "onload", Y)
} else {
if (typeof O.onload == "function") {
var X = O.onload;
O.onload = function () {
X();
Y()
}
} else {
O.onload = Y
}
}
}
}
}
function h() {
if (T) {
V()
} else {
H()
}
}
function V() {
var X = j.getElementsByTagName("body")[0];
var aa = C(r);
aa.setAttribute("type", q);
var Z = X.appendChild(aa);
if (Z) {
var Y = 0;
(function () {
if (typeof Z.GetVariable != D) {
var ab = Z.GetVariable("$version");
if (ab) {
ab = ab.split(" ")[1].split(",");
M.pv = [parseInt(ab[0], 10), parseInt(ab[1], 10), parseInt(ab[2], 10)]
}
} else {
if (Y < 10) {
Y++;
setTimeout(arguments.callee, 10);
return
}
}
X.removeChild(aa);
Z = null;
H()
})()
} else {
H()
}
}
function H() {
var ag = o.length;
if (ag > 0) {
for (var af = 0; af < ag; af++) {
var Y = o[af].id;
var ab = o[af].callbackFn;
var aa = {success: false, id: Y};
if (M.pv[0] > 0) {
var ae = c(Y);
if (ae) {
if (F(o[af].swfVersion) && !(M.wk && M.wk < 312)) {
w(Y, true);
if (ab) {
aa.success = true;
aa.ref = z(Y);
ab(aa)
}
} else {
if (o[af].expressInstall && A()) {
var ai = {};
ai.data = o[af].expressInstall;
ai.width = ae.getAttribute("width") || "0";
ai.height = ae.getAttribute("height") || "0";
if (ae.getAttribute("class")) {
ai.styleclass = ae.getAttribute("class")
}
if (ae.getAttribute("align")) {
ai.align = ae.getAttribute("align")
}
var ah = {};
var X = ae.getElementsByTagName("param");
var ac = X.length;
for (var ad = 0; ad < ac; ad++) {
if (X[ad].getAttribute("name").toLowerCase() != "movie") {
ah[X[ad].getAttribute("name")] = X[ad].getAttribute("value")
}
}
P(ai, ah, Y, ab)
} else {
p(ae);
if (ab) {
ab(aa)
}
}
}
}
} else {
w(Y, true);
if (ab) {
var Z = z(Y);
if (Z && typeof Z.SetVariable != D) {
aa.success = true;
aa.ref = Z
}
ab(aa)
}
}
}
}
}
function z(aa) {
var X = null;
var Y = c(aa);
if (Y && Y.nodeName == "OBJECT") {
if (typeof Y.SetVariable != D) {
X = Y
} else {
var Z = Y.getElementsByTagName(r)[0];
if (Z) {
X = Z
}
}
}
return X
}
function A() {
return !a && F("6.0.65") && (M.win || M.mac) && !(M.wk && M.wk < 312)
}
function P(aa, ab, X, Z) {
a = true;
E = Z || null;
B = {success: false, id: X};
var ae = c(X);
if (ae) {
if (ae.nodeName == "OBJECT") {
l = g(ae);
Q = null
} else {
l = ae;
Q = X
}
aa.id = R;
if (typeof aa.width == D || (!/%$/.test(aa.width) && parseInt(aa.width, 10) < 310)) {
aa.width = "310"
}
if (typeof aa.height == D || (!/%$/.test(aa.height) && parseInt(aa.height, 10) < 137)) {
aa.height = "137"
}
j.title = j.title.slice(0, 47) + " - Flash Player Installation";
var ad = M.ie && M.win ? "ActiveX" : "PlugIn", ac = "MMredirectURL=" + O.location.toString().replace(/&/g, "%26") + "&MMplayerType=" + ad + "&MMdoctitle=" + j.title;
if (typeof ab.flashvars != D) {
ab.flashvars += "&" + ac
} else {
ab.flashvars = ac
}
if (M.ie && M.win && ae.readyState != 4) {
var Y = C("div");
X += "SWFObjectNew";
Y.setAttribute("id", X);
ae.parentNode.insertBefore(Y, ae);
ae.style.display = "none";
(function () {
if (ae.readyState == 4) {
ae.parentNode.removeChild(ae)
} else {
setTimeout(arguments.callee, 10)
}
})()
}
u(aa, ab, X)
}
}
function p(Y) {
if (M.ie && M.win && Y.readyState != 4) {
var X = C("div");
Y.parentNode.insertBefore(X, Y);
X.parentNode.replaceChild(g(Y), X);
Y.style.display = "none";
(function () {
if (Y.readyState == 4) {
Y.parentNode.removeChild(Y)
} else {
setTimeout(arguments.callee, 10)
}
})()
} else {
Y.parentNode.replaceChild(g(Y), Y)
}
}
function g(ab) {
var aa = C("div");
if (M.win && M.ie) {
aa.innerHTML = ab.innerHTML
} else {
var Y = ab.getElementsByTagName(r)[0];
if (Y) {
var ad = Y.childNodes;
if (ad) {
var X = ad.length;
for (var Z = 0; Z < X; Z++) {
if (!(ad[Z].nodeType == 1 && ad[Z].nodeName == "PARAM") && !(ad[Z].nodeType == 8)) {
aa.appendChild(ad[Z].cloneNode(true))
}
}
}
}
}
return aa
}
function u(ai, ag, Y) {
var X, aa = c(Y);
if (M.wk && M.wk < 312) {
return X
}
if (aa) {
if (typeof ai.id == D) {
ai.id = Y
}
if (M.ie && M.win) {
var ah = "";
for (var ae in ai) {
if (ai[ae] != Object.prototype[ae]) {
if (ae.toLowerCase() == "data") {
ag.movie = ai[ae]
} else {
if (ae.toLowerCase() == "styleclass") {
ah += ' class="' + ai[ae] + '"'
} else {
if (ae.toLowerCase() != "classid") {
ah += " " + ae + '="' + ai[ae] + '"'
}
}
}
}
}
var af = "";
for (var ad in ag) {
if (ag[ad] != Object.prototype[ad]) {
af += '<param name="' + ad + '" value="' + ag[ad] + '" />'
}
}
aa.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + ah + ">" + af + "</object>";
N[N.length] = ai.id;
X = c(ai.id)
} else {
var Z = C(r);
Z.setAttribute("type", q);
for (var ac in ai) {
if (ai[ac] != Object.prototype[ac]) {
if (ac.toLowerCase() == "styleclass") {
Z.setAttribute("class", ai[ac])
} else {
if (ac.toLowerCase() != "classid") {
Z.setAttribute(ac, ai[ac])
}
}
}
}
for (var ab in ag) {
if (ag[ab] != Object.prototype[ab] && ab.toLowerCase() != "movie") {
e(Z, ab, ag[ab])
}
}
aa.parentNode.replaceChild(Z, aa);
X = Z
}
}
return X
}
function e(Z, X, Y) {
var aa = C("param");
aa.setAttribute("name", X);
aa.setAttribute("value", Y);
Z.appendChild(aa)
}
function y(Y) {
var X = c(Y);
if (X && X.nodeName == "OBJECT") {
if (M.ie && M.win) {
X.style.display = "none";
(function () {
if (X.readyState == 4) {
b(Y)
} else {
setTimeout(arguments.callee, 10)
}
})()
} else {
X.parentNode.removeChild(X)
}
}
}
function b(Z) {
var Y = c(Z);
if (Y) {
for (var X in Y) {
if (typeof Y[X] == "function") {
Y[X] = null
}
}
Y.parentNode.removeChild(Y)
}
}
function c(Z) {
var X = null;
try {
X = j.getElementById(Z)
} catch (Y) {
}
return X
}
function C(X) {
return j.createElement(X)
}
function i(Z, X, Y) {
Z.attachEvent(X, Y);
I[I.length] = [Z, X, Y]
}
function F(Z) {
var Y = M.pv, X = Z.split(".");
X[0] = parseInt(X[0], 10);
X[1] = parseInt(X[1], 10) || 0;
X[2] = parseInt(X[2], 10) || 0;
return(Y[0] > X[0] || (Y[0] == X[0] && Y[1] > X[1]) || (Y[0] == X[0] && Y[1] == X[1] && Y[2] >= X[2])) ? true : false
}
function v(ac, Y, ad, ab) {
if (M.ie && M.mac) {
return
}
var aa = j.getElementsByTagName("head")[0];
if (!aa) {
return
}
var X = (ad && typeof ad == "string") ? ad : "screen";
if (ab) {
n = null;
G = null
}
if (!n || G != X) {
var Z = C("style");
Z.setAttribute("type", "text/css");
Z.setAttribute("media", X);
n = aa.appendChild(Z);
if (M.ie && M.win && typeof j.styleSheets != D && j.styleSheets.length > 0) {
n = j.styleSheets[j.styleSheets.length - 1]
}
G = X
}
if (M.ie && M.win) {
if (n && typeof n.addRule == r) {
n.addRule(ac, Y)
}
} else {
if (n && typeof j.createTextNode != D) {
n.appendChild(j.createTextNode(ac + " {" + Y + "}"))
}
}
}
function w(Z, X) {
if (!m) {
return
}
var Y = X ? "visible" : "hidden";
if (J && c(Z)) {
c(Z).style.visibility = Y
} else {
v("#" + Z, "visibility:" + Y)
}
}
function L(Y) {
var Z = /[\\\"<>\.;]/;
var X = Z.exec(Y) != null;
return X && typeof encodeURIComponent != D ? encodeURIComponent(Y) : Y
}
var d = function () {
if (M.ie && M.win) {
window.attachEvent("onunload", function () {
var ac = I.length;
for (var ab = 0; ab < ac; ab++) {
I[ab][0].detachEvent(I[ab][1], I[ab][2])
}
var Z = N.length;
for (var aa = 0; aa < Z; aa++) {
y(N[aa])
}
for (var Y in M) {
M[Y] = null
}
M = null;
for (var X in swfobject) {
swfobject[X] = null
}
swfobject = null
})
}
}();
return{registerObject: function (ab, X, aa, Z) {
if (M.w3 && ab && X) {
var Y = {};
Y.id = ab;
Y.swfVersion = X;
Y.expressInstall = aa;
Y.callbackFn = Z;
o[o.length] = Y;
w(ab, false)
} else {
if (Z) {
Z({success: false, id: ab})
}
}
}, getObjectById: function (X) {
if (M.w3) {
return z(X)
}
}, embedSWF: function (ab, ah, ae, ag, Y, aa, Z, ad, af, ac) {
var X = {success: false, id: ah};
if (M.w3 && !(M.wk && M.wk < 312) && ab && ah && ae && ag && Y) {
w(ah, false);
K(function () {
ae += "";
ag += "";
var aj = {};
if (af && typeof af === r) {
for (var al in af) {
aj[al] = af[al]
}
}
aj.data = ab;
aj.width = ae;
aj.height = ag;
var am = {};
if (ad && typeof ad === r) {
for (var ak in ad) {
am[ak] = ad[ak]
}
}
if (Z && typeof Z === r) {
for (var ai in Z) {
if (typeof am.flashvars != D) {
am.flashvars += "&" + ai + "=" + Z[ai]
} else {
am.flashvars = ai + "=" + Z[ai]
}
}
}
if (F(Y)) {
var an = u(aj, am, ah);
if (aj.id == ah) {
w(ah, true)
}
X.success = true;
X.ref = an
} else {
if (aa && A()) {
aj.data = aa;
P(aj, am, ah, ac);
return
} else {
w(ah, true)
}
}
if (ac) {
ac(X)
}
})
} else {
if (ac) {
ac(X)
}
}
}, switchOffAutoHideShow: function () {
m = false
}, ua: M, getFlashPlayerVersion: function () {
return{major: M.pv[0], minor: M.pv[1], release: M.pv[2]}
}, hasFlashPlayerVersion: F, createSWF: function (Z, Y, X) {
if (M.w3) {
return u(Z, Y, X)
} else {
return undefined
}
}, showExpressInstall: function (Z, aa, X, Y) {
if (M.w3 && A()) {
P(Z, aa, X, Y)
}
}, removeSWF: function (X) {
if (M.w3) {
y(X)
}
}, createCSS: function (aa, Z, Y, X) {
if (M.w3) {
v(aa, Z, Y, X)
}
}, addDomLoadEvent: K, addLoadEvent: s, getQueryParamValue: function (aa) {
var Z = j.location.search || j.location.hash;
if (Z) {
if (/\?/.test(Z)) {
Z = Z.split("?")[1]
}
if (aa == null) {
return L(Z)
}
var Y = Z.split("&");
for (var X = 0; X < Y.length; X++) {
if (Y[X].substring(0, Y[X].indexOf("=")) == aa) {
return L(Y[X].substring((Y[X].indexOf("=") + 1)))
}
}
}
return""
}, expressInstallCallback: function () {
if (a) {
var X = c(R);
if (X && l) {
X.parentNode.replaceChild(l, X);
if (Q) {
w(Q, true);
if (M.ie && M.win) {
l.style.display = "block"
}
}
if (E) {
E(B)
}
}
a = false
}
}}
}();
/** Util */
(function (window, undefined) {
var ufp = window.ufp = window.ufp || {};
var util = ufp.util = ufp.util || {};
var getNumRegx = /[\d][\d\.\_,\-]*/;
var splitNumRegx = /[\.\_,\-]/g;
util.getActiveXObject = getActiveXObject;
util.isDefined = isDefined;
util.isArray = isArray;
util.isFunc = isFunc;
util.isString = isString;
util.isNum = isNum;
util.isStrNum = isStrNum;
util.getNum = getNum;
util.formatNum = formatNum;
util.garbage = garbage;
util.getAXOByClsid = getAXOByClsid;
util.postData = postData;
util.wload = window.wload = wload;
//window.onload方法
function wload(c) {
wload.stack.push(c);
if (wload.isReady) {
return wload.run();
}
if (window.attachEvent) {
window.attachEvent("onload", wload.run); //对于IE
} else {
window.addEventListener("load", wload.run, false); //对于FireFox
}
}
wload.run = function () {
wload.isReady = true;
var f = wload.stack.shift();
while (typeof f == "function") {
// try{
f();
//}catch(e){};
f = wload.stack.shift();
}
};
wload.stack = [];
wload.isReady = false;
/**
* 得到一个ActiveX对象的实例
* @param objname activeX对象名
* @returns {Object} activeX对象
**/
function getActiveXObject(objname) {
var obj = null;
try {
obj = new window.ActiveXObject(objname);
} catch (e) {
}
return obj;
}
function isDefined(obj) {
return typeof obj != "undefined"
}
function isArray(obj) {
return (/array/i).test(Object.prototype.toString.call(obj))
}
function isFunc(obj) {
return typeof obj == "function"
}
function isString(obj) {
return typeof obj == "string"
}
function isNum(obj) {
return typeof obj == "number"
}
function isStrNum(obj) {
return (typeof obj == "string" && (/\d/).test(obj))
}
/**
* 得到字符串中的数字
* @param str 要匹配的字符串
* @param cReg 可选正则表达式,匹配指定模式的数字格式
* @returns {String} 数字字符串
*/
function getNum(str, cReg) {
var result = isStrNum(str) ?
(isDefined(cReg) ?
new RegExp(cReg) : getNumRegx)
.exec(str)
:
null;
return result ? result[0] : null
}
/**
* 格式化的数字字符串
* @param strNum 需要格式化的数字字符串
* @param capacity 几段,最大为4
* @returns {*}
* @example
* run:pluginDetector.formatNum('123-1-23,23,23',7)
" result:123,1,23,23"
*/
function formatNum(strNum, capacity) {
if (!isStrNum(strNum)) {
return null
}
if (!isNum(capacity)) {
capacity = 4
}
capacity--;
var arr = strNum.replace(/\s/g, "").split(splitNumRegx).concat(["0", "0", "0", "0"]);
for (var index = 0; index < 4; index++) {
if (/^(0+)(.+)$/.test(arr[index])) {
arr[index] = RegExp.$2
}
if (index > capacity || !(/\d/).test(arr[index])) {
arr[index] = "0"
}
}
return arr.slice(0, 4).join(",");
}
function garbage() {
if (!window.CollectGarbage || garbage['enable']) {
return;
}
garbage['enable'] = 1;
window.setTimeout(function () {
garbage['enable'] = 0;
window.CollectGarbage();
}, 1000);
}
function getAXOByClsid(clsid) {
clsid = clsid.replace('clsid:', '');
clsid = clsid.replace('{', '');
clsid = clsid.replace('}', '');
clsid = "clsid:" + clsid;
var span = document.createElement('span');
var html = '<' + 'object classid="' + clsid + '" ' + 'id="deployJavaPlugin" width="0" height="0">' + '<' + '/' + 'object' + '>';
var result = false;
span.innerHTML = html;
var x = null;
if (span.firstChild['object']) {
x = span.firstChild;
}
setTimeout(function () {
span.innerHTML = '';
garbage();
}, 1000);
return x;
}
function CreateXmlHttp() {
var xhrobj = false;
try {
xhrobj = new ActiveXObject("Msxml2.XMLHTTP"); //ie msxml3.0+
}
catch (e) {
try {
xhrobj = new ActiveXObject("Microsoft.XMLHTTP"); //ie msxml 2.6
} catch (e2) {
xhrobj = false;
}
}
if (!xhrobj && typeof XMLHttpRequest != 'undefined') { //firefox opera 8.0 safari
xhrobj = new XMLHttpRequest();
}
return xhrobj;
}
function postData(url, data, callback) {
var xhr = CreateXmlHttp();
xhr.open("POST", url, true);
//设置HTTP的输出内容类型为:application/x-www-form-urlencoded
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
//设置浏览器不使用缓存,服务器不从缓存中找,重新执行代码,而且服务器返回给浏览器的时候,告诉浏览器也不要保存缓存。
xhr.setRequestHeader("If-Modified-Since", "0");
//设置回调函数
if (typeof callback === "function") {
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
var res = xhr.responseText;
callback(res);
}
};
}
xhr.send(data);
}
})(window);
/**
*@description Store
*@import swfobject.js
*/
(function (window, undefined) {
window.Store = window.Store || {};
var doc = window.document;
//兼容性处理
var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB;
var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction;
var IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange;
var READ_ONLY = (IDBTransaction && IDBTransaction.READ_ONLY == 0) ? 0 : "readonly";
var READ_WRITE = (IDBTransaction && IDBTransaction.READ_WRITE) || "readwrite";
var VERSION_CHANGE = (IDBTransaction && IDBTransaction.VERSION_CHANGE) || "versionchange";
//兼容性处理,若不支持localStorage时再检测是否支持globalStorage可以代替的
var globalStorage = window.globalStorage && window.globalStorage[window.location.host];
var localStorage = window.localStorage || globalStorage;
// var flashCookieUrl = "http://simg.sinajs.cn/blog7swf/suppercookie.swf";
//http://www.w3.org/TR/IndexedDB/
//IndexedDB
var IndexedDBHelper = {
IDBKeyRange: IDBKeyRange,
TransactionType: {
READ_ONLY: READ_ONLY,
READ_WRITE: READ_WRITE,
VERSION_CHANGE: VERSION_CHANGE
},
indexedDB: indexedDB,
name: "db_defalut",
version: "1",
tbName: "tb_dufault",
db: null,
status: 0,
error: [],
async: true,
//indexedDB初始化处理
init: function (conf) {
var _ = this, request;
if (!indexedDB) {
_.status = -1;
return;
}
_.status = 2;
if (conf) {
conf.name ? _.name = conf.name : "";
conf.version ? _.version = conf.version : "";
conf.tbName ? _.tbName = conf.tbName : "";
}
request = indexedDB.open(_.name, _.version);
if (!request) {
_.status = -1;
return;
}
request.onupgradeneeded = function (event) {
_._initStore(event.target.transaction);
};
request.onsuccess = function (event) {
var db = event.target.result;
if (db.version != _.version) {
var svReq = db.setVersion(_.version);
svReq.onsuccess = function (event) {
_._initStore(event.target.transaction);
};
} else {
_.db = db;
_.status = 1;
}
};
request.onerror = _._cbError;
},
//通过记录的唯一key值获取value。
get: function (key, callback) {
var _ = this, tx, store, request;
tx = _.db.transaction(_.tbName, READ_ONLY);
store = tx.objectStore(_.tbName);
request = store.get(key);
request.onsuccess = function (event) {
callback(event.target.result);
};
request.onerror = function (event) {
callback(null, event);
};
},
//存储数据
set: function (key, value, callback) {
var _ = this, db = _.db, tx, store, request;
tx = db.transaction(_.tbName, READ_WRITE);
store = tx.objectStore(_.tbName);
request = store.put(value, key);
request.onsuccess = function (event) {
var matching = event.target.result;
(callback instanceof Function) ? callback(matching) : '';
};
request.onerror = function (event) {
(callback instanceof Function) ? callback(null, event) : '';
};
},
_initStore: function (tx) {
var _ = this, db = tx.db, store;
if (!db.objectStoreNames.contains(_.tbName)) {
store = db.createObjectStore(_.tbName);
// store.createIndex("index_key", "key", {unique: true});
}
tx.oncomplete = function (event) {
_.db = event.target.db;
_.status = 1;
};
tx.onerror = _._cbError;
tx.onabort = _._cbError;
},
_cbError: function (event) {
var _ = this, error = event.target.error,
errorMessage = error.name + ": " + error.message;
_.error.push([errorMessage, error]);
_.status = -2;
}
};
/**
*@FlashCookie
*属性方法:
*@flashUrl: flash地址
*@name: 存储数据库名,这里用作flash结点id
*@status: 状态标识 0 -- 未初始化状态;-1 -- 不支持不可用;-2 -- 初始化过程中不可用; 1 -- 支持且可用
*@db: flash对象
*@set: 存储更新数据。参数: key, value
*@get: 获取数据。 参数: key
*/
/*var LSOHelper = {
flashUrl: flashCookieUrl,
name: "flashCookie",
status: 0,
reTry: 100,
db: null,
init: function (conf) {
var _ = this,
conf = conf || {},
name = conf.name || _.name,
supperCookieSwfUrl = _.flashUrl,
targetId = name + 'swfcontiner',
id = name + 'swf',
tdom = doc.createElement("div");
if (_.db) return;
_.status = 2;
tdom.style.position = "absolute";
tdom.style.height = "1px";
tdom.style.width = "1px";
tdom.style.left = "1px";
tdom.style.top = (doc.body.scrollTop || doc.documentElement.scrollTop) + 'px';
tdom.style.zIndex = "9999";
doc.body.appendChild(tdom);
tdom.appendChild(doc.createElement("div"));
tdom.firstChild.id = targetId;
swfobject.embedSWF(
supperCookieSwfUrl,
targetId,
"1px",
"1px",
"10.0.0",
"",// "expressInstall.swf",
{
getSupperCookie: "getSupperCookie",
setSupperCookie: "setSupperCookie"
}, {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
bgcolor: "",
wmode: "direct" // can cause issues with FP settings & webcam
}, {
id: id
},
_._test
);
},
set: function (key, value) {
this.db.setSupperCookie(key, value);
},
get: function (key, callback) {
var result = this.db.getSupperCookie(key);
callback ? callback(result) : "";
return result;
},
_test: function (e) {
var _ = LSOHelper, flash = _.db;
_.reTry--;
if (e && e.success) {
flash = _.db = e.ref;
}
if (flash && flash.setSupperCookie && flash.getSupperCookie) {
flash.setSupperCookie("test_23", "wy_ok");
if (flash.getSupperCookie("test_23") == "wy_ok") {
_.status = 1;
} else {
_.status = -1;
}
} else {
_.reTry > 0 ? window.setTimeout(_._test, 10) : _.status = -1;
}
}
};*/
/**
*@userData 仅IE旧版本支持的本地数据存储方式
*属性方法:
*@status: 状态标识 0--未初始化 1--支持且可用 -1 -- 不支持
*@db: userData数据操作对象
*@set: 存储更新数据。参数: key, value
*@get: 获取数据。 参数: key
*@error: 初始化错误信息
*/
var UserDataHelper = {
name: "_default",
status: 0,
db: null,
error: null,
init: function (conf) {
try {
var _ = this, udEl = doc.createElement("div");
if (conf) {
conf.name ? _.name = conf.name : "";
}
udEl.id = _.name;
udEl.style.display = "none";
udEl.style.behavior = "url('#default#userData')";
doc.body.appendChild(udEl);
_.db = udEl;
_.set("test", "ok");
_.status = _.get("test") == "ok" ? 1 : -1;
} catch (e) {
_.error = e;
_.status = -1;
}
},
set: function (key, value) {
var _ = this.db;
_.load(_.name);
_.setAttribute(key, value);
_.save(_.name);
},
get: function (key, callback) {
var _ = this.db, result;
_.load(_.name);
result = _.getAttribute(key);
callback ? callback(result) : "";
return result;
}
};
var WebSQLHelper = {
name: "_default",
version: 1,
status: 0,
size: 1024,
tbName: "table_default",
db: null,
async: true,
init: function (conf) {
var _ = this, db;
if (!window.openDatabase) {
_.status = -1;
return;
}
_.status = 2;
if (conf) {
conf.name ? _.name = conf.name : "";
conf.version ? _.version = conf.version : "";
conf.size ? _.size = conf.size : "";
conf.tbName ? _.tbName = conf.tbName : "";
}
try {
db = window.openDatabase(_.name, "", "", _.size);
} catch (e) {
_.status = -1;
return;
}
db.transaction(function (t) {
t.executeSql('CREATE TABLE IF NOT EXISTS ' + _.tbName + ' (key unique, value)');
}, function (e) {
_.status = -1;
throw "SQLError:" + e.message;
});
_.db = db;
_.status = 1;
},
set: function (key, value) {
var _ = this, db = _.db;
db.transaction(function (t) {
t.executeSql('SELECT COUNT(*) c FROM ' + _.tbName + ' WHERE key = ?', [key], function (t, r) {
var sql = 'INSERT INTO ' + _.tbName + ' (value, key) VALUES(?, ?)';
if (r.rows.item(0).c > 0) {
sql = 'UPDATE ' + _.tbName + ' SET value = ? WHERE key = ?';
}
t.executeSql(sql, [value, key]);
});
});
},
get: function (key, callback) {
var _ = this, db = _.db;
db.readTransaction(function (t) {
t.executeSql('SELECT value FROM ' + _.tbName + ' WHERE key = ?', [key], function (t, r) {
r.rows.length > 0 ? callback(r.rows.item(0).value) : callback(null);
});
});
}
};
/**
*@Cookie 缓存
*属性方法:
*@status: 状态标识 -1--不支持 1--支持且可用
*@db: document对象
*@set: 存储更新数据。参数: key, value,time time为有效期长度的毫秒值(一秒就是1000)
*@get: 获取数据。 参数: key
*/
var CookieHelper = {
status: !!window.navigator.cookieEnabled / 1 || -1,
db: doc,
set: function (key, value, time) {
var defaultTime = 356 * 24 * 60 * 60 * 1000;
var time = new Date().valueOf() + (parseInt(time) || defaultTime);
document.cookie = key + "=" + value + ";expires=" + new Date(time).toGMTString();
},
get: function (key, callback) {
var reg = new RegExp("(^| )" + key + "=([^;]*)(;|$)"),
arr = document.cookie.match(reg),
result = arr && arr[2];
callback ? callback(result) : "";
return result;
}
};
//http://www.w3.org/TR/webstorage/
/**
*@LocalStorage 本地数据存储
*属性方法:
*@status: 状态标识 -1 -- 不支持 1 -- 支持且可用
*@db: Storage数据操作对象
*@set: 存储更新数据。参数: key, value
*@get: 获取数据。 参数: key
*/
var LocalStorageHelper = {
status: !!localStorage / 1 || -1,
db: localStorage,
set: function (key, value) {
localStorage.setItem(key, value);
},
get: function (key, callback) {
var result = localStorage.getItem(key);
callback ? callback(result) : "";
return result;
}
};
var storeDB = {
conf: {
name: "ufp",
version: 1,
tbName: "ufpInfo"
},
status: false,
stores: [
// [LSOHelper, 0],
[IndexedDBHelper, 0],
[WebSQLHelper, 0],
[UserDataHelper, 0],
[CookieHelper, 0],
[LocalStorageHelper, 0]
],
init: function () {
var stores = storeDB.stores, i, item, isTry, timer;
for (i = 0; i < stores.length; i++) {
item = stores[i][0];
if (item.status == 0) {
item.init(storeDB.conf);
}
}
//检测,等待所有的初始化都完成了才可用。
isTry = 100;
timer = window.setInterval(function () {
isTry--;
for (var i = 0; i < stores.length && isTry > 0; i++) {
if (stores[i][0].status == 0 || stores[i][0].status == 2) {
return;
}
stores[i][1] = stores[i][0].status;
}
storeDB.status = true;
window.clearInterval(timer);
}, 10);
},
set: function (key, value, time, callback) {
try {
if (storeDB.status) {
var stores = storeDB.stores, i = 0, item, newTime = new Date().valueOf();
for (; i < stores.length; i++) {
item = stores[i][0];
if (item.status == 1) {
item.set(key, value, time, callback);
}
}
} else {
window.setTimeout(function () {
storeDB.set(key, value, time, callback);
}, 10);
}
} catch (e) {
}
},
get: function (key, callback) {
if (storeDB.status) {
var stores = storeDB.stores, i = 0, item, _cb, results = [];
_cb = function (result) {
_cb.count--;
if (result) {
results.push(result);
}
};
_cb.count = 0;
for (; i < stores.length; i++) {
item = stores[i][0];
if (item.status == 1) {
_cb.count++;
item.get(key, _cb);
}
}
var timer = window.setInterval(function () {
var result;
if (_cb.count == 0) {
if (results.length > 0) {
result = results[0];
} else {
result = null;
}
callback(result);
window.clearInterval(timer);
}
}, 10);
} else {
window.setTimeout(function () {
storeDB.get(key, callback);
}, 10);
}
}
};
// storeDB.init();
window.Store.DB = storeDB;
window.Store.LocalStorageHelper = LocalStorageHelper;
window.Store.CookieHelper = CookieHelper;
window.Store.WebSQLHelper = WebSQLHelper;
window.Store.UserDataHelper = UserDataHelper;
// window.Store.LSOHelper = LSOHelper;
window.Store.IndexedDBHelper = IndexedDBHelper;
})(window);
/**
*@description fingerprint
*@import util.js, config.js, swfobject.js
*/
//@import util#
(function (window, undefined) {
var ufp = window.ufp = window.ufp || {};
var util = ufp.util;
var config = ufp.config;
var dciiiebc = config.Detectable_Components_in_Internet_Explorer_by_capclient;
var document = window.document;
var navigator = window.navigator;
//browser
var browser = ufp.browser = detect();
//platform
var OS = ufp.OS = detectPlatform();
//screen
ufp.screenInfo = getScreenInfo();
util.wload(function () {
//fonts onload
getFonts(function (str) {
ufp.fonts = str;
});
//plugins onload
ufp.plugins = getAllPlugin();
});
function detect() {
var browser = {}, userAgent = navigator.userAgent || "";
/**探测是不是ie***/
var tmp = document.documentMode;
try {
document.documentMode = ""
} catch (e) {
}
browser.isIE = util.isNum(document.documentMode) ? !0 : !1;
try {
document.documentMode = tmp
} catch (e) {
}
/**探测ie的真实版本号********/
browser.verIE = null;
if (browser.isIE) {
browser.verIE = document.documentMode || ((/^(?:.*?[^a-zA-Z])??(?:MSIE|rv\s*\:)\s*(\d+\.?\d*)/i).test(userAgent) ? parseFloat(RegExp.$1, 10) : 7)
}
if (!browser.isIE) {
var vendor = navigator.vendor || "",
product = navigator.product || "";
// todo 该列表有待更新,需收集国内浏览器数据
browser.isGecko = (/Gecko/i).test(product) && (/Gecko\s*\/\s*\d/i).test(userAgent);
browser.verGecko = browser.isGecko ? util.formatNum((/rv\s*\:\s*([\.\,\d]+)/i).test(userAgent) ? RegExp.$1 : "0.9") : null;
browser.isChrome = (/(Chrome|CriOS)\s*\/\s*(\d[\d\.]*)/i).test(userAgent);
browser.verChrome = browser.isChrome ? util.formatNum(RegExp.$2) : null;
browser.isSafari = !browser.isChrome && ((/Apple/i).test(vendor) || !vendor) && (/Safari\s*\/\s*(\d[\d\.]*)/i).test(userAgent);
browser.verSafari = browser.isSafari && (/Version\s*\/\s*(\d[\d\.]*)/i).test(userAgent) ? util.formatNum(RegExp.$1) : null;
browser.isOpera = (/Opera\s*[\/]?\s*(\d+\.?\d*)/i).test(userAgent);
browser.verOpera = browser.isOpera && ((/Version\s*\/\s*(\d+\.?\d*)/i).test(userAgent) || 1) ? parseFloat(RegExp.$1, 10) : null
}
//add browser name/version
if (browser.isIE) {
browser.name = 'IE';
browser.version = browser.verIE;
} else if (browser.isGecko) {
browser.name = 'Gecko';
browser.version = browser.verGecko;
} else if (browser.isChrome) {
browser.name = 'Chrome';
browser.version = browser.verChrome;
} else if (browser.isSafari) {
browser.name = 'Safari';
browser.version = browser.verSafari;
} else if (browser.isOpera) {
browser.name = 'Opera';
browser.version = browser.verOpera;
}
return browser;
}
function getFlashInfo() {
var info = {enable: false, version: getFlashVersion()};
// look for a flag in the query string to bypass flash detection
if (/hasFlash\=true/.test(location)) {
info.enable = true;
return info;
}
if (/hasFlash\=false/.test(location)) {
info.enable = false;
return info;
}
info.enable = util.formatNum(info.version.match(/\d+/g).join(",")) != '0,0,0,0';
return info;
}
function getFlashVersion() {
// ie
try {
try {
// avoid fp6 minor version lookup issues
// see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
try {
axo.AllowScriptAccess = 'always';
} catch (e) {
return '6,0,0,0';
}
} catch (e) {
}
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
// other browsers
} catch (e) {
try {
if (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
}
} catch (e) {
}
}
return '0,0,0,0';
}
/**
* @description 检测访问者的平台信息
* @return Config.platforms中匹配到的值
*/
function detectPlatform() {
var conf = config.platforms;
var OS = 999;
var platform = navigator.platform || "";
if (platform) {
//该列表有待数据收集后更新
for (var i = 0; i < conf.length; i++) {
if (conf[i] && new RegExp(conf[i][0], "i").test(platform)) {
return conf[i][1];
}
}
}
return OS;
}
function getScreenInfo() {
var sc = window.screen;
return sc.width + "*" + sc.height + "*" + sc.colorDepth;
}
/**
* @description 获取系统字体
* @param callback 返回函数,参数为字体名
* @example
getFonts(function( str ){
document.write( str );
});
*/
function getFonts(callback) {
var flashUrl = config.flashUrl_fonts;
var gtimes = 100;
function test(flashDom) {
gtimes--;
if ((typeof flashDom.getFonts) != 'undefined' || gtimes < 0) {
try {
fontsStr = flashDom.getFonts();
} catch (e) {
fontsStr = ''
}
callback(fontsStr);
} else {
setTimeout(function () {
test(flashDom)
}, 200);
}
}
loadFlash(flashUrl, test);
}
function loadFlash(url, callback, continerId) {
window.loadFlash_guid = window.loadFlash_guid || 1;
var flashvars = {};
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
wmode: "direct" // can cause issues with FP settings & webcam
};
var attributes = {
id: "swfid" + window.loadFlash_guid++
};
if (!continerId) {
continerId = attributes.id + 'continner';
var dom = document.createElement("div");
dom.style.position = "absolute";
dom.style.height = "1px";
dom.style.width = "1px";
dom.style.left = "1px";
dom.style.top = (document.body.scrollTop || document.documentElement.scrollTop) + 'px';
dom.style.zIndex = "9999";
document.body.appendChild(dom);
dom.appendChild(document.createElement("div"));
dom.firstChild.id = continerId;
}
swfobject.embedSWF(
url,
continerId, "1px", "1px", "10.0.0",
"expressInstall.swf",
flashvars, params, attributes);
var fdom;
function scflashOK() {
callback(fdom);
}
var dtimes = 100;
function detectSCflash() {
dtimes--;
fdom = document.getElementById(attributes.id);
if (fdom && (typeof fdom.GetVariable) != 'undefined') {
scflashOK();
} else {
if (dtimes > 0) {
setTimeout(detectSCflash, 100);
}
}
}
detectSCflash();
}
function initOClientCaps() {
if (initOClientCaps.cc) {
return initOClientCaps.cc;
}
if (initOClientCaps.init || !browser.isIE || OS != 1) {
return false
}
initOClientCaps.init = 1;
var div = document.createElement('div');
div.style.height = "1px";
div.style.width = "1px";
div.style.left = "1px";
div.style.top = "1px";
div.id = "oClientCaps";
div.position = "absolute";
div.style.behavior = "url('#default#clientcaps')";
//document.body.appendChild(div);
try {
//检测是否支持
div.getComponentVersion("{7790769C-0471-11D2-AF11-00C04FA35D02}", "ComponentID");
initOClientCaps.cc = div;
return div;
} catch (e) {
return null;
}
}
//getPluginVersionByClientCaps
function getPVBCC(clsid, oClientCaps) {
clsid = clsid.replace('clsid:', '');
clsid = clsid.replace('{:', '');
clsid = clsid.replace('}:', '');
/**
var obj = getAXOByClsid(clsid);
if(!obj)return '';
**/
var exist = false, p;
for (p in dciiiebc) {
if (dciiiebc[p] == clsid) {
exist = true;
break;
}
}
if (exist && oClientCaps) {
return oClientCaps.getComponentVersion('{' + clsid + '}', 'ComponentID') || '';
}
return '';
}
function getJavaInfo(oClientCaps) {
var javaEnabled = false, javaVersion;
if (oClientCaps) {
javaEnabled = oClientCaps.javaEnabled;
javaVersion = testForMSVM(oClientCaps);
}
javaVersion = javaVersion
|| getJavaVersionByMimetype()
|| getJavaPluginVersion()
|| getJvmsVersion();
javaEnabled = javaEnabled || !!javaVersion;
return {enable: javaEnabled, version: javaVersion};
}
function getJavaVersionByMimetype() {
var i = 0, s, m;
for (; i < navigator.mimeTypes.length; ++i) {
s = navigator.mimeTypes[i].type;
m = s.match(/^application\/x-java-applet;jpi-version=(.*)$/);
if (m) {
return m[1];
}
}
return "";
}
function getJavaPluginVersion() {
if ((!navigator.plugins) || (!navigator.plugins.length)) {
return false;
}
var platform = navigator.platform.toLowerCase(),
i = 0, str;
for (; i < navigator.plugins.length; ++i) {
str = navigator.plugins[i].description;
if (str.search(/\bJava\b/) != -1) {
/Plug-in ([\d,.]+)/.test(str);
return RegExp.$1 || '';
}
}
}
function testForMSVM(oClientCaps) {
var clsid = '08B0E5C0-4FCB-11CF-AAA5-00401C608500';
return getPVBCC(clsid, oClientCaps);
}
function getJvmsVersion() {
var span = document.createElement('span'),
html = '<' + 'object classid="clsid:CAFEEFAC-DEC7-0000-0000-ABCDEFFEDCBA" ' + 'id="deployJavaPlugin" width="0" height="0">' + '<' + '/' + 'object' + '>',
result = false, x = null, list, VMs, i = 0;
span.innerHTML = html;
if (span.firstChild['object']) {
list = [];
x = span.firstChild['object'];
VMs = x.jvms;
for (; i < VMs.getLength(); i++) {
list[i] = VMs.get(i).version;
}
result = list.join(',');
}
span.innerHTML = "";
util.garbage();
return result;
}
function getAllPlugin() {
var pgs = navigator.plugins, result = [], item, i, r;
var pluginConf = config.plugins;
//navigator get
if (pgs.length > 0) {
for (i = 0; i < pgs.length; i++) {
item = pgs[i];
result.push(item.description
+ "::"
+ item.filename
+ "::"
+ item.name);
}
//IE old version
} else if (browser.isIE) {
var oClientCaps = initOClientCaps();
var java = getJavaInfo(oClientCaps);
var flash = getFlashInfo();
result.push('Flash: '
+ flash.enable
+ ","
+ flash.version);
result.push('Java: '
+ java.enabled
+ ","
+ java.version);
//Object 检测
for (i in pluginConf) {
r = findPluginIe(i, pluginConf[i]);
if (r) {
result.push(i + ':1');
}
}
//clientCaps 检测
if (oClientCaps) {
for (i in dciiiebc) {
item = dciiiebc[i];
r = getPVBCC(item);
if (r) {
result.push(i + ':' + r);
}
}
}
}
return result.join("|");
}
function findPluginIe(pluginName, plugin) {
var pg = plugin || {};
var classID = pg['classid'] || '';
var type = pg['type'] || '';
var codebase = pg['codebase'] || '';
var version = pg['version'] || '';
var span = document.createElement('span');
var altHTML = "";
var param = '';
var tagB = '<object width="1" height="1" style="display:none;" ' + (codebase ? 'codebase=' + codebase + (version ? '#version=' + version : '') : '');
var tagE = ' classid="' + classID + '"'
+ ' type="' + type + '"'
+ '>'
+ param
+ '<'
+ "/object>";
var result = false;
span.innerHTML = tagB + altHTML + tagE;
if (span.firstChild['object']) {
x = span.firstChild['object'];
result = true;
}
span.innerHTML = "";
util.garbage();
return result;
}
})(window);
//main 执行入口
wload(function () {
var ufp = window.ufp;
var util = ufp.util;
var postUrl = ufp.config.fpPostInterface;
var sendUrl = ufp.config.fpCollectInterface;
Store.DB.init();//初始化存儲
var tid = {
key: 'tid',
value: '',
recover: 0,
confidence: '',
postInterface: postUrl,
fpCollectInterface: sendUrl,
callbackStack: [],
init: function () {
tid.get();
},
runstack: function () {
var f;
while (f = tid.callbackStack.pop()) {
f(tid.value, tid.recover, tid.confidence);
}
},
get: function (callback) {
callback = callback || function () {
};
tid.callbackStack.push(callback);
if (tid.value) {
return tid.runstack();
}
Store.DB.get(tid.key, function (v) {
if (!v) {
tid.getTidFromServer();
} else {
if (Store.CookieHelper.get(tid.key) != v) {
tid.recover = 1;
}
tid.value = v;
tid.confidence = "100";
if (/(.*)\_{2}(\d{3})$/.test(v)) {//check confidence
tid.value = RegExp.$1;
tid.confidence = RegExp.$2;
}
Store.DB.set(tid.key, v);
tid.runstack();
if (window.use_fp && tid.confidence == "100") {
tid.sendTidInfo();
}
}
});
},
getTidFromServer: function () {
tid.getTidFromServer = function () {
};
if (window.use_fp) {
getFp(function (data) {
util.postData(window.location.protocol + '//' + window.location.host + '/' + tid.postInterface, "cb=gen_callback&fp=" + encodeURIComponent(data), function (res) {
if (res) {
eval(res);
}
});
});
} else {
util.postData(window.location.protocol + '//' + window.location.host + '/' + tid.postInterface, "cb=gen_callback", function (res) {
if (res) {
eval(res);
}
});
}
},
sendTidInfo: function () {
tid.sendTidInfo = function () {
};
getFp(function (data) {
util.postData(window.location.protocol + '//' + window.location.host + '/' + tid.fpCollectInterface, "tid=" + encodeURIComponent(tid.value) + "&confidence=" + tid.confidence + "&fp=" + encodeURIComponent(data));
});
}
};
function getFp(callback) {
if (ufp.fonts || getFp.time > 300) {
var fp = {
os: ufp.OS,
browser: ufp.browser.name + ufp.browser.version,
fonts: ufp.fonts,
screenInfo: ufp.screenInfo,
plugins: ufp.plugins
};
var data = '{"os":"[os]","browser":"[browser]","fonts":"[fonts]","screenInfo":"[screenInfo]","plugins":"[plugins]"}';
for (var k in fp) {
data = data.replace(new RegExp("\\[" + k + "\\]", "g"), (fp[k] + "").replace(/['"]/g, "\\$&"));
}
callback(data);
} else {
getFp.time ? getFp.time++ : getFp.time = 1;
setTimeout(
(function (callback) {
return function () {
getFp(callback);
};
})(callback), 10);
}
}
window.gen_callback = function (fp) {
var value = false, confidence;
if (fp) {
if (fp.retcode == 20000000) {
confidence = typeof(fp.data.confidence) != 'undefined' ? '000' + fp.data.confidence : '100';
tid.recover = fp.data.new_tid ? 3 : 2;
tid.confidence = confidence = confidence.substring(confidence.length - 3);
value = fp.data.tid;
Store.DB.set(tid.key, value + '__' + confidence);
}
}
tid.value = value;
tid.runstack();
};
tid.init();
window.tid = tid;
});
function SSOController() {
var undefined;
var me = this;
var updateCookieTimer = null;
var updateCookieTimeHardLimit = 1800;
var cookieExpireTimeLength = 3600 * 24;
var crossDomainForward = null;
var crossDomainTimer = null;
var crossDomainTime = 3;
var autoLoginCallBack2 = null;
var ssoCrosssDomainUrl = "https://login.sina.com.cn/sso/crossdomain.php";
var ssoLoginUrl = "https://login.sina.com.cn/sso/login.php";
var ssoLogoutUrl = "https://login.sina.com.cn/sso/logout.php";
var ssoUpdateCookieUrl = "https://login.sina.com.cn/sso/updatetgt.php";
var ssoPreLoginUrl = "https://login.sina.com.cn/sso/prelogin.php";
var pincodeUrl = "https://login.sina.com.cn/cgi/pin.php";
var vfValidUrl = "http://weibo.com/sguide/vdun.php";
var generateVisitorUrl = "https://passport.weibo.com/visitor/visitor";
var crossDomainUrlList = null;
var loginMethod = "";
var ssoServerTimeTimer = null;
var ssoLoginTimer = null;
var loginByConfig = null;
var loginMethodCheck = null;
var https = 1;
var rsa = 2;
var wsse = 4;
var pcid = "";
var tmpData = {};
var preloginTimeStart = 0;
var preloginTime = 0;
var callbackLogoutStatus;
this.https = 1;
this.rsa = 2;
this.wsse = 4;
this.name = "sinaSSOController";
this.loginFormId = "ssoLoginForm";
this.scriptId = "ssoLoginScript";
this.ssoCrossDomainScriptId = "ssoCrossDomainScriptId";
this.loginFrameName = "ssoLoginFrame";
this.appLoginURL = {
"weibo.com": "https://passport.weibo.com/wbsso/login"
};
this.appDomainService = {
"weibo.com": "miniblog"
};
this.loginExtraQuery = {};
this.setDomain = false;
this.feedBackUrl = "";
this.service = "sso";
this.domain = "sina.com.cn";
this.from = "";
this.pageCharset = "GB2312";
this.useTicket = false;
this.isCheckLoginState = false;
this.isUpdateCookieOnLoad = true;
this.useIframe = true;
this.noActiveTime = 7200;
this.autoUpdateCookieTime = 1800;
this.loginType = rsa;
this.timeoutEnable = false;
this.loginTimeout = 5000;
this.crossDomain = true;
this.scriptLoginHttps = false;
this.allowAutoFoundServerTime = false;
this.allowAutoFoundServerTimeError = true;
this.calcServerTimeInterval = 2000;
this.servertime = null;
this.nonce = null;
this.rsaPubkey = null;
this.rsakv = null;
this.loginExtraFlag = {};
this.cdult = false;
this.crossDomainTime = 5;
this.failRedirect = false;
this.isGenerateVisitor = true;
this.generateVisitorProbability = 1;
this.generateVisitorDelay = 6;
this.generateVisitorDomain = ["^.*sina.com.cn$"];
this.getVersion = function() {
return "ssologin.js(v1.4.19) 2017-01-09"
};
this.getEntry = function() {
return me.entry
};
this.getClientType = function() {
return me.getVersion().split(" ")[0]
};
this.init = function() {
if (getType(arguments[0]) === "object") {
return customPrepare(arguments[0])
}
me.setLoginType(me.loginType);
var ssoConfig = window.sinaSSOConfig;
if (typeof ssoConfig != "object") {
ssoConfig = {}
}
var name;
for (name in ssoConfig) {
me[name] = ssoConfig[name]
}
if (!me.entry) {
me.entry = me.service
}
if (me.isUpdateCookieOnLoad) {
setTimeout(me.name + ".updateCookie()", 10000)
}
if (me.isGenerateVisitor) {
if (self === top && Math.random() < me.generateVisitorProbability && location.protocol !== "https:") {
setTimeout(me.name + ".generateVisitor()", me.generateVisitorDelay * 1000)
}
}
if (me.isCheckLoginState) {
addEventListener(window, "load", function() {
me.checkLoginState()
})
}
if (me.allowAutoFoundServerTime && ssoLoginServerTime) {
me.setServerTime(ssoLoginServerTime)
}
me.customInit()
};
this.getLoginInfo = function() {
var sso_info = getCookie("sso_info");
if (!sso_info) {
return {}
}
try {
return parse_str(sinaSSOEncoder.Cookie.decode(sso_info))
} catch (e) {
return {}
}
};
this.customInit = function() {};
this.customUpdateCookieCallBack = function(result) {};
this.customLoginCallBack = function(loginStatus) {};
this.customLogoutCallBack = function(result) {
me.customLoginCallBack({
result: false
})
};
var customLogin, customPrepare, customLogout;
(function() {
var $empty = function() {}, loginParam = {
username: "",
password: "",
savestate: 0,
vsnf: 0,
vsnval: "",
door: "",
setCookie: 1,
ssoSimpleLogin: 0,
onComplete: $empty,
onSuccess: $empty,
onFailure: $empty
}, logoutParam = {
onComplete: $empty,
onSuccess: $empty,
onFailure: $empty
}, hashExtra = {
vsnf: "vsnf",
vsnval: "vsnval",
door: "door",
setCookie: "s",
ssoSimpleLogin: "ssosimplelogin"
}, loginOptions = {}, logoutOptions = {};
var parseParam = function(original, spec) {
var key, param = {};
original = original || {};
spec = spec || {};
objMerge(param, original);
for (key in spec) {
if (original.hasOwnProperty(key)) {
param[key] = spec[key]
}
}
return param
};
var callback = function(options, name, loginStatus) {
if (typeof(options[name]) === "function") {
options[name](loginStatus)
}
};
this.callbackLoginStatus = function(loginStatus) {
me.customLoginCallBack(loginStatus);
callback(loginOptions, "onComplete", loginStatus);
if (loginStatus && loginStatus.result === true) {
callback(loginOptions, "onSuccess", loginStatus)
} else {
callback(loginOptions, "onFailure", loginStatus)
}
};
callbackLogoutStatus = function(logoutStatus) {
me.customLogoutCallBack(logoutStatus);
callback(logoutOptions, "onComplete", logoutStatus);
if (logoutStatus && logoutStatus.result === true) {
callback(logoutOptions, "onSuccess", logoutStatus)
} else {
callback(logoutOptions, "onFailure", logoutStatus)
}
};
customPrepare = function(spec) {
var key;
spec = spec || {};
loginOptions = objMerge({
entry: "sso",
useTicket: false,
service: "sso",
domain: "sina.com.cn",
feedBackUrl: "",
setDomain: false,
crossDomain: true,
name: "sinaSSOController"
}, loginParam);
loginOptions = parseParam(loginOptions, spec);
window[loginOptions.name] = window[loginOptions.name] || me;
for (key in loginOptions) {
if (!loginParam.hasOwnProperty(key)) {
me[key] = loginOptions[key]
}
}
me.loginExtraQuery = {};
objMerge(me.loginExtraQuery, loginOptions.loginExtraQuery);
for (key in hashExtra) {
if (loginOptions.hasOwnProperty(key)) {
me.loginExtraQuery[hashExtra[key]] = loginOptions[key]
}
}
};
customLogin = function(spec) {
spec = spec || {};
customPrepare(spec);
me.login(loginOptions.username, loginOptions.password, loginOptions.savestate)
};
customLogout = function(spec) {
spec = spec || {};
logoutOptions = objMerge({}, logoutParam);
logoutOptions = parseParam(logoutOptions, spec);
me.logout()
}
}).apply(this);
this.login = function(username, password, savestate) {
var qrcode_flag = arguments[3] ? arguments[3] : false;
if (getType(arguments[0]) === "object") {
return customLogin(arguments[0])
}
if (!ssoLoginTimer) {
ssoLoginTimer = new prototypeTimer(me.timeoutEnable)
} else {
ssoLoginTimer.clear()
}
ssoLoginTimer.start(me.loginTimeout, function() {
ssoLoginTimer.clear();
me.callbackLoginStatus({
result: false,
errno: -1,
reason: unescape("%u767B%u5F55%u8D85%u65F6%uFF0C%u8BF7%u91CD%u8BD5")
})
});
savestate = savestate == undefined ? 0 : savestate;
tmpData.savestate = savestate;
loginByConfig = function() {
if (!me.feedBackUrl && loginByXMLHttpRequest(username, password, savestate, qrcode_flag)) {
return true
}
if (me.useIframe && (me.setDomain || me.feedBackUrl)) {
if (me.setDomain) {
document.domain = me.domain;
if (!me.feedBackUrl && me.domain != "sina.com.cn") {
me.feedBackUrl = makeURL(me.appLoginURL[me.domain], {
domain: 1
})
}
}
loginMethod = "post";
var result = loginByIframe(username, password, savestate, qrcode_flag);
if (!result) {
loginMethod = "get";
if (me.scriptLoginHttps) {
me.setLoginType(me.loginType | https)
} else {
me.setLoginType(me.loginType | rsa)
}
loginByScript(username, password, savestate, qrcode_flag)
}
} else {
loginMethod = "get";
loginByScript(username, password, savestate, qrcode_flag)
}
me.nonce = null
};
loginMethodCheck = function() {
if ((me.loginType & wsse) || (me.loginType & rsa)) {
if (me.servertime) {
if (!me.nonce) {
me.nonce = makeNonce(6)
}
loginByConfig();
return true
}
me.getServerTime(username, loginByConfig)
} else {
loginByConfig()
}
};
loginMethodCheck();
return true
};
this.prelogin = function(config, callback) {
var url = ssoPreLoginUrl;
var username = config.username || "";
username = sinaSSOEncoder.base64.encode(urlencode(username));
delete config.username;
var arrQuery = {
entry: me.entry,
callback: me.name + ".preloginCallBack",
su: username,
rsakt: "mod"
};
url = makeURL(url, objMerge(arrQuery, config));
me.preloginCallBack = function(result) {
if (result && result.retcode == 0) {
me.setServerTime(result.servertime);
me.nonce = result.nonce;
me.rsaPubkey = result.pubkey;
me.rsakv = result.rsakv;
pcid = result.pcid;
preloginTime = (new Date()).getTime() - preloginTimeStart - (parseInt(result.exectime, 10) || 0)
}
if (typeof callback == "function") {
callback(result)
}
};
preloginTimeStart = (new Date()).getTime();
excuteScript(me.scriptId, url)
};
this.getServerTime = function(username, callback) {
if (me.servertime) {
if (typeof callback == "function") {
callback({
retcode: 0,
servertime: me.servertime
})
}
return true
}
me.prelogin({
username: username
}, callback)
};
this.logout = function() {
try {
if (getType(arguments[0]) === "object") {
return customLogout(arguments[0])
}
var request = {
entry: me.getEntry(),
callback: me.name + ".ssoLogoutCallBack"
};
try {
request.sr = window.screen.width + "*" + window.screen.height
} catch (e) {}
var url = makeURL(ssoLogoutUrl, request);
excuteScript(me.scriptId, url)
} catch (e) {}
return true
};
this.ssoLogoutCallBack = function(result) {
if (result.arrURL) {
me.setCrossDomainUrlList(result)
}
me.crossDomainAction("logout", function() {
callbackLogoutStatus({
result: true
})
})
};
this.updateCookie = function() {
try {
if (me.autoUpdateCookieTime > 5) {
if (updateCookieTimer != null) {
clearTimeout(updateCookieTimer)
}
updateCookieTimer = setTimeout(me.name + ".updateCookie()", me.autoUpdateCookieTime * 1000)
}
var cookieExpireTime = me.getCookieExpireTime();
var now = (new Date()).getTime() / 1000;
var result = {};
if (cookieExpireTime == null) {
result = {
retcode: 6102
}
} else {
if (cookieExpireTime < now) {
result = {
retcode: 6203
}
} else {
if (cookieExpireTime - cookieExpireTimeLength + updateCookieTimeHardLimit > now) {
result = {
retcode: 6110
}
} else {
if (cookieExpireTime - now > me.noActiveTime) {
result = {
retcode: 6111
}
}
}
}
}
if (result.retcode !== undefined) {
me.customUpdateCookieCallBack(result);
return false
}
var url = makeURL(ssoUpdateCookieUrl, {
entry: me.getEntry(),
callback: me.name + ".updateCookieCallBack"
});
excuteScript(me.scriptId, url)
} catch (e) {}
return true
};
this.setCrossDomainUrlList = function(urlList) {
crossDomainUrlList = urlList
};
this.checkAltLoginName = function() {
return true
};
this.callFeedBackUrl = function(loginStatus) {
try {
var request = {
callback: me.name + ".feedBackUrlCallBack"
};
if (loginStatus.ticket) {
request.ticket = loginStatus.ticket
}
if (loginStatus.retcode !== undefined) {
request.retcode = loginStatus.retcode
}
var url = makeURL(me.feedBackUrl, request);
excuteScript(me.scriptId, url)
} catch (e) {}
return true
};
this.loginCallBack = function(result) {
try {
if (me.timeoutEnable && !ssoLoginTimer.isset()) {
return
}
ssoLoginTimer.clear();
me.loginExtraFlag = {};
var loginStatus = {};
var st = result.ticket;
var uid = result.uid;
if (uid) {
loginStatus.result = true;
loginStatus.retcode = 0;
loginStatus.userinfo = {
uniqueid: result.uid
};
if (st) {
loginStatus.ticket = st
}
if (result.cookie) {
loginStatus.cookie = result.cookie
}
if (me.feedBackUrl) {
if (me.crossDomain) {
me.crossDomainAction("login", function() {
me.callFeedBackUrl(loginStatus)
})
} else {
me.callFeedBackUrl(loginStatus)
}
} else {
if (me.crossDomain) {
if (result.crossDomainUrlList) {
me.setCrossDomainUrlList({
retcode: 0,
arrURL: result.crossDomainUrlList
})
}
me.crossDomainAction("login", function() {
if (st && me.appLoginURL[me.domain]) {
me.appLogin(st, me.domain, me.name + ".callbackLoginStatus")
} else {
loginStatus.userinfo = objMerge(loginStatus.userinfo, me.getSinaCookie());
me.callbackLoginStatus(loginStatus)
}
})
} else {
me.callbackLoginStatus(loginStatus)
}
}
} else {
if (loginMethodCheck && result.retcode == "2092" && me.allowAutoFoundServerTimeError) {
me.setServerTime(0);
me.loginExtraFlag = objMerge(me.loginExtraFlag, {
wsseretry: "servertime_error"
});
loginMethodCheck();
loginMethodCheck = null;
return false
}
loginStatus.result = false;
loginStatus.errno = result.retcode;
if (loginStatus.errno == "4069") {
var reason = result.reason.split("|");
loginStatus.reason = reason[0];
if (reason.length == 2) {
loginStatus.rurl = reason[1]
}
if (loginStatus.rurl) {
try {
top.location.href = loginStatus.rurl;
return
} catch (e) {}
}
} else {
loginStatus.reason = result.reason
}
me.callbackLoginStatus(loginStatus)
}
} catch (e) {}
return true
};
this.updateCookieCallBack = function(result) {
if (result.retcode == 0) {
me.crossDomainAction("update", function() {
me.customUpdateCookieCallBack(result)
})
} else {
me.customUpdateCookieCallBack(result)
}
};
this.feedBackUrlCallBack = function(result) {
if (loginMethod == "post" && me.timeoutEnable && !ssoLoginTimer.isset()) {
return
}
if (result.errno == "2092") {
me.setServerTime(0)
}
if (loginMethodCheck && (result.errno == "2092") && me.allowAutoFoundServerTimeError) {
me.loginExtraFlag = objMerge(me.loginExtraFlag, {
wsseretry: "servertime_error"
});
loginMethodCheck();
loginMethodCheck = null;
return false
} else {
ssoLoginTimer && ssoLoginTimer.clear()
}
if (result.errno == "4069") {
var reason = result.reason.split("|");
result.reason = reason[0];
if (reason.length == 2) {
result.rurl = reason[1];
try {
top.location.href = result.rurl;
return
} catch (e) {}
}
}
me.callbackLoginStatus(result);
removeNode(me.loginFrameName)
};
this.doCrossDomainCallBack = function(result) {
me.crossDomainCounter++;
if (result) {
removeNode(result.scriptId)
}
if (me.crossDomainCounter == me.crossDomainCount) {
clearTimeout(crossDomainTimer);
me.crossDomainResult()
}
};
this.crossDomainCallBack = function(result) {
removeNode(me.ssoCrossDomainScriptId);
if (!result || result.retcode != 0) {
return false
}
var arrURL = result.arrURL;
var url, scriptId;
var request = {
callback: me.name + ".doCrossDomainCallBack"
};
me.crossDomainCount = arrURL.length;
me.crossDomainCounter = 0;
if (arrURL.length == 0) {
clearTimeout(crossDomainTimer);
me.crossDomainResult();
return true
}
for (var i = 0; i < arrURL.length; i++) {
url = arrURL[i];
scriptId = "ssoscript" + i;
request.scriptId = scriptId;
url = makeURL(url, request);
if (isSafari()) {
excuteIframe(scriptId, url)
} else {
excuteScript(scriptId, url)
}
}
};
this.crossDomainResult = function() {
crossDomainUrlList = null;
if (typeof crossDomainForward == "function") {
crossDomainForward()
}
};
this.crossDomainAction = function(action, callback) {
crossDomainTimer = setTimeout(me.name + ".crossDomainResult()", crossDomainTime * 1000);
if (typeof callback == "function") {
crossDomainForward = callback
} else {
crossDomainForward = null
}
if (crossDomainUrlList) {
me.crossDomainCallBack(crossDomainUrlList);
return false
}
var domain = me.domain;
if (action == "update") {
action = "login";
domain = "sina.com.cn"
}
var request = {
scriptId: me.ssoCrossDomainScriptId,
callback: me.name + ".crossDomainCallBack",
action: action,
domain: domain,
sr: window.screen.width + "*" + window.screen.height
};
var url = makeURL(ssoCrosssDomainUrl, request);
excuteScript(me.ssoCrossDomainScriptId, url)
};
this.checkLoginState = function(callback) {
if (callback) {
me.autoLogin(callback)
} else {
me.autoLogin(function(cookieinfo) {
var loginStatus = {};
if (cookieinfo !== null) {
var userinfo = {
displayname: cookieinfo.nick,
uniqueid: cookieinfo.uid,
userid: cookieinfo.user
};
loginStatus.result = true;
loginStatus.userinfo = userinfo
} else {
loginStatus.result = false;
loginStatus.reason = ""
}
me.callbackLoginStatus(loginStatus)
})
}
};
this.getCookieExpireTime = function() {
return getCookieExpireTimeByDomain(me.domain)
};
this.getSinaCookie = function(strict) {
var subp = getCookie("SUBP");
if (!subp) {
return null
}
var arrSubp = sinaSSOEncoder.getSUBPCookie.decode(subp);
try {
arrSubp.uid = arrSubp.uid.replace(/(^\s*)|(\s*$)/g, "");
arrSubp.nick = decodeURIComponent(arrSubp.nick.replace(/(^\s*)|(\s*$)/g, ""))
} catch (err) {
return null
}
return arrSubp
};
this.get51UCCookie = function() {
return me.getSinaCookie()
};
this.isPreLoginState = function() {
var subp = getCookie("SUBP");
if (!subp) {
return false
}
var subp_obj = sinaSSOEncoder.getSUBPCookie.decode(subp);
if (subp_obj && subp_obj.status == "40") {
return true
}
return false
};
this.isVisitor = function() {
var subp = getCookie("SUBP");
if (!subp) {
return false
}
var subp_obj = sinaSSOEncoder.getSUBPCookie.decode(subp);
if (subp_obj && subp_obj.status == "20") {
return true
}
return false
};
this.autoLogin = function(callback, strict) {
if (me.domain == "sina.com.cn") {
if (getCookie("SUBP") === null && getCookie("ALF") !== null) {
sinaAutoLogin(callback);
return true
}
} else {
if (getCookie("SUBP") === null && (strict || getCookie("SSOLoginState") !== null || getCookie("ALF") !== null)) {
sinaAutoLogin(callback);
return true
}
}
callback(me.getSinaCookie());
return true
};
this.autoLoginCallBack2 = function(result) {
try {
autoLoginCallBack2(me.getSinaCookie())
} catch (e) {}
return true
};
this.appLogin = function(ticket, domain, callback) {
var savestate = tmpData.savestate ? parseInt((new Date()).getTime() / 1000 + tmpData.savestate * 86400) : 0;
var alf = getCookie("ALF") ? getCookie("ALF") : 0;
var request = {
callback: callback,
ticket: ticket,
ssosavestate: savestate || alf
};
var appLoginURL = me.appLoginURL[domain];
var url = makeURL(appLoginURL, request);
excuteScript(me.scriptId, url, "gb2312");
return true
};
this.autoLoginCallBack3 = function(result) {
if (result.retcode != 0) {
me.autoLoginCallBack2(result);
return false
}
var domain = me.domain == "sina.com.cn" ? "weibo.com" : me.domain;
me.appLogin(result.ticket, domain, me.name + ".autoLoginCallBack2");
return true
};
this.setLoginType = function(loginType) {
var https = location.protocol == "https:" ? me.https : 0;
if (https) {
me.crossDomain = false
}
me.loginType = loginType | https;
return true
};
this.setServerTime = function(servertime) {
if (!ssoServerTimeTimer) {
ssoServerTimeTimer = new prototypeTimer(true)
}
if (servertime == 0) {
ssoServerTimeTimer.clear();
me.servertime = servertime;
return true
}
if (servertime < 1294935546) {
return false
}
var calcServerTime = function() {
if (me.servertime) {
me.servertime += me.calcServerTimeInterval / 1000;
ssoServerTimeTimer.start(me.calcServerTimeInterval, calcServerTime)
}
};
me.servertime = servertime;
ssoServerTimeTimer.start(me.calcServerTimeInterval, calcServerTime)
};
this.getPinCodeUrl = function(size) {
if (size == undefined) {
size = 0
}
if (pcid) {
me.loginExtraQuery.pcid = pcid
}
return pincodeUrl + "?r=" + Math.floor(Math.random() * 100000000) + "&s=" + size + (pcid.length > 0 ? "&p=" + pcid : "")
};
this.showPinCode = function(id) {
me.$(id).src = me.getPinCodeUrl()
};
this.isVfValid = function() {
return me.getSinaCookie(true)["vf"] != 1
};
this.getVfValidUrl = function() {
return vfValidUrl
};
this.enableFailRedirect = function() {
me.failRedirect = true
};
var makeNonce = function(len) {
var x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
var str = "";
for (var i = 0; i < len; i++) {
str += x.charAt(Math.ceil(Math.random() * 1000000) % x.length)
}
return str
};
var sinaAutoLogin = function(callback) {
autoLoginCallBack2 = callback;
var request = {
entry: me.getEntry(),
service: me.service,
encoding: "UTF-8",
gateway: 1,
returntype: "TEXT",
from: me.from
};
if (me.domain == "sina.com.cn") {
request.callback = me.name + ".autoLoginCallBack3";
request.service = "miniblog";
request.useticket = 1
} else {
request.callback = me.name + ".autoLoginCallBack3";
request.useticket = 1
}
var url = makeURL(ssoLoginUrl, request);
excuteScript(me.scriptId, url, "gb2312");
return true
};
var getCookieExpireTimeByDomain = function(domain) {
var expireTime = null;
var cookie = null;
cookie = me.getSinaCookie();
if (cookie) {
expireTime = cookie.et
}
return expireTime
};
var addEventListener = function(dom, eventName, fn) {
if (dom.addEventListener) {
dom.addEventListener(eventName, fn, false)
} else {
if (dom.attachEvent) {
dom.attachEvent("on" + eventName, fn)
} else {
dom["on" + eventName] = fn
}
}
};
var prototypeTimer = function(enable) {
var mytimer = false;
this.start = function(timeout, callback) {
if (enable) {
mytimer = setTimeout(callback, timeout)
}
};
this.clear = function(name) {
if (enable) {
clearTimeout(mytimer);
mytimer = false
}
};
this.isset = function() {
return mytimer !== false
}
};
var excuteScript = function(id, scriptSource, charset) {
removeNode(id);
var head = document.getElementsByTagName("head")[0];
var newScript = document.createElement("script");
newScript.charset = charset || "gb2312";
newScript.id = id;
newScript.type = "text/javascript";
newScript.src = makeURL(scriptSource, {
client: me.getClientType(),
_: (new Date()).getTime()
});
head.appendChild(newScript)
};
var excuteIframe = function(id, url) {
removeNode(id);
var bodyel = document.getElementsByTagName("body")[0];
var new_iframe = document.createElement("iframe");
new_iframe.style.display = "none";
new_iframe.src = makeURL(url, {
client: me.getClientType(),
_: (new Date()).getTime()
});
new_iframe.isReady = false;
addEventListener(new_iframe, "load", function() {
if (new_iframe.isReady) {
return
}
new_iframe.isReady = true;
me.doCrossDomainCallBack({
scriptId: id
})
});
bodyel.appendChild(new_iframe)
};
var makeRequest = function(username, password, savestate, qrcode_flag) {
var request = {
entry: me.getEntry(),
gateway: 1,
from: me.from,
savestate: savestate,
qrcode_flag: qrcode_flag,
useticket: me.useTicket ? 1 : 0
};
if (me.failRedirect) {
me.loginExtraQuery.frd = 1
}
request = objMerge(request, {
pagerefer: document.referrer || ""
});
request = objMerge(request, me.loginExtraFlag);
request = objMerge(request, me.loginExtraQuery);
request.su = sinaSSOEncoder.base64.encode(urlencode(username));
if (me.service) {
request.service = me.service
}
if ((me.loginType & rsa) && me.servertime && sinaSSOEncoder && sinaSSOEncoder.RSAKey) {
request.servertime = me.servertime;
request.nonce = me.nonce;
request.pwencode = "rsa2";
request.rsakv = me.rsakv;
var RSAKey = new sinaSSOEncoder.RSAKey();
RSAKey.setPublic(me.rsaPubkey, "10001");
password = RSAKey.encrypt([me.servertime, me.nonce].join("\t") + "\n" + password)
} else {
if ((me.loginType & wsse) && me.servertime && sinaSSOEncoder && sinaSSOEncoder.hex_sha1) {
request.servertime = me.servertime;
request.nonce = me.nonce;
request.pwencode = "wsse";
password = sinaSSOEncoder.hex_sha1("" + sinaSSOEncoder.hex_sha1(sinaSSOEncoder.hex_sha1(password)) + me.servertime + me.nonce)
}
}
request.sp = password;
try {
request.sr = window.screen.width + "*" + window.screen.height
} catch (e) {}
return request
};
var loginByXMLHttpRequest = function(username, password, savestate, qrcode_flag) {
if (typeof XMLHttpRequest == "undefined") {
return false
}
var xhr = new XMLHttpRequest();
if (!"withCredentials" in xhr) {
return false
}
var request = makeXMLRequestQuery(username, password, savestate, qrcode_flag);
var url = makeURL(ssoLoginUrl, {
client: me.getClientType(),
_: (new Date()).getTime()
});
try {
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.withCredentials = true;
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
me.loginCallBack(parseJSON(xhr.responseText))
}
};
xhr.send(httpBuildQuery(request))
} catch (e) {
return false
}
return true
};
var makeXMLRequestQuery = function(username, password, savestate, qrcode_flag) {
if (me.appLoginURL[me.domain]) {
me.useTicket = 1;
me.service = me.appDomainService[me.domain] || me.service
}
var cdult = 0;
if (me.domain) {
cdult = 2
}
if (!me.appLoginURL[me.domain]) {
cdult = 3
}
if (me.cdult !== false) {
cdult = me.cdult
}
if (cdult == 3) {
crossDomainTime = me.crossDomainTime;
delete me.appLoginURL[me.domain]
}
var request = makeRequest(username, password, savestate, qrcode_flag);
return objMerge(request, {
encoding: "UTF-8",
cdult: cdult,
domain: me.domain,
useticket: me.appLoginURL[me.domain] ? 1 : 0,
prelt: preloginTime,
returntype: "TEXT"
})
};
var loginByScript = function(username, password, savestate, qrcode_flag) {
var request = makeXMLRequestQuery(username, password, savestate, qrcode_flag);
request = objMerge(request, {
callback: me.name + ".loginCallBack"
});
var url = makeURL(ssoLoginUrl, request);
excuteScript(me.scriptId, url, "gb2312")
};
var loginByIframe = function(username, password, savestate, qrcode_flag) {
createIFrame(me.loginFrameName);
var loginForm = createForm(me.loginFormId);
var request = makeRequest(username, password, savestate, qrcode_flag);
request.encoding = "UTF-8";
if (me.crossDomain == false) {
request.crossdomain = 0
}
request.prelt = preloginTime;
if (me.feedBackUrl) {
request.url = makeURL(me.feedBackUrl, {
framelogin: 1,
callback: "parent." + me.name + ".feedBackUrlCallBack"
});
request.returntype = "META"
} else {
request.callback = "parent." + me.name + ".loginCallBack";
request.returntype = "IFRAME";
request.setdomain = me.setDomain ? 1 : 0
}
for (var key in me.loginExtraQuery) {
if (typeof me.loginExtraQuery[key] == "function") {
continue
}
request[key] = me.loginExtraQuery[key]
}
for (var name in request) {
loginForm.addInput(name, request[name])
}
var action = makeURL(ssoLoginUrl, objMerge({
client: me.getClientType()
}, me.loginExtraFlag));
loginForm.method = "post";
loginForm.action = action;
loginForm.target = me.loginFrameName;
var result = true;
try {
loginForm.submit()
} catch (e) {
removeNode(me.loginFrameName);
result = false
}
setTimeout(function() {
removeNode(loginForm)
}, 10);
return result
};
var createIFrame = function(frameName, src) {
if (src == null) {
src = "javascript:false;"
}
removeNode(frameName);
var frame = document.createElement("iframe");
frame.height = 0;
frame.width = 0;
frame.style.display = "none";
frame.name = frameName;
frame.id = frameName;
frame.src = src;
appendChild(document.body, frame);
window.frames[frameName].name = frameName;
return frame
};
var createForm = function(formName, display) {
if (display == null) {
display = "none"
}
removeNode(formName);
var form = document.createElement("form");
form.height = 0;
form.width = 0;
form.style.display = display;
form.name = formName;
form.id = formName;
appendChild(document.body, form);
document.forms[formName].name = formName;
form.addInput = function(name, value, type) {
if (type == null) {
type = "text"
}
var _name = this.getElementsByTagName("input")[name];
if (_name) {
this.removeChild(_name)
}
_name = document.createElement("input");
this.appendChild(_name);
_name.id = name;
_name.name = name;
_name.type = type;
_name.value = value
};
return form
};
var removeNode = function(el) {
try {
if (typeof(el) === "string") {
el = me.$(el)
}
el.parentNode.removeChild(el)
} catch (e) {}
};
var getType = function(item) {
if (typeof(item) === "undefined") {
return "undefined"
}
if (item === null) {
return "null"
}
return Object.prototype.toString.call(item).replace(/^\[object\s|\]$/gi, "").toLowerCase()
};
var isSafari = function() {
var browserName = navigator.userAgent.toLowerCase();
return ((/webkit/i).test(browserName) && !(/chrome/i).test(browserName))
};
var appendChild = function(parentObj, element) {
parentObj.appendChild(element)
};
var getCookie = function(name) {
var Res = (new RegExp(name + "=([^;]+)")).exec(document.cookie);
return Res == null ? null : Res[1]
};
var makeURL = function(url, request) {
return url + urlAndChar(url) + httpBuildQuery(request)
};
var urlAndChar = function(url) {
return (/\?/.test(url) ? "&" : "?")
};
var urlencode = function(str) {
return encodeURIComponent(str)
};
var urldecode = function(str) {
if (str == null) {
return ""
} else {
try {
return decodeURIComponent(str)
} catch (e) {
return ""
}
}
};
var httpBuildQuery = function(obj) {
if (typeof obj != "object") {
return ""
}
var arr = new Array();
for (var key in obj) {
if (typeof obj[key] == "function") {
continue
}
arr.push(key + "=" + urlencode(obj[key]))
}
return arr.join("&")
};
var parse_str = function(str) {
var arr = str.split("&");
var arrtmp;
var arrResult = {};
for (var i = 0; i < arr.length; i++) {
arrtmp = arr[i].split("=");
arrResult[arrtmp[0]] = urldecode(arrtmp[1])
}
return arrResult
};
var parseJSON = function(str) {
if (typeof(str) === "object") {
return str
} else {
if (window.JSON) {
return JSON.parse(str)
} else {
return eval("(" + str + ")")
}
}
};
var objMerge = function(obj1, obj2) {
for (var item in obj2) {
obj1[item] = obj2[item]
}
return obj1
};
this.$ = function(id) {
return document.getElementById(id)
};
this.generateVisitor = function() {
var reg, domainValid = false;
for (var i = 0; i < this.generateVisitorDomain.length; i++) {
reg = new RegExp(this.generateVisitorDomain[i]);
if (reg.test(document.domain)) {
domainValid = true;
break
}
}
if (!domainValid) {
return false
}
try {
if (me.shouldGenerateVisitor() && !me.$("visitorfrm84747h4784")) {
document.body.insertAdjacentHTML("beforeEnd", "<iframe id='visitorfrm84747h4784' style='position:absolute;left:0;top:0;border:none;width:1px;height:1px' src='" + generateVisitorUrl + "?from=iframe'/>");
setTimeout(function() {
try {
var ifr = me.$("visitorfrm84747h4784");
if (ifr) {
ifr.parentNode.removeChild(ifr)
}
} catch (e) {}
}, 1000 * 30)
}
} catch (e) {
return false
}
return true
};
this.shouldGenerateVisitor = function() {
var is_subp_exists = false;
var is_sup_exists = false;
var subp = getCookie("SUBP");
if (subp) {
is_subp_exists = true
}
var sup = getCookie("SUP");
if (sup) {
is_sup_exists = true
}
if (!is_subp_exists && !is_sup_exists) {
return true
}
return false
}
}
var sinaSSOEncoder = sinaSSOEncoder || {};
(function() {
var k = 0;
var h = 8;
this.hex_sha1 = function(l) {
return i(c(g(l), l.length * h))
};
var c = function(B, s) {
B[s >> 5] |= 128 << (24 - s % 32);
B[((s + 64 >> 9) << 4) + 15] = s;
var C = Array(80);
var A = 1732584193;
var z = -271733879;
var y = -1732584194;
var v = 271733878;
var u = -1009589776;
for (var p = 0; p < B.length; p += 16) {
var r = A;
var q = z;
var o = y;
var n = v;
var l = u;
for (var m = 0; m < 80; m++) {
if (m < 16) {
C[m] = B[p + m]
} else {
C[m] = e(C[m - 3] ^ C[m - 8] ^ C[m - 14] ^ C[m - 16], 1)
}
var D = f(f(e(A, 5), a(m, z, y, v)), f(f(u, C[m]), d(m)));
u = v;
v = y;
y = e(z, 30);
z = A;
A = D
}
A = f(A, r);
z = f(z, q);
y = f(y, o);
v = f(v, n);
u = f(u, l)
}
return Array(A, z, y, v, u)
};
var a = function(m, l, o, n) {
if (m < 20) {
return (l & o) | ((~l) & n)
}
if (m < 40) {
return l ^ o ^ n
}
if (m < 60) {
return (l & o) | (l & n) | (o & n)
}
return l ^ o ^ n
};
var d = function(l) {
return (l < 20) ? 1518500249 : (l < 40) ? 1859775393 : (l < 60) ? -1894007588 : -899497514
};
var f = function(l, o) {
var n = (l & 65535) + (o & 65535);
var m = (l >> 16) + (o >> 16) + (n >> 16);
return (m << 16) | (n & 65535)
};
var e = function(l, m) {
return (l << m) | (l >>> (32 - m))
};
var g = function(o) {
var n = Array();
var l = (1 << h) - 1;
for (var m = 0; m < o.length * h; m += h) {
n[m >> 5] |= (o.charCodeAt(m / h) & l) << (24 - m % 32)
}
return n
};
var i = function(n) {
var m = k ? "0123456789ABCDEF" : "0123456789abcdef";
var o = "";
for (var l = 0; l < n.length * 4; l++) {
o += m.charAt((n[l >> 2] >> ((3 - l % 4) * 8 + 4)) & 15) + m.charAt((n[l >> 2] >> ((3 - l % 4) * 8)) & 15)
}
return o
};
var j = function(l) {
var m = "",
n = 0;
for (; n < l.length; n++) {
m += "%" + b(l[n])
}
return decodeURIComponent(m)
};
var b = function(l) {
var m = "0" + l.toString(16);
return m.length <= 2 ? m : m.substr(1)
};
this.base64 = {
encode: function(n) {
n = "" + n;
if (n == "") {
return ""
}
var l = "";
var u, s, q = "";
var t, r, p, o = "";
var m = 0;
do {
u = n.charCodeAt(m++);
s = n.charCodeAt(m++);
q = n.charCodeAt(m++);
t = u >> 2;
r = ((u & 3) << 4) | (s >> 4);
p = ((s & 15) << 2) | (q >> 6);
o = q & 63;
if (isNaN(s)) {
p = o = 64
} else {
if (isNaN(q)) {
o = 64
}
}
l = l + this._keys.charAt(t) + this._keys.charAt(r) + this._keys.charAt(p) + this._keys.charAt(o);
u = s = q = "";
t = r = p = o = ""
} while (m < n.length);
return l
},
decode: function(t, q, m) {
var s = function(C, E) {
for (var D = 0; D < C.length; D++) {
if (C[D] === E) {
return D
}
}
return -1
};
if (typeof(t) == "string") {
t = t.split("")
}
var n = [];
var B, z, w = "";
var A, y, v, u = "";
if (t.length % 4 != 0) {}
var l = /[^A-Za-z0-9+\/=]/;
var x = this._keys.split("");
if (q == "urlsafe") {
l = /[^A-Za-z0-9-_=]/;
x = this._keys_urlsafe.split("")
}
if (q == "subp_v2") {
l = /[^A-Za-z0-9_=-]/;
x = this._subp_v2_keys.split("")
}
if (q == "subp_v3_3") {
l = /[^A-Za-z0-9-_.-]/;
x = this._subp_v3_keys_3.split("")
}
var p = 0;
if (q == "binnary") {
x = [];
for (p = 0; p <= 64; p++) {
x[p] = p + 128
}
}
if (q != "binnary" && l.test(t.join(""))) {
return m == "array" ? [] : ""
}
p = 0;
do {
A = s(x, t[p++]);
y = s(x, t[p++]);
v = s(x, t[p++]);
u = s(x, t[p++]);
B = (A << 2) | (y >> 4);
z = ((y & 15) << 4) | (v >> 2);
w = ((v & 3) << 6) | u;
n.push(B);
if (v != 64 && v != -1) {
n.push(z)
}
if (u != 64 && u != -1) {
n.push(w)
}
B = z = w = "";
A = y = v = u = ""
} while (p < t.length);
if (m == "array") {
return n
}
var r = "",
o = 0;
for (; o < n.lenth; o++) {
r += String.fromCharCode(n[o])
}
return r
},
_keys: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
_keys_urlsafe: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",
_subp_v2_keys: "uAL715W8e3jJCcNU0lT_FSXVgxpbEDdQ4vKaIOH2GBPtfzqsmYZo-wRM9i6hynrk=",
_subp_v3_keys_3: "5WFh28sGziZTeS1lBxCK-HgPq9IdMUwknybo.LJrQD3uj_Va7pE0XfcNR4AOYvm6t"
};
this.Cookie = {
decode: function(o) {
var n = [];
var m = o.substr(0, 3);
var l = o.substr(3);
switch (m) {
case "v01":
for (var p = 0; p < l.length; p += 2) {
n.push(parseInt(l.substr(p, 2), 16))
}
return decodeURIComponent(j(sinaSSOEncoder.base64.decode(n, "binnary", "array")));
break;
case "v02":
l = l.replace(/\./g, "=");
n = sinaSSOEncoder.base64.decode(l, "urlsafe", "array");
return j(sinaSSOEncoder.base64.decode(n, "binnary", "array"));
default:
return decodeURIComponent(o)
}
}
};
this.getSUBPCookie = {
__parse: function(o) {
var y, m, p, n, x, r = 0,
q, t = {}, l = "",
u = "";
if (!o) {
return t
}
do {
m = o[r];
y = ++r;
for (q = r; q < m + y; q++, r++) {
l += String.fromCharCode(o[q])
}
n = o[r];
y = ++r;
if (l == "status" || l == "flag") {
for (q = r; q < n + y; q++, r++) {
u += o[q]
}
} else {
u = o.slice(y, n + y);
try {
u = j(u)
} catch (w) {
u = ""
}
r += n
}
t[l] = u;
l = "";
u = ""
} while (r < o.length);
return t
},
decode: function(o) {
var n = [],
p, m = o.substr(0, 3),
l = decodeURIComponent(o.substr(3));
switch (m) {
case "002":
n = sinaSSOEncoder.base64.decode(l, "subp_v2", "array");
return sinaSSOEncoder.getSUBPCookie.__parse(n);
case "003":
p = l.substr(0, 1);
l = l.substr(1);
n = sinaSSOEncoder.base64.decode(l, "subp_v3_" + p, "array");
return sinaSSOEncoder.getSUBPCookie.__parse(n);
default:
return decodeURIComponent(o)
}
}
}
}).call(sinaSSOEncoder);
(function() {
var av;
var ah = 244837814094590;
var Y = ((ah & 16777215) == 15715070);
function aq(z, t, az) {
if (z != null) {
if ("number" == typeof z) {
this.fromNumber(z, t, az)
} else {
if (t == null && "string" != typeof z) {
this.fromString(z, 256)
} else {
this.fromString(z, t)
}
}
}
}
function h() {
return new aq(null)
}
function b(aB, t, z, aA, aD, aC) {
while (--aC >= 0) {
var az = t * this[aB++] + z[aA] + aD;
aD = Math.floor(az / 67108864);
z[aA++] = az & 67108863
}
return aD
}
function ax(aB, aG, aH, aA, aE, t) {
var aD = aG & 32767,
aF = aG >> 15;
while (--t >= 0) {
var az = this[aB] & 32767;
var aC = this[aB++] >> 15;
var z = aF * az + aC * aD;
az = aD * az + ((z & 32767) << 15) + aH[aA] + (aE & 1073741823);
aE = (az >>> 30) + (z >>> 15) + aF * aC + (aE >>> 30);
aH[aA++] = az & 1073741823
}
return aE
}
function aw(aB, aG, aH, aA, aE, t) {
var aD = aG & 16383,
aF = aG >> 14;
while (--t >= 0) {
var az = this[aB] & 16383;
var aC = this[aB++] >> 14;
var z = aF * az + aC * aD;
az = aD * az + ((z & 16383) << 14) + aH[aA] + aE;
aE = (az >> 28) + (z >> 14) + aF * aC;
aH[aA++] = az & 268435455
}
return aE
}
if (Y && (navigator.appName == "Microsoft Internet Explorer")) {
aq.prototype.am = ax;
av = 30
} else {
if (Y && (navigator.appName != "Netscape")) {
aq.prototype.am = b;
av = 26
} else {
aq.prototype.am = aw;
av = 28
}
}
aq.prototype.DB = av;
aq.prototype.DM = ((1 << av) - 1);
aq.prototype.DV = (1 << av);
var Z = 52;
aq.prototype.FV = Math.pow(2, Z);
aq.prototype.F1 = Z - av;
aq.prototype.F2 = 2 * av - Z;
var ad = "0123456789abcdefghijklmnopqrstuvwxyz";
var af = new Array();
var ao, v;
ao = "0".charCodeAt(0);
for (v = 0; v <= 9; ++v) {
af[ao++] = v
}
ao = "a".charCodeAt(0);
for (v = 10; v < 36; ++v) {
af[ao++] = v
}
ao = "A".charCodeAt(0);
for (v = 10; v < 36; ++v) {
af[ao++] = v
}
function ay(t) {
return ad.charAt(t)
}
function A(z, t) {
var az = af[z.charCodeAt(t)];
return (az == null) ? -1 : az
}
function X(z) {
for (var t = this.t - 1; t >= 0; --t) {
z[t] = this[t]
}
z.t = this.t;
z.s = this.s
}
function n(t) {
this.t = 1;
this.s = (t < 0) ? -1 : 0;
if (t > 0) {
this[0] = t
} else {
if (t < -1) {
this[0] = t + DV
} else {
this.t = 0
}
}
}
function c(t) {
var z = h();
z.fromInt(t);
return z
}
function w(aD, z) {
var aA;
if (z == 16) {
aA = 4
} else {
if (z == 8) {
aA = 3
} else {
if (z == 256) {
aA = 8
} else {
if (z == 2) {
aA = 1
} else {
if (z == 32) {
aA = 5
} else {
if (z == 4) {
aA = 2
} else {
this.fromRadix(aD, z);
return
}
}
}
}
}
}
this.t = 0;
this.s = 0;
var aC = aD.length,
az = false,
aB = 0;
while (--aC >= 0) {
var t = (aA == 8) ? aD[aC] & 255 : A(aD, aC);
if (t < 0) {
if (aD.charAt(aC) == "-") {
az = true
}
continue
}
az = false;
if (aB == 0) {
this[this.t++] = t
} else {
if (aB + aA > this.DB) {
this[this.t - 1] |= (t & ((1 << (this.DB - aB)) - 1)) << aB;
this[this.t++] = (t >> (this.DB - aB))
} else {
this[this.t - 1] |= t << aB
}
}
aB += aA;
if (aB >= this.DB) {
aB -= this.DB
}
}
if (aA == 8 && (aD[0] & 128) != 0) {
this.s = -1;
if (aB > 0) {
this[this.t - 1] |= ((1 << (this.DB - aB)) - 1) << aB
}
}
this.clamp();
if (az) {
aq.ZERO.subTo(this, this)
}
}
function O() {
var t = this.s & this.DM;
while (this.t > 0 && this[this.t - 1] == t) {
--this.t
}
}
function q(z) {
if (this.s < 0) {
return "-" + this.negate().toString(z)
}
var az;
if (z == 16) {
az = 4
} else {
if (z == 8) {
az = 3
} else {
if (z == 2) {
az = 1
} else {
if (z == 32) {
az = 5
} else {
if (z == 4) {
az = 2
} else {
return this.toRadix(z)
}
}
}
}
}
var aB = (1 << az) - 1,
aE, t = false,
aC = "",
aA = this.t;
var aD = this.DB - (aA * this.DB) % az;
if (aA-- > 0) {
if (aD < this.DB && (aE = this[aA] >> aD) > 0) {
t = true;
aC = ay(aE)
}
while (aA >= 0) {
if (aD < az) {
aE = (this[aA] & ((1 << aD) - 1)) << (az - aD);
aE |= this[--aA] >> (aD += this.DB - az)
} else {
aE = (this[aA] >> (aD -= az)) & aB;
if (aD <= 0) {
aD += this.DB;
--aA
}
}
if (aE > 0) {
t = true
}
if (t) {
aC += ay(aE)
}
}
}
return t ? aC : "0"
}
function R() {
var t = h();
aq.ZERO.subTo(this, t);
return t
}
function ak() {
return (this.s < 0) ? this.negate() : this
}
function G(t) {
var az = this.s - t.s;
if (az != 0) {
return az
}
var z = this.t;
az = z - t.t;
if (az != 0) {
return az
}
while (--z >= 0) {
if ((az = this[z] - t[z]) != 0) {
return az
}
}
return 0
}
function j(z) {
var aA = 1,
az;
if ((az = z >>> 16) != 0) {
z = az;
aA += 16
}
if ((az = z >> 8) != 0) {
z = az;
aA += 8
}
if ((az = z >> 4) != 0) {
z = az;
aA += 4
}
if ((az = z >> 2) != 0) {
z = az;
aA += 2
}
if ((az = z >> 1) != 0) {
z = az;
aA += 1
}
return aA
}
function u() {
if (this.t <= 0) {
return 0
}
return this.DB * (this.t - 1) + j(this[this.t - 1] ^ (this.s & this.DM))
}
function ap(az, z) {
var t;
for (t = this.t - 1; t >= 0; --t) {
z[t + az] = this[t]
}
for (t = az - 1; t >= 0; --t) {
z[t] = 0
}
z.t = this.t + az;
z.s = this.s
}
function W(az, z) {
for (var t = az; t < this.t; ++t) {
z[t - az] = this[t]
}
z.t = Math.max(this.t - az, 0);
z.s = this.s
}
function s(aE, aA) {
var z = aE % this.DB;
var t = this.DB - z;
var aC = (1 << t) - 1;
var aB = Math.floor(aE / this.DB),
aD = (this.s << z) & this.DM,
az;
for (az = this.t - 1; az >= 0; --az) {
aA[az + aB + 1] = (this[az] >> t) | aD;
aD = (this[az] & aC) << z
}
for (az = aB - 1; az >= 0; --az) {
aA[az] = 0
}
aA[aB] = aD;
aA.t = this.t + aB + 1;
aA.s = this.s;
aA.clamp()
}
function l(aD, aA) {
aA.s = this.s;
var aB = Math.floor(aD / this.DB);
if (aB >= this.t) {
aA.t = 0;
return
}
var z = aD % this.DB;
var t = this.DB - z;
var aC = (1 << z) - 1;
aA[0] = this[aB] >> z;
for (var az = aB + 1; az < this.t; ++az) {
aA[az - aB - 1] |= (this[az] & aC) << t;
aA[az - aB] = this[az] >> z
}
if (z > 0) {
aA[this.t - aB - 1] |= (this.s & aC) << t
}
aA.t = this.t - aB;
aA.clamp()
}
function aa(z, aA) {
var az = 0,
aB = 0,
t = Math.min(z.t, this.t);
while (az < t) {
aB += this[az] - z[az];
aA[az++] = aB & this.DM;
aB >>= this.DB
}
if (z.t < this.t) {
aB -= z.s;
while (az < this.t) {
aB += this[az];
aA[az++] = aB & this.DM;
aB >>= this.DB
}
aB += this.s
} else {
aB += this.s;
while (az < z.t) {
aB -= z[az];
aA[az++] = aB & this.DM;
aB >>= this.DB
}
aB -= z.s
}
aA.s = (aB < 0) ? -1 : 0;
if (aB < -1) {
aA[az++] = this.DV + aB
} else {
if (aB > 0) {
aA[az++] = aB
}
}
aA.t = az;
aA.clamp()
}
function D(z, aA) {
var t = this.abs(),
aB = z.abs();
var az = t.t;
aA.t = az + aB.t;
while (--az >= 0) {
aA[az] = 0
}
for (az = 0; az < aB.t; ++az) {
aA[az + t.t] = t.am(0, aB[az], aA, az, 0, t.t)
}
aA.s = 0;
aA.clamp();
if (this.s != z.s) {
aq.ZERO.subTo(aA, aA)
}
}
function Q(az) {
var t = this.abs();
var z = az.t = 2 * t.t;
while (--z >= 0) {
az[z] = 0
}
for (z = 0; z < t.t - 1; ++z) {
var aA = t.am(z, t[z], az, 2 * z, 0, 1);
if ((az[z + t.t] += t.am(z + 1, 2 * t[z], az, 2 * z + 1, aA, t.t - z - 1)) >= t.DV) {
az[z + t.t] -= t.DV;
az[z + t.t + 1] = 1
}
}
if (az.t > 0) {
az[az.t - 1] += t.am(z, t[z], az, 2 * z, 0, 1)
}
az.s = 0;
az.clamp()
}
function E(aH, aE, aD) {
var aN = aH.abs();
if (aN.t <= 0) {
return
}
var aF = this.abs();
if (aF.t < aN.t) {
if (aE != null) {
aE.fromInt(0)
}
if (aD != null) {
this.copyTo(aD)
}
return
}
if (aD == null) {
aD = h()
}
var aB = h(),
z = this.s,
aG = aH.s;
var aM = this.DB - j(aN[aN.t - 1]);
if (aM > 0) {
aN.lShiftTo(aM, aB);
aF.lShiftTo(aM, aD)
} else {
aN.copyTo(aB);
aF.copyTo(aD)
}
var aJ = aB.t;
var az = aB[aJ - 1];
if (az == 0) {
return
}
var aI = az * (1 << this.F1) + ((aJ > 1) ? aB[aJ - 2] >> this.F2 : 0);
var aQ = this.FV / aI,
aP = (1 << this.F1) / aI,
aO = 1 << this.F2;
var aL = aD.t,
aK = aL - aJ,
aC = (aE == null) ? h() : aE;
aB.dlShiftTo(aK, aC);
if (aD.compareTo(aC) >= 0) {
aD[aD.t++] = 1;
aD.subTo(aC, aD)
}
aq.ONE.dlShiftTo(aJ, aC);
aC.subTo(aB, aB);
while (aB.t < aJ) {
aB[aB.t++] = 0
}
while (--aK >= 0) {
var aA = (aD[--aL] == az) ? this.DM : Math.floor(aD[aL] * aQ + (aD[aL - 1] + aO) * aP);
if ((aD[aL] += aB.am(0, aA, aD, aK, 0, aJ)) < aA) {
aB.dlShiftTo(aK, aC);
aD.subTo(aC, aD);
while (aD[aL] < --aA) {
aD.subTo(aC, aD)
}
}
}
if (aE != null) {
aD.drShiftTo(aJ, aE);
if (z != aG) {
aq.ZERO.subTo(aE, aE)
}
}
aD.t = aJ;
aD.clamp();
if (aM > 0) {
aD.rShiftTo(aM, aD)
}
if (z < 0) {
aq.ZERO.subTo(aD, aD)
}
}
function N(t) {
var z = h();
this.abs().divRemTo(t, null, z);
if (this.s < 0 && z.compareTo(aq.ZERO) > 0) {
t.subTo(z, z)
}
return z
}
function K(t) {
this.m = t
}
function U(t) {
if (t.s < 0 || t.compareTo(this.m) >= 0) {
return t.mod(this.m)
} else {
return t
}
}
function aj(t) {
return t
}
function J(t) {
t.divRemTo(this.m, null, t)
}
function H(t, az, z) {
t.multiplyTo(az, z);
this.reduce(z)
}
function at(t, z) {
t.squareTo(z);
this.reduce(z)
}
K.prototype.convert = U;
K.prototype.revert = aj;
K.prototype.reduce = J;
K.prototype.mulTo = H;
K.prototype.sqrTo = at;
function B() {
if (this.t < 1) {
return 0
}
var t = this[0];
if ((t & 1) == 0) {
return 0
}
var z = t & 3;
z = (z * (2 - (t & 15) * z)) & 15;
z = (z * (2 - (t & 255) * z)) & 255;
z = (z * (2 - (((t & 65535) * z) & 65535))) & 65535;
z = (z * (2 - t * z % this.DV)) % this.DV;
return (z > 0) ? this.DV - z : -z
}
function f(t) {
this.m = t;
this.mp = t.invDigit();
this.mpl = this.mp & 32767;
this.mph = this.mp >> 15;
this.um = (1 << (t.DB - 15)) - 1;
this.mt2 = 2 * t.t
}
function ai(t) {
var z = h();
t.abs().dlShiftTo(this.m.t, z);
z.divRemTo(this.m, null, z);
if (t.s < 0 && z.compareTo(aq.ZERO) > 0) {
this.m.subTo(z, z)
}
return z
}
function ar(t) {
var z = h();
t.copyTo(z);
this.reduce(z);
return z
}
function P(t) {
while (t.t <= this.mt2) {
t[t.t++] = 0
}
for (var az = 0; az < this.m.t; ++az) {
var z = t[az] & 32767;
var aA = (z * this.mpl + (((z * this.mph + (t[az] >> 15) * this.mpl) & this.um) << 15)) & t.DM;
z = az + this.m.t;
t[z] += this.m.am(0, aA, t, az, 0, this.m.t);
while (t[z] >= t.DV) {
t[z] -= t.DV;
t[++z]++
}
}
t.clamp();
t.drShiftTo(this.m.t, t);
if (t.compareTo(this.m) >= 0) {
t.subTo(this.m, t)
}
}
function al(t, z) {
t.squareTo(z);
this.reduce(z)
}
function y(t, az, z) {
t.multiplyTo(az, z);
this.reduce(z)
}
f.prototype.convert = ai;
f.prototype.revert = ar;
f.prototype.reduce = P;
f.prototype.mulTo = y;
f.prototype.sqrTo = al;
function i() {
return ((this.t > 0) ? (this[0] & 1) : this.s) == 0
}
function x(aE, aF) {
if (aE > 4294967295 || aE < 1) {
return aq.ONE
}
var aD = h(),
az = h(),
aC = aF.convert(this),
aB = j(aE) - 1;
aC.copyTo(aD);
while (--aB >= 0) {
aF.sqrTo(aD, az);
if ((aE & (1 << aB)) > 0) {
aF.mulTo(az, aC, aD)
} else {
var aA = aD;
aD = az;
az = aA
}
}
return aF.revert(aD)
}
function am(az, t) {
var aA;
if (az < 256 || t.isEven()) {
aA = new K(t)
} else {
aA = new f(t)
}
return this.exp(az, aA)
}
aq.prototype.copyTo = X;
aq.prototype.fromInt = n;
aq.prototype.fromString = w;
aq.prototype.clamp = O;
aq.prototype.dlShiftTo = ap;
aq.prototype.drShiftTo = W;
aq.prototype.lShiftTo = s;
aq.prototype.rShiftTo = l;
aq.prototype.subTo = aa;
aq.prototype.multiplyTo = D;
aq.prototype.squareTo = Q;
aq.prototype.divRemTo = E;
aq.prototype.invDigit = B;
aq.prototype.isEven = i;
aq.prototype.exp = x;
aq.prototype.toString = q;
aq.prototype.negate = R;
aq.prototype.abs = ak;
aq.prototype.compareTo = G;
aq.prototype.bitLength = u;
aq.prototype.mod = N;
aq.prototype.modPowInt = am;
aq.ZERO = c(0);
aq.ONE = c(1);
function k() {
this.i = 0;
this.j = 0;
this.S = new Array()
}
function e(aB) {
var aA, z, az;
for (aA = 0; aA < 256; ++aA) {
this.S[aA] = aA
}
z = 0;
for (aA = 0; aA < 256; ++aA) {
z = (z + this.S[aA] + aB[aA % aB.length]) & 255;
az = this.S[aA];
this.S[aA] = this.S[z];
this.S[z] = az
}
this.i = 0;
this.j = 0
}
function a() {
var z;
this.i = (this.i + 1) & 255;
this.j = (this.j + this.S[this.i]) & 255;
z = this.S[this.i];
this.S[this.i] = this.S[this.j];
this.S[this.j] = z;
return this.S[(z + this.S[this.i]) & 255]
}
k.prototype.init = e;
k.prototype.next = a;
function an() {
return new k()
}
var M = 256;
var m;
var T;
var ab;
function d(t) {
T[ab++] ^= t & 255;
T[ab++] ^= (t >> 8) & 255;
T[ab++] ^= (t >> 16) & 255;
T[ab++] ^= (t >> 24) & 255;
if (ab >= M) {
ab -= M
}
}
function S() {
d(new Date().getTime())
}
if (T == null) {
T = new Array();
ab = 0;
var I;
if (navigator.appName == "Netscape" && navigator.appVersion < "5" && window.crypto && typeof(window.crypto.random) === "function") {
var F = window.crypto.random(32);
for (I = 0; I < F.length; ++I) {
T[ab++] = F.charCodeAt(I) & 255
}
}
while (ab < M) {
I = Math.floor(65536 * Math.random());
T[ab++] = I >>> 8;
T[ab++] = I & 255
}
ab = 0;
S()
}
function C() {
if (m == null) {
S();
m = an();
m.init(T);
for (ab = 0; ab < T.length; ++ab) {
T[ab] = 0
}
ab = 0
}
return m.next()
}
function au(z) {
var t;
for (t = 0; t < z.length; ++t) {
z[t] = C()
}
}
function ac() {}
ac.prototype.nextBytes = au;
function g(z, t) {
return new aq(z, t)
}
function ag(az, aA) {
var t = "";
var z = 0;
while (z + aA < az.length) {
t += az.substring(z, z + aA) + "\n";
z += aA
}
return t + az.substring(z, az.length)
}
function r(t) {
if (t < 16) {
return "0" + t.toString(16)
} else {
return t.toString(16)
}
}
function ae(aA, aD) {
if (aD < aA.length + 11) {
alert("Message too long for RSA");
return null
}
var aC = new Array();
var az = aA.length - 1;
while (az >= 0 && aD > 0) {
var aB = aA.charCodeAt(az--);
if (aB < 128) {
aC[--aD] = aB
} else {
if ((aB > 127) && (aB < 2048)) {
aC[--aD] = (aB & 63) | 128;
aC[--aD] = (aB >> 6) | 192
} else {
aC[--aD] = (aB & 63) | 128;
aC[--aD] = ((aB >> 6) & 63) | 128;
aC[--aD] = (aB >> 12) | 224
}
}
}
aC[--aD] = 0;
var z = new ac();
var t = new Array();
while (aD > 2) {
t[0] = 0;
while (t[0] == 0) {
z.nextBytes(t)
}
aC[--aD] = t[0]
}
aC[--aD] = 2;
aC[--aD] = 0;
return new aq(aC)
}
function L() {
this.n = null;
this.e = 0;
this.d = null;
this.p = null;
this.q = null;
this.dmp1 = null;
this.dmq1 = null;
this.coeff = null
}
function o(z, t) {
if (z != null && t != null && z.length > 0 && t.length > 0) {
this.n = g(z, 16);
this.e = parseInt(t, 16)
} else {
alert("Invalid RSA public key")
}
}
function V(t) {
return t.modPowInt(this.e, this.n)
}
function p(az) {
var t = ae(az, (this.n.bitLength() + 7) >> 3);
if (t == null) {
return null
}
var aA = this.doPublic(t);
if (aA == null) {
return null
}
var z = aA.toString(16);
if ((z.length & 1) == 0) {
return z
} else {
return "0" + z
}
}
L.prototype.doPublic = V;
L.prototype.setPublic = o;
L.prototype.encrypt = p;
this.RSAKey = L
}).call(sinaSSOEncoder);
sinaSSOController = new SSOController();
sinaSSOController.init();
https://passport.weibo.com/visitor/visitor?a=restore&cb=restore_back&from=weibo&_rand=0.11007609980769995
window.restore_back && restore_back({"retcode":20000000,"msg":"succ","data":{"sub":"","subp":"","alt":"ALT-DSBMTZNjg1YTE5Nw==-1533906486-tc-s-1","savestate":365}});
<!--
https://passport.weibo.com/visitor/visitor?entry=miniblog&a=enter&url=https%3A%2F%2Fweibo.com%2F328765211%3Freason%3D%26retcode%3D&domain=.weibo.com&ua=php-sso_sdk_client-0.6.28&_rand=1533906485.6825
-->
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=gb2312"/>
<title>Sina Visitor System</title>
</head>
<body>
<span id="message"></span>
<script type="text/javascript" src="/js/visitor/mini_original.js?v=20161116"></script>
<script type="text/javascript">
window.use_fp = "1" == "1"; // 是否采集设备指纹。
var url = url || {};
(function () {
this.l = function (u, c) {
try {
var s = document.createElement("script");
s.type = "text/javascript";
s[document.all ? "onreadystatechange" : "onload"] = function () {
if (document.all && this.readyState != "loaded" && this.readyState != "complete") {
return
}
this[document.all ? "onreadystatechange" : "onload"] = null;
this.parentNode.removeChild(this);
if (c) {
c()
}
};
s.src = u;
document.getElementsByTagName("head")[0].appendChild(s)
} catch (e) {
}
};
}).call(url);
// 流程入口。
wload(function () {
try {
var need_restore = "1" == "1"; // 是否走恢复身份流程。
// 如果需要走恢复身份流程,尝试从 cookie 获取用户身份。
if (!need_restore || !Store.CookieHelper.get("SRF")) {
// 若获取失败走创建访客流程。
// 流程执行时间过长(超过 3s),则认为出错。
var error_timeout = window.setTimeout("error_back()", 5000);
tid.get(function (tid, where, confidence) {
// 取指纹顺利完成,清除出错 timeout 。
window.clearTimeout(error_timeout);
incarnate(tid, where, confidence);
});
} else {
// 用户身份存在,尝试恢复用户身份。
restore();
}
} catch (e) {
// 出错。
error_back();
}
});
// “返回” 回调函数。
var return_back = function (response) {
if (response["retcode"] == 20000000) {
back();
} else {
// 出错。
error_back(response["msg"]);
}
};
// 跳转回初始地址。
var back = function() {
var url = "https://weibo.com/328765211?reason=&retcode=";
if (url != "none") {
window.location.href = url;
}
};
// 跨域广播。
var cross_domain = function (response) {
var from = "weibo";
if (response["retcode"] == 20000000) {
var crossdomain_host = "login.sina.com.cn";
if (crossdomain_host != "none") {
var cross_domain_intr = window.location.protocol + "//" + crossdomain_host + "/visitor/visitor?a=crossdomain&cb=return_back&s=" +
encodeURIComponent(response["data"]["sub"]) + "&sp=" + encodeURIComponent(response["data"]["subp"]) + "&from=" + from + "&_rand=" + Math.random();
url.l(cross_domain_intr);
} else {
back();
}
} else {
// 出错。
error_back(response["msg"]);
}
};
// 为用户赋予访客身份 。
var incarnate = function (tid, where, conficence) {
var gen_conf = "";
var from = "weibo";
var incarnate_intr = window.location.protocol + "//" + window.location.host + "/visitor/visitor?a=incarnate&t=" +
encodeURIComponent(tid) + "&w=" + encodeURIComponent(where) + "&c=" + encodeURIComponent(conficence) +
"&gc=" + encodeURIComponent(gen_conf) + "&cb=cross_domain&from=" + from + "&_rand=" + Math.random();
url.l(incarnate_intr);
};
// 恢复用户丢失的身份。
var restore = function () {
var from = "weibo";
var restore_intr = window.location.protocol + "//" + window.location.host +
"/visitor/visitor?a=restore&cb=restore_back&from=" + from + "&_rand=" + Math.random();
url.l(restore_intr);
};
// 跨域恢复丢失的身份。
var restore_back = function (response) {
// 身份恢复成功走广播流程,否则走创建访客流程。
if (response["retcode"] == 20000000) {
var url = "https://weibo.com/328765211?reason=&retcode=";
var alt = response["data"]["alt"];
var savestate = response["data"]["savestate"];
if (alt != "") {
requrl = (url == "none") ? "" : "&url=" + encodeURIComponent(url);
var params = "entry=sso&alt=" + encodeURIComponent(alt) + "&returntype=META" +
"&gateway=1&savestate=" + encodeURIComponent(savestate) + requrl;
window.location.href = "https://login.sina.com.cn/sso/login.php?" + params;
} else {
cross_domain(response);
}
} else if(response['retcode'] == 50111261 && isInIframe()) {
//do nothing
} else {
tid.get(function (tid, where, confidence) {
incarnate(tid, where, confidence);
});
}
};
// 出错情况返回登录页。
var error_back = function (msg) {
var url = "https://weibo.com/328765211?reason=&retcode=";
var clientType = "pc";
if (url != "none") {
if (url.indexOf("ssovie4c55=0") === -1) {
url += (((url.indexOf("?") === -1) ? "?" : "&") + "ssovie4c55=0");
}
if (clientType == "mobile") {
window.location.href = "https://passport.weibo.cn/signin/login?r="+url;
} else{
window.location.href = "http://weibo.com/login.php";
}
} else {
if(document.getElementById("message")) {
document.getElementById("message").innerHTML = "Error occurred" + (msg ? (": " + msg) : ".");
}
}
};
var isInIframe = function () {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
};
</script>
</body>
</html>
<!--
https://passport.weibo.com/wbsso/login?ticket=ST-DSBMTZNjg1YTE5Nw%3D%3D-1533906487-tc-F0D951292A632B8774412019DBB041AD-1&ssosavestate=1565442486&callback=sinaSSOController.doCrossDomainCallBack&scriptId=ssoscript0&client=ssologin.js(v1.4.19)&_=1533906486554
-->
sinaSSOController.doCrossDomainCallBack({"result":true,"userinfo":{"uniqueid":"1356859197","displayname":"\u65b0\u7eff\u6625\u968f"}});
<!--
https://passport.97973.com/sso/crossdomain?action=login&savestate=1565442486&callback=sinaSSOController.doCrossDomainCallBack&scriptId=ssoscript1&client=ssologin.js(v1.4.19)&_=1533906486554
-->
window.sinaSSOController.doCrossDomainCallBack && sinaSSOController.doCrossDomainCallBack({"retcode":20000000,"msg":"","data":null});
<!--
https://passport.weibo.cn/sso/crossdomain?action=login&savestate=1&callback=sinaSSOController.doCrossDomainCallBack&scriptId=ssoscript3&client=ssologin.js(v1.4.19)&_=1533906486555
-->
window.sinaSSOController.doCrossDomainCallBack && sinaSSOController.doCrossDomainCallBack({"retcode":20000000,"msg":"","data":null});
<--
https://passport.krcom.cn/sso/crossdomain?service=krvideo&savestate=1&ticket=ST-DSBMTZNjg1YTE5Nw%3D%3D-1533906487-tc-sa-1&ssosavestate=1565442486&callback=sinaSSOController.doCrossDomainCallBack&scriptId=ssoscript2&client=ssologin.js(v1.4.19)&_=1533906486555
-->
window.sinaSSOController.doCrossDomainCallBack && sinaSSOController.doCrossDomainCallBack({"retcode":20000000,"msg":"","data":null});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment