");var t=new RegExp("[?&]"+e+"(=([^&#]*)|&|#|$)"),o=t.exec(n);return o?o[2]?decodeURIComponent(o[2].replace(/\+/g," ")):"":null}function t(e){var n=document.location.search||document.location.hash;if(n){if("?"===n[0]&&(n=n.slice(1)),null===e)return decodeURIComponent(n);for(var t=n.split("&"),o=0,s=t.length;o=1-(Number(o)||.1)&&((new Image).src="https://support.weixin.qq.com/cgi-bin/mmsupportmeshnodelogicsvr-bin/cube?biz=3512&label=connect.qrconnect&"+n+"="+t+"&msg="+e("appid")+"&idx1="+e("scope"))}function s(e){jQuery.ajax({type:"GET",url:T+"/connect/l/qrconnect?uuid="+C+(e?"&last="+e:""),dataType:"script",cache:!1,timeout:6e4,success:function(e,n,t){o("action","connect_qrconnect_longpull_success",.01);var i=window.wx_errcode;switch(i){case 405:o("action","connect_qrconnect_longpull_success_405",.01);var c="/wp-admin/admin-ajax.php?tab=authorization&action=xh_social_add_ons_social_wechat&xh_social_add_ons_social_wechat=6f089c6ae7&s=op&uuid=0¬ice_str=5727621720&uid=5E7EC890507A9D935E1C0021C31556B5&hash=ef651add9b23c88363e4775e24c0e9b9";if(c=c.replace(/&/g,"&"),c+=(c.indexOf("?")>-1?"&":"?")+"code="+wx_code+"&state=op",u)if("true"!==Q&&"false"!==Q)try{document.domain="qq.com";var r=window.top.location.host.toLowerCase();r&&(window.location=c)}catch(e){window.top.location=c}else if("true"===Q)try{window.location=c}catch(e){window.top.location=c}else window.top.location=c;else window.location=c;break;case 404:o("action","connect_qrconnect_longpull_success_404",.01),jQuery(".js_status").hide(),jQuery(".js_qr_img").hide(),jQuery(".js_wx_after_scan").show(),setTimeout(s,100,i);break;case 403:o("action","connect_qrconnect_longpull_success_403",.01),jQuery(".js_status").hide(),jQuery(".js_qr_img").hide(),jQuery(".js_wx_after_cancel").show(),setTimeout(s,2e3,i);break;case 402:o("action","connect_qrconnect_longpull_success_402",.01),B=!0,u&&1!==f||m?$(".js_qrcode_img").attr("src","https://res.wx.qq.com/t/fed_upload/46a73b115c002aa8d49ae255da18c592/qrcode_expired.jpg"):($(".js_refresh_qrcode").show(),$(".js_refresh_qrcode_mask").show());break;case 500:o("action","connect_qrconnect_longpull_success_500",.01),setTimeout(function(){window.location.reload()},200);break;case 408:o("action","connect_qrconnect_longpull_success_408",.01),S&&0!==I||setTimeout(s,2e3);break;default:o("action","connect_qrconnect_longpull_success_others",.01)}},error:function(e,n,t){o("action","connect_qrconnect_longpull_error",.01);var i=window.wx_errcode;408==i?(o("action","connect_qrconnect_longpull_error_408",.01),setTimeout(s,5e3)):(o("action","connect_qrconnect_longpull_error_others",.01),setTimeout(s,5e3,i))}})}function i(e,n){var t,o,s=screen.width,i=screen.height,c=window.outerWidth||document.documentElement.clientWidth||document.body.clientWidth,r=window.outerHeight||document.documentElement.clientHeight||document.body.clientHeight,a=window.screenX||window.screenLeft||0,l=window.screenY||window.screenTop||0,d=window.screen.availLeft||0,_=window.screen.availTop||0;return window.top!=window?void 0===window.screen.availLeft?(t=a+c/2-e/2,o=l+r/2-n/2,console.log("availLeft undefined && centerX: ",t)):(t=s/2-e/2+d,o=i/2-n/2+_,console.log("centerX: ",t)):(t=a+c/2,o=l+r/2,t=0===d?Math.min(Math.max(t-e/2,0),s+d-e):Math.min(Math.max(t-e/2,d),s+d-e),o=0===_?Math.min(Math.max(o-n/2,0),i+_-n):Math.min(Math.max(o-n/2,_),i+_-n)),{x:t,y:o}}function c(){I=0,$(".js_quick_login").hide(),$(".js_normal_login").show(),$(".js_switchToFast_wrp").show(),$(".js_web_qrcode_tips_fast").hide(),$(".js_web_qrcode_tips_normal").show(),setTimeout(s,100)}function r(){I=1,$("#quick_login_loading_toast").fadeIn(300),l([E]).then(function(){$("#quick_login_loading_toast").fadeOut(300),console.log("switchToQuickLogin, fastLogin: ",S),S?($(".js_quick_login").show(),$(".js_normal_login").hide(),$(".js_web_qrcode_tips_fast").show(),$(".js_web_qrcode_tips_normal").hide()):setTimeout(s,1e3)})}function a(e,n,t,o,s,i){0===e.length&&($(".js_quick_login").hide(),$(".js_normal_login").show(), $(".js_switchToFast_wrp").hide(),$(".js_web_qrcode_tips_fast").hide(),$(".js_web_qrcode_tips_normal").show(),S=!1,console.log("所有端口均无法连接")),E=e[0],console.log("port: ",E),$.ajax({url:"https://localhost.weixin.qq.com:"+E+n,type:t,contentType:"application/json",data:JSON.stringify(o),success:s,error:function(c,r,l){console.log("端口"+E+"连接失败,尝试下一个端口"),e.length>1?a(e.slice(1),n,t,o,s,i):i&&i()}})}function l(n){var t=jQuery.Deferred();return a(n,"/api/check-login","POST",{apiname:"qrconnectchecklogin",jsdata:{appid:e("appid"),scope:e("scope"),redirect_uri:e("redirect_uri"),state:e("state")}},function(e){o("action","connect_qrconnect_checkLogin_succ",1);var n=JSON.parse(e);if(console.log("登录状态检查成功",n),k=n.jsdata&&n.jsdata.authorize_uuid||"",I>-1)return void t.resolve();var s=n.errcode;S=!(0!==s||u&&!F),S?(o("action","connect_qrconnect_fastLogin_show",1),$(".js_quick_login").show(),$(".js_normal_login").hide(),$(".js_switchToFast_wrp").show(),$(".js_web_qrcode_tips_fast").show(),$(".js_web_qrcode_tips_normal").hide(),$(".js_quick_login_nickname").text(n.jsdata&&n.jsdata.nickname||""),$(".js_quick_login_avatar").attr("src",n.jsdata&&n.jsdata.headimgurl||"https://res.wx.qq.com/t/fed_upload/937b4aa0-2cc5-42ec-81d7-e641da427fff/avatar_default.svg")):($(".js_quick_login").hide(),$(".js_normal_login").show(),$(".js_switchToFast_wrp").hide(),$(".js_web_qrcode_tips_fast").hide(),$(".js_web_qrcode_tips_normal").show()),t.resolve()},function(){o("action","connect_qrconnect_checkLogin_fail",1),S=!1,$(".js_switchToFast_wrp").hide(),console.log("checklogin local error"),t.resolve()}),t.promise()}function d(){var e=jQuery.Deferred();return setTimeout(function(){e.resolve()},1e3),jQuery(window).load(function(){e.resolve()}),e.promise()}function _(){var e=jQuery.Deferred(),n=window.location.href.replace(/#.*$/,"")+"&f=xml&"+(new Date).getTime();return jQuery.ajax({url:n,type:"GET",dataType:"xml",cache:!1,success:function(n){$(".js_refresh_qrcode_loading").hide(),$(".js_refresh_qrcode_mask").hide(),C=jQuery(n).find("uuid").text(),$(".js_qrcode_img").attr("src","/connect/qrcode/"+C),setTimeout(s,2e3),e.resolve()},error:function(n,t,o){$(".js_refresh_qrcode_loading").hide(),$(".js_refresh_qrcode_mask").hide(),$("#quick_login_error_toast").fadeIn(300,function(){var e=this;setTimeout(function(){$(e).fadeOut(300)},1e3)}),console.log("qrcode img error: ",t,o),e.resolve()}}),e.promise()}"undefined"==typeof console?console={log:function(){},error:function(){}}:("undefined"==typeof console.log&&(console.log=function(){}),"undefined"==typeof console.error&&(console.error=function(){})),jQuery(".js_web_qrcode_reload").click(function(){window.location.reload()});var u=window.top!=window,A=t("self_redirect")||t("style")||t("href")||t("oldstyle"),p=parseInt(e("styletype"),10),w=NaN,g="",f=parseInt(e("stylelite"),10),m=!1;if(1!==p&&0!==p&&1===w&&(p=0),1!==f&&1!==p&&0!==p&&g){m=!0,o("action","connect_qrconnect_css_href");var h=document.createElement("link");h.rel="stylesheet",h.href=g.replace(new RegExp("javascript:","gi"),""),document.getElementsByTagName("head")[0].appendChild(h)}if(1===f&&(jQuery("#tpl_old_iframe").hide(),jQuery("#tpl_iframe").show()),u){o("action","connect_qrconnect_iframe"),document.body.className+=" web_qrcode_type_iframe";var q="";"white"!=q&&(document.body.style.color="#373737"),jQuery("#tpl_for_iframe").show()}else{o("action","connect_qrconnect_page"),document.getElementsByClassName||(document.getElementsByClassName=function(e){for(var n=[],t=new RegExp("(^| )"+e+"( |$)"),o=document.getElementsByTagName("*"),s=0,i=o.length;s