',css:'"};this.opt=$.extend(e,i),this.init()};$.sdkLogin=function(i){return new sdkLogin(i)},sdkLogin.prototype={init:function(){this.isIE8=/msie 9.0|msie 8.0|msie 7.0|msie 6.0/i.test(navigator.userAgent.toLowerCase()),this.dataSet(),this.setTjData(),this.render(),this.event(),this._validate=this._setValidate(),this.autoLogin()},remote:{state:"",regstate:"",regFn:function(){}},utils:{tips:function(i,e){var a;e?a=e.parent().siblings(".error-tip"):$(".tab-acc-main").each(function(i){"block"===$(this).css("display")&&(a=$(this).children(".error-tip"))}),a&&a.length>0&&(i&&0!=i.length?a.text(i).addClass("sdk-dialog-tip-error"):a.text("").removeClass("sdk-dialog-tip-error"))}},setTjData:function(){var i,e=this,a={},t={},o=[],n={},s={},c=[];if($.sdkUaParser?i=$.sdkUaParser():$.sdkUtil.log("sdkUaParser未引入,无法正确处理数据统计"),i){var p=i.getOS(),r=i.getBrowser(),l=i.getScreen(),d=i.getDevice();a={DF:p.name,OS:p.version,PM:d.model,BW:r.name,RL:l.w+"x"+l.h}}n={IC:e.opt.appstyle&&+e.opt.appstyle<5?1:2,DF:!$.sdkUtil.isPhone()&&$.sdkUtil.isiOS()?"MAC OS":$.sdkUtil.isPhone()||$.sdkUtil.isiOS()?"":"WINDOWS",OS:"",AT:"",DC:"",PM:"",BW:"",AC:"",RL:(window.screen.width||-1)+"x"+(window.screen.height||-1),PN:"",PV:"",SDKV:"",IDFA:"",ADID:"",UEADID:"",IMEI:""},s={REFERER:e.TJDATA.TJ_REFR,REFERER_PARAM:e.TJDATA.TJ_REFRP,AD_PARAM:e.TJDATA.TJ_ADP,AD_TYPE:e.TJDATA.TJ_ADT,BID:e.TJDATA.TJ_BID,LID:e.TJDATA.TJ_LID,EXT:e.TJDATA.TJ_EXT},t=$.extend(!0,n,a);for(var g in t)o.push(g+"="+t[g]);for(var g in s)c.push(g+"="+s[g]);$.sdkUtil.cookie("sdkweb_tg")||$.sdkUtil.cookie("sdkweb_tg",$.sdkUtil.base64.encode(o.join("|")),{path:"/",domain:DOMAIN.INDEX}),$.sdkUtil.cookie("sdkweb_tj")||$.sdkUtil.cookie("sdkweb_tj",c.join("|"),{path:"/",domain:DOMAIN.INDEX})},dataSet:function(){var i=this;i.CDATA={game_id:i.opt.game_id,clientid:i.opt.clientid},i.TJDATA={TJ_GID:i.opt.game_id,TJ_SGID:i.opt.c_game_id,TJ_GSID:"",TJ_REFR:i.opt.referer,TJ_REFRP:i.opt.referer_param,TJ_ADP:i.opt.ab_param,TJ_ADT:i.opt.ab_type,TJ_BID:i.opt.bid,TJ_LID:i.opt.lid,TJ_EXT:i.opt.ext,TJ_FPFM:i.opt.from_pt,TJ_WAY:"",TJ_FROM:i.opt.tj_from,TJ_DVIO:""}},render:function(){var i,e=this;$("#sdkLoginBox").length||(i=$(e.opt.appenddom&&$(e.opt.appenddom).length>0?e.opt.appenddom:"body"),i.append(e.opt.tpl),$("head").append(e.opt.css),e.opt.addcss&&$("head").append(e.opt.addcss)),e.opt.hidetop&&$(".sdk-login-header").hide(),e.opt.hidebottom&&$(".tab-acc-bottom").hide(),e.opt.shade||$(".sdklog-cover").hide(),e.domCache(),e.position()},position:function(){return!!this.isIE8&&(/msie 9.0|msie 8.0/i.test(navigator.userAgent.toLowerCase())?($("#sdkLoginWrap").css({position:"static"}),!1):/msie 7.0/i.test(navigator.userAgent.toLowerCase())?($("#sdkLoginWrap").css({position:"static"}),!1):void 0)},domCache:function(){this.dom={$sdkLoginBox:$("#sdkLoginBox"),$sdkRegBox:$("#sdkRegBox"),$sdkLogBox:$("#sdkLogBox"),$btnAccLog:$("#btnAccLog"),$accLogVal:$("#accLogVal"),$accLogPwdVal:$("#accLogPwdVal"),$isLogAuto:$("#isLogAuto"),$isLogAuto2:$("#isLogAuto2"),$regAccVal:$("#regAccVal"),$regPwdVal:$("#regPwdVal"),$regRealNameVal:$("#regRealNameVal"),$regCardVal:$("#regCardVal"),$btnAccReg:$("#btnAccReg"),$phoneRegVal:$("#phoneRegVal"),$btnPhoneReg:$("#btnPhoneReg")}},event:function(){function i(i){i.preventDefault(),i.stopPropagation()}var e=this;"placeholder"in document.createElement("input")||($("[placeholder]").each(function(){var i=$(this);i.css("padding-left");i.after(''+i.attr("placeholder")+""),""!=i.val()?i.siblings("span.placeholder").hide():i.siblings("span.placeholder").show()}).on("focus",function(){$(this).siblings("span.placeholder").hide()}).on("keydown",function(){$(this).siblings("span.placeholder").hide()}).on("blur",function(){var i=$(this);""!=i.val()?i.siblings("span.placeholder").hide():i.siblings("span.placeholder").show()}),$("span.placeholder").on("click",function(){$(this).hide(),$(this).siblings("[placeholder]").trigger("click"),$(this).siblings("[placeholder]").trigger("focus")})),$("body").on("scroll",function(i){e.positionTimeout&&clearTimeout(e.positionTimeout),e.positionTimeout=setTimeout(function(){e.position()},500)}),$("#sdkLoginBox").on("click",".tab-nav-a",function(a){i(a);var t=$(this).closest(".tab-acc"),o=$(this).index(),n=t.find(".tab-acc-main").eq(o);n.find("[placeholder]").each(function(){""==$(this).val()&&$(this).siblings("span.placeholder").show()}),$(this).parent().removeClass("tab-nav-0").removeClass("tab-nav-1").addClass("tab-nav-"+o),$(this).addClass("curr").siblings().removeClass("curr"),t.find(".tab-acc-main").hide(),n.find(".error-tip").text(""),$.sdkUtil.cursorPosition(n.show().find("input").eq(0)),e.position()}).on("click","#toReg",function(a){i(a);var t=$("#toReg").parents("body").hasClass("page-login"),o=location.search;t?location.href="https://my."+_domain+"/register.html"+o:e.show(3)}).on("click","#toLog",function(a){i(a);var t=$("#toReg").parents("body").hasClass("register");urlparam=location.search,t?location.href="https://my."+_domain+"/login.html"+urlparam:e.show(1)}).on("click","#sdkChangeToPhone",function(a){i(a),e.show(4),e.dom.$phoneRegVal.val(e.dom.$regAccVal.val())}).on("keyup","#regAccVal",function(i){var e=$(this).val();$.sdkValidate({}).phone(e)===!0?$("#sdkChangeTip").show():$("#sdkChangeTip").hide()}).on("click","#sdkChangeTipClose",function(e){i(e),$("#sdkChangeTip").hide()}).on("click",".i-close",function(a){i(a),e.hide(),$("#sdkChangeTip").hide()}).on("click",".i-check",function(a){i(a);var t=$(this);$(this).toggleClass("i-checked"),$(this).hasClass("i-checked")&&e.utils.tips("",t.closest(".tab-acc-main").find(".i-btn"))}).on("click",".get-code",function(a){i(a);var t=$(this);if(!t.hasClass("pending")){var o=$(this).closest(".tab-acc-main").find(".phone-reg-val"),n=o.val(),s=t.attr("id");e.check(o)||(t.addClass("pending"),e.phoneCode(n,function(i){1===+i.code?(e["phonecount_"+s]||(e["phonecount_"+s]=$.sdkCount({content:"60秒",auto:!1,element:t,method:"html",bindFinish:function(i){t.html("发送短信验证码").removeClass("pending")}})),e["phonecount_"+s].start()):t.html("发送短信验证码").removeClass("pending")},function(i){t.html("发送短信验证码").removeClass("pending"),i&&i.msg&&e.utils.tips(i.msg,o)}))}}).on("click",".btn-phone-log",function(a){i(a);var t=$(this),o="phonelog",n=!1;if(!t.hasClass("pending")){var s=$(this).closest(".tab-acc-main"),c=s.find(".phone-reg-val"),p=s.find(".phone-code-val"),r=c.val(),l=p.val();if(e.utils.tips("",t.parent()),e.check(t.closest(".tab-acc-main").find("input"))&&(n=!0),"btnPhoneReg"==t.attr("id")&&(o="phonereg",$(".i-check[data-check='phone']").hasClass("i-checked")?e.utils.tips("",e.dom.$btnPhoneReg):(e.utils.tips("请阅读注册协议并勾选同意",e.dom.$btnPhoneReg),n=!0)),!n){var d={phone_account:r,phone_code:l};t.addClass("pending"),e.phoneLogin(d,function(i){t.removeClass("pending"),e.sucEvent(i,o)},function(i){e.utils.tips(i.msg,t.parent()),t.removeClass("pending"),e.failEvent(o)})}}}).on("click","#btnAccReg",function(a){i(a);var t=$(this),o=!1;if(!t.hasClass("pending")&&"false"!==e.remote.state){e.utils.tips("",t.parent());var n=e.dom.$regAccVal.val(),s=$.trim(e.dom.$regPwdVal.val()),c=$.trim(e.dom.$regRealNameVal.val()),p=$.trim(e.dom.$regCardVal.val());if(e.check(t.closest(".tab-acc-main").find("input"))&&(o=!0),$(".i-check[data-check='acc']").hasClass("i-checked")?e.utils.tips("",e.dom.$btnAccReg):(e.utils.tips("请阅读注册协议并勾选同意",e.dom.$btnAccReg),o=!0),!o){var r={login_account:n,password:td(s),name:c,idcard:p};t.addClass("pending"),e.remote.regFn=function(){e.utils.tips("",t.parent())},e.register(r,function(i){t.removeClass("pending"),e.remote.regstate="true",e.sucEvent(i,"reg")},function(i){e.remote.regstate="false","false"!==e.remote.state&&e.utils.tips(i.msg,t.parent()),t.removeClass("pending"),e.failEvent("reg")})}}}).on("click","#btnAccLog",function(a){i(a),e.utils.tips("",e.dom.$btnAccLog.parent());var t=$(this),o=!1;if(!t.hasClass("pending")){var n=e.dom.$accLogVal.val(),s=$.trim(e.dom.$accLogPwdVal.val());if(e.check(t.closest(".tab-acc-main").find("input"))&&(o=!0),!o){var c={login_account:n,password:td(s)};t.addClass("pending"),e.login(c,function(i){t.removeClass("pending"),e.sucEvent(i,"log")},function(i){e.utils.tips(i.msg,e.dom.$btnAccLog.parent()),t.removeClass("pending"),e.failEvent("log")})}}}).on("click",".forget-pwd",function(i){i.preventDefault(),$.sdkUtil.sdkshowKfDialog()}).on("blur","input",function(){e.check($(this))}).on("focus","input",function(){e.utils.tips("",$(this)),e.utils.tips("",$(this).parent())}).on("keydown","input",function(i){if(13==i.keyCode){$(this).closest(".tab-acc-main").find(".i-btn").trigger("click")}})},initShow:function(){var i="";try{i=$.sdkUtil.cookie("saveAccount")||$.sdkUtil.getKey("saveAccount")}catch(i){}i&&(1!=$.sdkValidate({}).phone(i)||$(".phone-reg-val").val()||$(".phone-reg-val").val(i).siblings("span.placeholder").hide(),1!=$.sdkValidate({}).checkUsername(i,!0)||$("#accLogVal").val()||$("#accLogVal").val(i).siblings("span.placeholder").hide())},autoLogin:function(){var i=this;i.getUserinfo(function(e){i.sucEvent(e,"autolog")},function(){i.initShow(),i.opt.autoshow&&i.show(1),i.failEvent("autolog")})},getUserinfo:function(i,e,a){var t=this,o=$.extend({},t.CDATA,t.TJDATA,{TJ_WAY:12});$.ajax({url:URL.auto_login,type:"get",dataType:"jsonp",data:o,success:function(a){a&&1===+a.code?$.isFunction(i)&&i(a):$.isFunction(e)&&e(a)},error:function(){$.isFunction(a)&&a({msg:"请求失败,请稍后重试"})}})},sucEvent:function(i,e){var a=this,t=i.data.userinfo;$.sdkUtil.cookie("saveAccount",t.show_account,{path:"/",domain:DOMAIN.INDEX,expires:365});try{$.sdkUtil.setKey("saveAccount",t.show_account)}catch(i){}switch($("#toReg").parents("body").hasClass("register")||a.hide(),$.isFunction(a.opt.loged)&&a.opt.loged(t),e){case"log":$.isFunction(a.opt.logedfn)&&a.opt.logedfn(t);break;case"reg":$.isFunction(a.opt.regedfn)&&a.opt.regedfn(t);break;case"phonelog":$.isFunction(a.opt.logedfn)&&a.opt.logedfn(t);break;case"phonereg":$.isFunction(a.opt.regedfn)&&a.opt.regedfn(t)}},failEvent:function(i){var e=this;switch($.isFunction(e.opt.unlog)&&e.opt.unlog(),i){case"log":$.isFunction(e.opt.unlogfn)&&e.opt.unlogfn();break;case"reg":$.isFunction(e.opt.unregfn)&&e.opt.unregfn();break;case"phonelog":$.isFunction(e.opt.unlogfn)&&e.opt.unlogfn();break;case"phonereg":$.isFunction(e.opt.unregfn)&&e.opt.unregfn()}},login:function(i,e,a){var t=this,o=$.extend({},t.CDATA,t.TJDATA,{s:1,login_account:i.login_account,password:i.password,TJ_WAY:11});$.ajax({url:URL.act_login,type:"get",dataType:"jsonp",data:o,success:function(i){i&&1===+i.code?$.isFunction(e)&&e(i):$.isFunction(a)&&a(i)},error:function(){$.isFunction(a)&&a({msg:"请求失败,请稍后重试"})}})},logOut:function(i){var e=this;$.ajax({url:URL.logout,type:"get",dataType:"jsonp",success:function(a){a&&1===+a.code?$.isFunction(i)&&i():e.sdkUtil.log("注销失败")},error:function(){e.sdkUtil.log("注销失败")}})},phoneCode:function(i,e,a){var t=this,o=$.extend({},t.CDATA,t.TJDATA,{phone:i});$.ajax({url:URL.act_send_phone_code,type:"get",dataType:"jsonp",timeout:1e4,data:o,success:function(i){i&&1===+i.code?$.isFunction(e)&&e(i):$.isFunction(a)&&a(i)},error:function(){$.isFunction(a)&&a({msg:"请求失败,请稍后重试"})}})},phoneLogin:function(i,e,a){var t=this,o=$.extend({},t.CDATA,t.TJDATA,i,{TJ_WAY:13});$.ajax({url:URL.act_phone_login,type:"get",dataType:"jsonp",data:o,success:function(i){i&&1===+i.code?$.isFunction(e)&&e(i):$.isFunction(a)&&a(i)},error:function(){$.isFunction(a)&&a({msg:"请求失败,请稍后重试"})}})},register:function(i,e,a){var t=this,o=$.extend({},t.CDATA,t.TJDATA,{s:1,TJ_WAY:11},i);$.ajax({url:URL.act_register,type:"get",dataType:"jsonp",data:o,success:function(i){i&&1===+i.code?$.isFunction(e)&&e(i):$.isFunction(a)&&a(i)},error:function(){$.isFunction(a)&&a({msg:"请求失败,请稍后重试"})}})},objValidate:{ico_cls:"sdk-dialog-ico",t_cls:"sdk-dialog-ico-right sdk-dialog-ico-pending",p_cls:"sdk-dialog-ico-pending",r_cls:"sdk-dialog-ico-right",e_cls:"sdk-dialog-ico-error",e_te_cls:"sdk-dialog-text-error",e_ti_cls:"sdk-dialog-tip-error",r_un:"regAccVal",r_rn:"",isExistAccount:!0,existAccountUrl:URL.check_account},_setValidate:function(i){return $.extend({},$.sdkValidate(),this.objValidate,i)},check:function(i){var e=this,a=!1;return i.each(function(i){var t=$(this),o=t.data("rule"),n=e._validate.checkField(this,o,e);if(n!==!0&&n&&"regAccVal"!=t.attr("id")?(a=!0,e.utils.tips(n,t)):n===!0&&e.utils.tips("",t),"regAccVal"==t.attr("id")){var s=e.dom.$regAccVal.parent().next(".error-tip").text(),c="";(n!==!0&&n||s.length>0)&&(a=!0,c=n!==!0&&n?n:s,"regAccVal"==t.attr("id")&&"您填写的是手机号,请切换至手机登录。"==n?($("#sdkChangeTip").show(),c="您填写的是手机号,请切换至手机注册。",e.utils.tips(c,t)):e.utils.tips(c,t))}}),a},show:function(i){var e=this,i=+i||1;switch($("[placeholder]").each(function(){""==$(this).val()&&$(this).siblings("span.placeholder").show()}),i){case 1:e.dom.$sdkLoginBox.show(),e.dom.$sdkRegBox.hide(),e.dom.$sdkLogBox.show(),$("#iBtnAccLog").trigger("click");break;case 2:e.dom.$sdkLoginBox.show(),e.dom.$sdkRegBox.hide(),e.dom.$sdkLogBox.show(),$("#iBtnPhoneLog").trigger("click");break;case 3:e.dom.$sdkLoginBox.show(),e.dom.$sdkLogBox.hide(),e.dom.$sdkRegBox.show(),$("#iBtnAccReg").trigger("click");break;case 4:e.dom.$sdkLoginBox.show(),e.dom.$sdkLogBox.hide(),e.dom.$sdkRegBox.show(),$("#iBtnPhoneReg").trigger("click");break;default:e.dom.$sdkLoginBox.show(),e.dom.$sdkRegBox.hide(),e.dom.$sdkLogBox.show(),$("#iBtnAccLog").trigger("click")}e.position(),e.initShow()},hide:function(){this.dom.$sdkLoginBox.find("input").val(""),this.dom.$sdkLoginBox.find(".error-tip").text(""),this.dom.$sdkLoginBox.hide()}}}(jQuery);