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 line
8.9 KiB

5 years ago
!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.isCl