You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
8.9 KiB

!function(O,G){var g=window.jQuery||{},e=G,v=window.document,i="data-bind-login",B=G,h="login-box",x="login-mark";O.loginBox=O.loginBox?O.loginBox:{},g===window.jQuery?($selectorAll=function(e){var t=[];return g(e).each(function(e,n){t.push(n)}),t},function(e){return g(e).get(0)},e=!0):$selectorAll=function(e){return document.querySelectorAll(e)},g.LOGIN=g.LOGIN||{},g.LOGIN.isInit=!0,O.loginBox.scope=g.LOGIN;var r=function(i){var r=document.cookie;return r&&function(){for(var e,n={},t=0,o=(r=r.split("; ")).length;t<o&&!(0<(e=r[t].split("=")).length&&(e[0]===i&&(n.key=e[0],n.value=e[1],n.status=!0),"key"in n));t++);return"key"in n&&n}()},a=function(){var e,n,t,o,i;r("c-login-auto").status&&(e=".csdn.net",n="/",(i=r("c-login-auto"))&&!0===i.status&&(t=i.key+"="+i.value+";",(o=new Date).setTime(o.getTime()-1e3),t=t+"expires="+o.toGMTString()+";",e&&(t=t+"domain="+e+";"),n&&(t=t+"path="+n+";"),document.cookie=t)),delete g.LOGIN.options.pvSource},s=function(e){e&&e.pvSource&&(g.LOGIN.options.pvSource=e.pvSource,o(g.LOGIN.options)),g.LOGIN.docDom&&(v.body.appendChild(g.LOGIN.oMark),v.body.appendChild(g.LOGIN.docDom),g.LOGIN.appendBox.isCreate=!0)},o=O.loginBox.login=function(e){var n,t,o,i,r,a,s,c,l,d,u,p,f,m,L,I,N={domain:(e=e||{}).domain||"csdn.net",isRedirect:e.isRedirect||!document.createElement("iframe").sandbox,iframeName:e.iframeName||"passport_iframe",isIframe:e.isIframe===G||e.isIframe,frameWidth:e.frameWidth,frameHeight:e.frameHeight,append:e.append||"#passport-box",isClosedBtn:null==e.isClosedBtn||!!e.isClosedBtn,from:e.from,service:e.service,loginService:e.loginService,initRun:e.initRun||null,before:e.before||null,after:e.after||null,finished:e.finished||null};if(e.pvSource&&(N.pvSource=e.pvSource),!N.loginService)throw new Error("login 处理 control错误!");return g.LOGIN.options=N,g.LOGIN.runStatus=!0,N.isIframe&&(N.initRun&&(g.LOGIN.runStatus=N.initRun()),g.LOGIN.runStatus&&(g.LOGIN.runStatus=(r=(n=N).domain,a=n.from,s=n.append,c=n.isClosedBtn,l=n.service,d=n.isRedirect,u=n.loginService,p=n.isIframe,f=n.iframeName,m=n.frameWidth,L=n.frameHeight,(I=document.createElement("div")).className=x,v.domain=r||"csdn.net",a&&(u=u+"?from="+a,l&&(u=u+"&service="+l),i=u,n.pvSource&&(u=u+"&"+n.pvSource)),console.debug("处理service:",u),B=document.createDocumentFragment(),t='<iframe width="'+m+'" height="'+L+'" name="'+f+'" src="'+u+'" frameborder="0" scrolling="no"></iframe>',(o=document.createElement("div")).id=s.replace(/[#\.]/,""),o.className=h,g.LOGIN.appendBox=o,g.LOGIN.markDom=I,g.LOGIN.recordLoginService=i,g.LOGIN.loginService=u,p&&(g.LOGIN.appendBox.innerHTML=t,g.LOGIN.iframeName=f,g.LOGIN.iframeDom=g.LOGIN.appendBox.firstElementChild||g.LOGIN.appendBox.firstChild),c&&(cssStyle="display: inline-block; color: #999; font-size: 22px; cursor: pointer; position:absolute; top:2%; right:5%;-moz-user-select:none; -webkit-user-select:none; user-select:none;",closeBtn=document.createElement("span"),closeBtn.style=cssStyle,closeBtn.innerHTML="&times",o.appendChild(closeBtn),g.LOGIN.closeBtn=closeBtn),B&&(B.appendChild(o),g.LOGIN.oMark=I,g.LOGIN.docDom=B),g.LOGIN.isRedirect=d,!0))),O.loginBox},c=function(e){return g.LOGIN.runStatus=g.LOGIN.options[e]?g.LOGIN.options[e]():g.LOGIN.runStatus,g.LOGIN.runStatus},l=function(e,n,t){window.addEventListener?e.addEventListener(n,t,!1):e.attachEvent("on"+n,t)},d=function(e,n){var t;(t="all"===e?"none":"block","start"===e&&(t="block"),g.LOGIN.options.pvSource||"block"!==t)||g.LOGIN.loginService!==g.LOGIN.recordLoginService&&(g.LOGIN.appendBox.getElementsByTagName("iframe")[0].src=g.LOGIN.recordLoginService,g.LOGIN.loginService=g.LOGIN.recordLoginService);return g.LOGIN.appendBox&&(g.LOGIN.markDom.style.display=t,g.LOGIN.appendBox.style.display=t,g.LOGIN.appendBox.status="block"===t||!(g.LOGIN.runStatus=!0)),g.LOGIN.appendBox.status&&n&&n(),g.LOGIN},u=function(){var e=function(e){var n=window.event||e;if(g.LOGIN.appendBox.status)return d("all"),n.cancelBubble?n.cancelBubble=!0:n.stopPropagation(),!1};g.LOGIN.oMark&&!g.LOGIN.oMark.isClick&&(l(g.LOGIN.oMark,"click",e),g.LOGIN.oMark.isClick=!0),g.LOGIN.closeBtn&&g.LOGIN.oMark.isClick&&!g.LOGIN.closeBtn.isCloseClick&&(l(g.LOGIN.closeBtn,"click",e),g.LOGIN.closeBtn.isCloseClick=!0)};O.loginBox.close=function(){return g.LOGIN.appendBox.status&&d("all"),O.loginBox},O.loginBox.show=function(e){return!g.LOGIN.appendBox.isCreate&&s(e),g.LOGIN.appendBox.status||(d("start"),u()),O.loginBox};O.loginBox.support=function(){return g.LOGIN.isRedirect};var p,n=function(){var e,n,t;e=v.head,n=e.firstElementChild||e.firstChild,(t=document.createElement("style")).innerText=".login-box{position: fixed;display: none;left: 50%;top: 50%;z-index: 10000;-webkit-transform: translate(-50%, -50%);-ms-transform: translate(-50%, -50%);-o-transform: translate(-50%, -50%);-moz-transform: translate(-50%, -50%);transform: translate(-50%, -50%);background-color: #fff;}.login-mark{position: fixed;top: 0;left: 0;z-index: 9999;background-color: rgba(0, 0, 0, 0.5);width: 100%;height: 100%;display: none;}",e.insertBefore(t,n),function(){g.LOGIN.loginBtn=$selectorAll("[data-bind-login=true]");var e,n,t=function(e){var n=window.event||e,t="true"===this.getAttribute(i),o=this.href;if(!g.LOGIN.runStatus&&t)return console.error("开启loginbox失败!"),!1;!1===g.LOGIN.isRedirect?!0===t&&(g.LOGIN.options.isIframe&&(a(),!g.LOGIN.appendBox.isCreate&&s(),c("before")&&d(G,function(){c("after")}),u()),n.cancelBubble?n.cancelBubble=!0:n.stopPropagation(),n.returnValue?n.returnValue=!1:n.preventDefault()):o||(v.location.href=g.LOGIN.options.loginService)},o=0;if(!g.LOGIN.loginBtn||g.LOGIN.loginBtn.length<=0)return;for(;g.LOGIN.loginBtn[o];)e=o,n=g.LOGIN.loginBtn[e],l(n,"click",t),o++}(),g.LOGIN.isInit&&o({domain:"csdn.net",isIframe:!0,frameWidth:410,frameHeight:427,append:"#passportbox",from:window.location.href,loginService:"https://passport.csdn.net/account/login"})},t=function(e){var n,t,o,i;document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(function(){e&&e()},0):(p=function(){document.removeEventListener("DOMContentLoaded",p,!1),e()},document.addEventListener("DOMContentLoaded",p,!1)):document.attachEvent&&(n=e,t=!1,o=function(){t||(t=!0,n&&n())},(i=function(){try{v.documentElement.doScroll("left")}catch(e){return void setTimeout(i,50)}o()})(),v.onreadystatechange=function(){"complete"===v.readyState&&(v.onreadystatechange=null,o())})};_ready=function(){e&&g(function(){n()})||t(n)},_ready()}(window.csdn=window.csdn||{},void 0);!function(e,o){var l,m,g,n=window.jQuery||{},t=o,f=o;if(!(g=/mobile|micromessenger|ios|tablet|Android tablet|Android phone|Android|webOS|NokiaN9|iPhone|iPod|BlackBerry|BlackBerry phone|BlackBerry tablet|window phone|window tablet|firefox os|firefox os phone|firefox os tablet|meeGo|Television|IEMobile|Opera Mini/i.test(navigator.userAgent.toLowerCase()))&&!(f=!!e.loginBox&&(m=window.csdn.loginBox,!0)))throw new Error("自动启动弹窗策略依赖于login-box基础脚本!");n===window.jQuery?($selectorAll=function(e){var t=[];return n(e).each(function(e,o){t.push(o)}),t},function(e){return n(e).get(0)},t=!0):$selectorAll=function(e){return document.querySelectorAll(e)},l={userFlg:"UserName",domain:".csdn.net",expires:31536e6,loginAutoMaxNum:100,loginAutoAdbNum:40,loginAutokey:"c-login-auto",loginAutoAdbKey:"c_adb",statisSource:"utm_source=auto_pv"};var r,w=function(i){var r=document.cookie;return r&&function(){for(var e,o={},t=0,n=(r=r.split("; ")).length;t<n&&!(0<(e=r[t].split("=")).length&&(e[0]===i&&(o.key=e[0],o.value=e[1],o.status=!0),"key"in o));t++);return"key"in o&&o}()},y=function(e,o,t){var n,i,r=w(e);r&&!0===r.status&&(n=r.key+"="+r.value+";",(i=new Date).setTime(i.getTime()-1e3),n=n+"expires="+i.toGMTString()+";",o&&(n=n+"domain="+o+";"),t&&(n=n+"path="+t+";"),document.cookie=n)},i=function(){var e,o,t,n,i,r,u,a,c,d,s=0;i=l.loginAutoMaxNum,(e=w(l.userFlg))&&e.status||!!e?y(l.loginAutokey,l.domain,"/"):(t=(n=w(l.loginAutoAdbKey))&&n.status||!!n,o=(e=w(l.loginAutokey))&&e.status||!!e,t&&(i=l.loginAutoAdbNum),o&&(s=Number(e.value,10)),i<=s?(y(l.loginAutokey,l.domain,"/"),g?window.location.href="https://passport.csdn.net/account/login":f&&(l.statisSource?m.show({pvSource:l.statisSource+i}):m.show())):(r=l.domain,u="/",d=l.loginAutokey+"="+(s+=1)+";",(a=l.expires)&&((c=new Date).setTime(c.getTime()+a),d=d+"expires="+c.toGMTString()+";"),r&&(d=d+"domain="+r+";"),u&&(d=d+"path="+u+";"),document.cookie=d))},u=function(e){var o,t,n,i;document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(function(){e&&e()},0):(r=function(){document.removeEventListener("DOMContentLoaded",r,!1),e()},document.addEventListener("DOMContentLoaded",r,!1)):document.attachEvent&&(o=e,t=!1,n=function(){t||(t=!0,o&&o())},(i=function(){try{doc.documentElement.doScroll("left")}catch(e){return void setTimeout(i,50)}n()})(),doc.onreadystatechange=function(){"complete"===doc.readyState&&(doc.onreadystatechange=null,n())})};_ready=function(){t&&n(function(){i()})||u(i)},_ready()}(window.csdn=window.csdn||{},void 0);