/**
 * ! GztAuth development | (c) Rede Gazeta !
 */

!function(f){function e(){var e={elem:[],push:function(){return Array.prototype.push.apply(this.elem,arguments),!(!GztAuth||!GztAuth._ready)&&GztAuth.utils.CallQUEFunctions()}};return e}que="undefined"!=typeof GztAuth&&GztAuth&&GztAuth.que?GztAuth.que:[],(queA=new e).elem=que,GztAuth={},(GztAuth=function(){var h=this;if(h.rExist=!0,"undefined"==typeof jQuery||!jQuery)throw h.rExist=!1,"Gazeta API - JQuery is not defined";h.Login=function(e,t){var a=jQuery("#"+e+" input[name=username]"),o=jQuery("#"+e+" input[name=password]"),r=jQuery("#"+e+" input[name=redirect]"),i=jQuery("#"+e+" input[name=emailverificationurl]"),n=jQuery("#"+e+" #loading"),s=jQuery("#"+e+" #error");a&&""!==a.val()&&(a=a.val(),o)&&""!==o.val()?(o=o.val(),r=r&&""!==r.val()?r.val():null,i=i&&""!==i.val()?i.val():null,n[0]&&n.show(),s[0]&&s.text(""),h.makeLogin(a,o,i,n,s,r,e,t)):s[0]?s.text(h._error.l01):alert(h._error.l01)},h.makeLogin=function(t,a,e,o,r,i,n,s){$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/login",data:{username:t,password:a,emailverificationurl:e}}).done(function(e){return o&&o.hide(),h.utils.logs("login",e),e?e.error?r[0]?r.text(e.msg):alert(e.msg):!e.email&&e.msg&&e.msg.msg&&r[0]?r.text(e.msg.msg):(h.SmartLock.Set(t,a),i&&(e.redirect=i||null),h.utils.clearUser(),void h.ProcessData(e,n,"_login",s)):r[0]?r.text(h._error.general):alert(h._error.general)}).fail(function(e){if(o[0]&&o.hide(),h.utils.logs("login error",e),!r[0])return alert(h._error.general);r.text(h._error.general)})},h.Register=function(e){var a=jQuery("#"+e+" input[name=email]").val(),t=jQuery("#"+e+" input[name=name]").val(),o=jQuery("#"+e+" input[name=cpfcnpj]").val(),r=jQuery("#"+e+" input[name=password]").val(),i=jQuery("#"+e+" input[name=confirmpassword]").val(),n=jQuery("#"+e+" input[name=birthdate]").val(),s=jQuery("#"+e+" input[name=gender]:checked").val(),l=jQuery("#"+e+" input[name=emailverificationurl]").val(),u=jQuery("#"+e+" #msg"),d=jQuery("#"+e+" input[name=by]").val()||"",m=jQuery("#"+e+" #loading"),c=jQuery("#"+e+" #error"),g=jQuery("#"+e+" input#newsletterAssinar")[0].checked;if(nlError=!1,!(a&&""!==a&&t&&""!==t&&o&&""!==o&&r&&""!==r&&i&&""!==i&&n&&""!==n&&s&&""!==s&&l&&""!==l))return c?c.text(h._error.r01):alert(h._error.r01);m[0]&&m.show(),c[0]&&c.text(""),u[0]&&u.text("");var e=h._cookie&&$.cookie("_fbp")||"",p=h._cookie&&$.cookie("_fbc")||"";$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/register",data:{email:a,name:t,cpfcnpj:o,password:r,confirmpassword:i,birthdate:n,gender:s,emailverificationurl:l,by:d,url:location.href,fbp:e,fbc:p}}).done(function(e){m[0]&&m.hide(),h.utils.logs("register",e);try{deep&&deep.event&&deep.event({"event.type":"user-registration","user.action":"create","user.creationdate":(new Date).toISOString().substr(0,10)}),cX&&cX.CCE&&cX.CCE.sendConversionEvent({productId:"8msnlehq7ire",funnelStep:"convertProduct"})}catch(e){}var t;return e?e.error?c[0]?c.text(e.msg):alert(e.msg):e.error&&e.msg&&e.msg.msg&&c?c.text(e.msg.msg):(t=(t=location.search.substring(1))&&""!==t?JSON.parse('{"'+decodeURI(t).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"')+'"}'):null,void(e.isPosted&&(g&&$.ajax({method:"POST",url:"https://www.agazeta.com.br/save-subscription",data:{email:a,list:[{name:"NewsManha",check:!0}]}}).done(function(e){e.er&&(nlError=!0)}).fail(function(e){nlError=!0}),u[0]?(t&&(t.by&&"google"===t.by&&h.saveData(e,!1),t.redirect)&&(f.location=t.redirect),e.method&&1===e.method?u.text(h._msg.r02):u.text(h._msg.r01)):e.method&&1===e.method?h._msg.r02&&(nlError?alert(h._msg.r04):alert(h._msg.r02)):h._msg.r01&&(nlError?alert(h._msg.r03):alert(h._msg.r01))))):c[0]?void c.text(h._error.general):alert(h._error.general)}).fail(function(e){if(m[0]&&m.hide(),h.utils.logs("register error",e),!c[0])return alert(h._error.general);c.text(h._error.general)})},h.saveData=function(e,t){var a;localStorage.setItem(h._dataNames.uID,e.uid),localStorage.setItem(h._dataNames.idId,e.userid),localStorage.setItem(h._dataNames.email,e.email),1<e.name.split(" ").length?localStorage.setItem(h._dataNames.name,e.name.split(" ")[0]):8<e.name.length?localStorage.setItem(h._dataNames.name,e.name.substring(0,5)+"..."):localStorage.setItem(h._dataNames.name,e.name),localStorage.setItem(h._dataNames.time,(new Date).setMinutes((new Date).getMinutes()+5)),h._cookie&&((a=new Date).setFullYear(a.getFullYear()+20),$.cookie(h._dataNames.uID,e.uid,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:a}),$.cookie(h._dataNames.idId,e.userid,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:a}),$.cookie(h._dataNames.email,e.email,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:a}),1<e.name.split(" ").length?$.cookie(h._dataNames.name,e.name.split(" ")[0],{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:a}):8<e.name.length?$.cookie(h._dataNames.name,e.name.substring(0,5)+"...",{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:a}):$.cookie(h._dataNames.name,e.name,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:a})),t&&location.reload()},h.Logout=function(t){if(!h.utils.userLogged())return h.utils.logs("logout",h.utils.userLogged()),!1;$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/logout",data:{session:h.utils.GetInfo(h._dataNames.session)}}).done(function(e){h.utils.logs("logout",e),h.utils.clearUser(),t&&""!==t?location=t:location.reload()}).fail(function(e){h.utils.logs("logout error",e),h.utils.clearUser(),location.reload()})},h.CheckEmail=function(e,a){var t=jQuery("#"+e+" input[name=email]").val(),o=jQuery("#"+e+" input[name=name]").val(),r=jQuery("#"+e+" #loading"),i=jQuery("#"+e+" #error");if(!t||""==t||!o||""==o)return i[0]?i.text(h._error.ce01):alert(h._error.ce01);r[0]&&r.show(),i[0]&&i.text(""),$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/checkemail",data:{email:t,name:o}}).done(function(e){var t;return r[0]&&r.hide(),h.utils.logs("checkemail",e),e?e.error?i[0]?i.text(e.msg):alert(e.msg):e.error&&e.msg&&e.msg.msg?i[0]?i.text(e.msg.msg):alert(e.msg.msg):void(a&&(delete(t=JSON.parse(JSON.stringify(e))).isExist,h.utils.logs("checkemail callback:",{isValid:!e.isExist,name:t.name,email:t.email}),a(!e.isExist,t))):i[0]?void i.text(h._error.general):alert(h._error.general)}).fail(function(e){if(r[0]&&r.hide(),h.utils.logs("checkemail error",e),!i[0])return alert(h._error.general);i.text(h._error.general)})},h.ForgotPass=function(e){var t=jQuery("#"+e+" input[name=email]").val(),a=jQuery("#"+e+" input[name=site]").val(),o=jQuery("#"+e+" #loading"),r=jQuery("#"+e+" #msg"),i=jQuery("#"+e+" #error");if(!t||""==t||!a||""==a)return i?i.text(h._error.fp01):alert(h._error.fp01);o[0]&&o.show(),i[0]&&i.text(""),r[0]&&r.text(""),$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/forgotpass",data:{email:t,site:a}}).done(function(e){return o[0]&&o.hide(),h.utils.logs("forgotpass",e),e?e.error?i[0]?i.text(e.msg):alert(e.msg):e.error&&e.msg&&e.msg.msg?i[0]?i.text(e.msg.msg):alert(e.msg.msg):void(e.isPosted&&(r[0]?r.text(h._msg.fp01):alert(h._msg.fp01))):i[0]?void i.text(h._error.general):alert(h._error.general)}).fail(function(e){if(o&&o.hide(),h.utils.logs("forgotpass error",e),!i[0])return alert(h._error.general);i.text(h._error.general)})},h.ForgotChangePass=function(e){var t=jQuery("#"+e+" input[name=newpassword]").val(),a=jQuery("#"+e+" input[name=confirmpassword]").val(),o=jQuery("#"+e+" input[name=vtoken]").val(),r=jQuery("#"+e+" #loading"),i=jQuery("#"+e+" #msg"),n=jQuery("#"+e+" #error");if(!t||""==t||!a||""==a||!o||""==o)return n?n.text(h._error.fcp01):alert(h._error.fcp01);r[0]&&r.show(),n[0]&&n.text(""),i[0]&&i.text(""),$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/forgotchangepass",data:{newpassword:t,confirmpassword:a,vtoken:o,u:1}}).done(function(e){return r&&r.hide(),h.utils.logs("forgotchangepass",e),e?e.error?n[0]?n.text(e.msg):alert(e.msg):e.error&&e.msg&&e.msg.msg?n[0]?n.text(e.msg.msg):alert(e.msg.msg):void(e.isPosted&&(i[0]?i.text(h._msg.fcp01):alert(h._msg.fcp01))):n[0]?void n.text(h._error.general):alert(h._error.general)}).fail(function(e){if(r[0]&&r.hide(),h.utils.logs("forgotchangepass error",e),!n[0])return alert(h._error.general);n.text(h._error.general)})},h.ChangePass=function(e){var t=jQuery("#"+e+" input[name=oldpassword]").val(),a=jQuery("#"+e+" input[name=newpassword]").val(),o=jQuery("#"+e+" input[name=confirmpassword]").val(),r=jQuery("#"+e+" #loading"),i=jQuery("#"+e+" #msg"),n=jQuery("#"+e+" #error");if(!t||""==t||!a||""==a||!o||""==o)return n?n.text(h._error.cp01):alert(h._error.cp01);if(r[0]&&r.show(),f.top===f.self&&!h.utils.userLogged())return n[0]?n.text(h._error.cp02):alert(h._error.cp02);n[0]&&n.text(""),i[0]&&i.text("");e=f.top!==f.self?h.utils.urlParam("id")||"":h.utils.getUserUId();$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/changepass",data:{oldpassword:t,newpassword:a,confirmpassword:o,accountid:e}}).done(function(e){return r[0]&&r.hide(),h.utils.logs("changepass",e),e?e.error?n[0]?n.text(e.msg):alert(e.msg):e.error&&e.msg&&e.msg.msg?n[0]?n.text(e.msg.msg):alert(e.msg.msg):void(e.isPosted&&(i[0]?i.text(h._msg.cp01):alert(h._msg.cp01))):n[0]?void n.text(h._error.general):alert(h._error.general)}).fail(function(e){if(r[0]&&r.hide(),h.utils.logs("changepass error",e),!n[0])return alert(h._error.general);n.text(h._error.general)})},h.CheckUserId=function(){h.utils.userLogged()&&(h.utils.logs("calling checkuserid",""),$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/checkid",data:{email:h.utils.GetInfo(h._dataNames.email),cnumber:h.utils.GetInfo(h._dataNames.cnumber)}}).done(function(e){h.utils.logs("checkuserid",e),h.ProcessData(e,null,"checkid",null)}).fail(function(e){h.utils.logs("checkuserid error",e)}))},h.ProcessData=function(e,t,a,o){if(t&&jQuery("#"+t).each(function(){this.reset()}),localStorage)if(e&&e.error)e.logout&&GztAuth.utils.clearUser();else if(e&&e.email){if(localStorage.setItem(h._dataNames.uID,e.uid),localStorage.setItem(h._dataNames.idId,e.userid),localStorage.setItem(h._dataNames.email,e.email),1<e.name.split(" ").length?localStorage.setItem(h._dataNames.name,e.name.split(" ")[0]):8<e.name.length?localStorage.setItem(h._dataNames.name,e.name.substring(0,5)+"..."):localStorage.setItem(h._dataNames.name,e.name),localStorage.setItem(h._dataNames.uSNPId,h.utils.hashCode(e.b)),localStorage.setItem(h._dataNames.time,(new Date).setMinutes((new Date).getMinutes()+5)),localStorage.setItem(h._dataNames.session,e.session_begin),localStorage.setItem(h._dataNames.cnumber,e.cnumber),localStorage.setItem(h._dataNames.cstats,e.contract_status),h._cookie&&((t=new Date).setFullYear(t.getFullYear()+20),$.cookie(h._dataNames.uID,e.uid,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),$.cookie(h._dataNames.idId,e.userid,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),$.cookie(h._dataNames.email,e.email,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),1<e.name.split(" ").length?$.cookie(h._dataNames.name,e.name.split(" ")[0],{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}):8<e.name.length?$.cookie(h._dataNames.name,e.name.substring(0,5)+"...",{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}):$.cookie(h._dataNames.name,e.name,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),$.cookie(h._dataNames.uSNPId,h.utils.hashCode(e.b),{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),$.cookie(h._dataNames.time,(new Date).setMinutes((new Date).getMinutes()+5),{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),$.cookie(h._dataNames.session,e.session_begin,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),$.cookie(h._dataNames.cnumber,e.cnumber,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t}),$.cookie(h._dataNames.cstats,e.contract_status,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath(),expires:t})),o)return GztAuth.utils.clearUser(),o(e);a&&"checkid"===a||(h._afterLogin?h._afterLogin(e):(t=h.utils.urlParam("redirect"))&&""!==t?f.location=t:e.redirect&&(f.location=e.redirect))}},h.FillMenu=function(){if(h.utils.logs("FillMenu",""),h.utils.logs("isLogged",h.utils.userLogged()),localStorage){var e=$("[id='gzt_menu']");if(e&&0!==e.length)for(var t,a,o,r=0,i=e.length;r<i;r++)e[r]&&(t=jQuery(e[r]),a=h.utils.GetInfo(h._dataNames.name),o=h.utils.GetInfo(h._dataNames.email),a&&o?(t.find(" #gzt_user_name")[0]&&t.find(" #gzt_user_name").text(decodeURI(a)),t.find(" #gzt_user_email")[0]&&t.find(" #gzt_user_email").text(o),t.find(" #gzt_no_user")[0]&&t.find(" #gzt_no_user").hide(),t.show(),jQuery("#gzt_menu_check")[0]&&(jQuery("#gzt_menu_check_isloged")&&jQuery("#gzt_menu_check_isloged").show(),jQuery("#gzt_menu_check_isnotloged").hide(),jQuery("#gzt_menu_check").show()),h.utils.logs("user",{name:a,mail:o})):(t.find(" #gzt_user")[0]&&t.find(" #gzt_user").hide(),t.show(),jQuery("#gzt_menu_check")[0]&&(jQuery("#gzt_menu_check_isnotloged")[0]&&jQuery("#gzt_menu_check_isnotloged").show(),jQuery("#gzt_menu_check_isloged").hide(),jQuery("#gzt_menu_check").show())))}},h.ForgotCheck=function(){var e,t=h.utils.urlParam("vtoken"),a=h.utils.urlParam("u");h.utils.CheckInputFunction("gzt-function-forgotchangepass")&&t&&a&&(h.utils.LogsGoupS("Gazeta API - Auth:  Forgot Change Pass"),t&&(h.utils.logs("vtoken found",t),e=jQuery("input[name=vtoken]"))&&e.val(t),a&&(h.utils.logs("u found",a),e=jQuery("input[name=u]"))&&e.val(a),h.utils.LogsGoupE("Gazeta API - Auth:  Forgot Change Pass"))},h.VerifyEmail=function(){0<=f.location.search.indexOf("vtype=emailverification")&&(h.utils.logs("verifyemail found",h.utils.urlParam("vtoken")),$.ajax({type:"POST",dataType:"json",url:h._endpoint+"/auth/verifyemail",data:{vtoken:h.utils.urlParam("vtoken")}}).done(function(e){h.utils.logs("verifyemail",e),e.isPosted?jQuery("#verifyemailmsg")[0]?jQuery("#verifyemailmsg").text(h._msg.ve01):alert(h._msg.ve01):jQuery("#verifyemailerror")[0]?jQuery("#verifyemailerror").text(e.msg):alert(e.msg)}).fail(function(e){h.utils.logs("verifyemail error",e)}))},h.CheckChangePass=function(){if(h.utils.CheckInputFunction("gzt-function-changepass")){var e,t;if(f.top===f.self)if(!h.utils.userLogged())return h.utils.logs("Change Pass Cancel","User Unknown"),e=(t=jQuery("input[name=gzt-function-changepass]").parent()).find("#error"),(t=t.find("button"))[0]&&t.prop("disabled",!0),void(e[0]?e.text(h._error.cp02):alert(h._error.cp02));h.utils.logs("Change Pass found","gzt-function-changepass")}},h.SmartLock={Set:function(e,t){h.SmartLock.Usable()&&f.PasswordCredential&&(h.utils.logs("SmartLock","Set"),PasswordCredential)&&(t=new PasswordCredential({id:e,password:t,name:e}),navigator.credentials.store(t).then(function(){}))},Get:function(){var t,a,o,r,i,n;h.SmartLock.Usable()&&!h.utils.userLogged()&&jQuery("input[name=gzt-function-login]")&&"yes"===jQuery("input[name=gzt-function-login]").val()&&(t=jQuery("input[name=gzt-function-login]").parent(),a=t.find("input[name=redirect]")?t.find("input[name=redirect]").val():null,o=t.find("input[name=emailverificationurl]")?t.find("input[name=emailverificationurl]").val():null,r=t.find("#loading"),i=t.find("#error"),h.utils.logs("SmartLock","Get"),n=h,navigator.credentials.get({password:!0,mediation:"optional"}).then(function(e){e&&n.makeLogin(e.name,e.password,o,r,i,a,t.attr("id"))}))},Usable:function(){return f.top===f.self&&"credentials"in navigator}},h.Init=function(){h._initRun=!0,h.ForgotCheck(),h.VerifyEmail(),h.FillMenu(),h.CheckUserId(),h.SmartLock.Get(),h.CheckChangePass(),h.utils.CallQUEFunctions(),h._ready=!0,GztAuth.utils.logs("ready","")},h.utils={logs:function(e,t){h._logs&&console.info("%c Gazeta API - Auth: ","color: #4a87b1",e,t)},GetInfo:function(e){return localStorage.getItem(e)||(h._cookie?$.cookie(e):"")},SetCookieDomain:function(){return 0<=document.location.host.indexOf("localhost")?"localhost":"."+document.location.host.substring(document.location.host.indexOf(".",document.location.host.indexOf(".")-1)+1).replace(":3000","")},SetCookiePath:function(){return"/"},LogsGoupS:function(e){h._logs&&console.group("%c "+e,"color: #4a87b1")},LogsGoupE:function(e){h._logs&&console.groupEnd(e)},hashCode:function(e){var t,a=0;if(0!==this.length)for(t=0;t<this.length;t++)a=(a<<5)-a+this.charCodeAt(t),a|=0;return a},rndStr:function(e){return Math.random().toString(36).substring(e)},userLogged:function(){return!!(h.utils.GetInfo(h._dataNames.uID)&&""!=h.utils.GetInfo(h._dataNames.uID)&&h.utils.GetInfo(h._dataNames.idId)&&""!=h.utils.GetInfo(h._dataNames.idId)&&h.utils.GetInfo(h._dataNames.email)&&""!=h.utils.GetInfo(h._dataNames.email))||(h.utils.clearUser(),!1)},clearUser:function(){localStorage.removeItem(h._dataNames.uID),localStorage.removeItem(h._dataNames.idId),localStorage.removeItem(h._dataNames.email),localStorage.removeItem(h._dataNames.name),localStorage.removeItem(h._dataNames.uSNPId),localStorage.removeItem(h._dataNames.time),localStorage.removeItem(h._dataNames.session),localStorage.removeItem(h._dataNames.cnumber),localStorage.removeItem(h._dataNames.cstats),h._cookie&&($.removeCookie(h._dataNames.uID,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.idId,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.email,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.name,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.uSNPId,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.time,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.session,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.cnumber,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}),$.removeCookie(h._dataNames.cstats,{domain:h.utils.SetCookieDomain(),path:h.utils.SetCookiePath()}))},urlParam:function(e){e=new RegExp("[?&]"+e+"=([^&#]*)").exec(f.location.href);return null==e?null:e[1]||0},CallPOPUPLogin:function(){function e(e){e.data&&e.data.uid&&(GztAuth.ProcessData(e.data),jQuery("#"+GztAuth._popUpIdCP).hide(),location.reload())}h._popUpId="gzt_popup_"+h.utils.rndStr(7),jQuery("head").prepend("<style>.popup { width:100%; height:100%; display:none; position:fixed; top:0px; left:0px; background:rgba(0,0,0,0.75); } /* Inner */ .popup-inner { width: 100%; height: 100%; position:absolute; top:50%; left:50%; -webkit-transform:translate(-50%, -50%); transform:translate(-50%, -50%); box-shadow:0px 2px 6px rgba(0,0,0,1); border-radius:3px; background:#fff; } /* Close Button */ .popup-close { width:30px; height:30px; padding-top:5px; display:inline-block; position:absolute; top: 27px; right:20px; transition:ease 0.25s all; -webkit-transform:translate(50%, -50%); transform:translate(50%, -50%); border-radius:5px; background:rgba(0,0,0,0.8); font-family:Arial, Sans-Serif; font-size:20px; text-align:center; line-height:100%; color:#fff; } .popup-close:hover { background:rgba(0,0,0,1); text-decoration:none; }</style>"),jQuery("body").prepend('<div id="'+h._popUpId+'" class="popup"><div class="popup-inner"><iframe id="'+h._popUpId+'-iframe" scrolling="yes" style="width: 100%; height: 100%;" src="'+h._endpoint+"/pages/login?gzt_debug=true&cb="+location.origin+'"></iframe><a class="popup-close" onclick="GztAuth.utils.ClosePOPUPLogin();return false;">x</a></div></div>'),jQuery("body").css({overflow:"hidden"}),jQuery("#"+h._popUpId).fadeIn(350),h._popUpNormalReceiver?f.addEventListener("message",e,!1):f.removeEventListener("message",e,!1)},ClosePOPUPLogin:function(){jQuery("body").css({overflow:"auto"}),jQuery("#"+h._popUpId).hide()},CallPOPUPChangePass:function(){h._popUpIdCP="gzt_popup_"+h.utils.rndStr(7),jQuery("head").prepend("<style>.popup { width:100%; height:100%; display:none; position:fixed; top:0px; left:0px; background:rgba(0,0,0,0.75); } /* Inner */ .popup-inner { width: 100%; height: 100%; position:absolute; top:50%; left:50%; -webkit-transform:translate(-50%, -50%); transform:translate(-50%, -50%); box-shadow:0px 2px 6px rgba(0,0,0,1); border-radius:3px; background:#fff; } /* Close Button */ .popup-close { width:30px; height:30px; padding-top:5px; display:inline-block; position:absolute; top: 27px; right:20px; transition:ease 0.25s all; -webkit-transform:translate(50%, -50%); transform:translate(50%, -50%); border-radius:5px; background:rgba(0,0,0,0.8); font-family:Arial, Sans-Serif; font-size:20px; text-align:center; line-height:100%; color:#fff; } .popup-close:hover { background:rgba(0,0,0,1); text-decoration:none; }</style>"),jQuery("body").prepend('<div id="'+h._popUpIdCP+'" class="popup"><div class="popup-inner"><iframe id="'+h._popUpIdCP+'-iframe" scrolling="yes" style="width: 100%; height: 100%;" src="'+h._endpoint+"/pages/changepass?cb="+location.origin+"&id="+h.utils.getUserUId()+'"></iframe><a class="popup-close" onclick="GztAuth.utils.ClosePOPUPChangePass();return false;">x</a></div></div>'),jQuery("body").css({overflow:"hidden"}),jQuery("#"+h._popUpIdCP).fadeIn(350),jQuery("#"+h._popUpIdCP).load(function(){alert("iframe is done loading")}).show()},ClosePOPUPChangePass:function(){jQuery("body").css({overflow:"auto"}),jQuery("#"+h._popUpIdCP).hide()},isMobile:{Android:function(){return navigator.userAgent.match(/Android/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)||navigator.userAgent.match(/WPDesktop/i)},any:function(){return this.Android()||this.BlackBerry()||this.iOS()||this.Opera()||this.Windows()}},ExternalModulesLoad:function(){h.utils.LogsGoupS("Gazeta API - Auth:  Load External Modules");for(var e,t,a=0,o=h._externalModules.length;a<o;a++)!1===h._externalModules[a]||"function"==typeof h._externalModules[a].usable&&!h._externalModules[a].usable()||h._externalModules[a].loaded?GztAuth.utils.logs("Load External Modules","no usable, cancel load ("+h._externalModules[a].id+")"):(h._externalModules[a].group&&h._externalModulesGroups[h._externalModules[a].group]&&h._externalModulesGroups[h._externalModules[a].group].count++,GztAuth.utils.logs("Load External Modules","load ("+h._externalModules[a].id+' async "'+!h._externalModules[a].required_for_load+'")'),h._externalModules[a].required_for_load&&GztAuth._externalRequiredCount++,t=e=void 0,(e=document.createElement("script")).async=!h._externalModules[a].required_for_load,e.id=a,e.type="text/javascript",e.onload=function(e,t){if(h._externalModules[e.currentTarget.id].loaded=!0,h._externalModules[e.currentTarget.id].required_for_load&&GztAuth._externalRequiredCount--,h._externalModules[e.currentTarget.id].group&&h._externalModulesGroups[h._externalModules[e.currentTarget.id].group]){if(h._externalModulesGroups[h._externalModules[e.currentTarget.id].group].count--,0===h._externalModulesGroups[h._externalModules[e.currentTarget.id].group].count)return h._externalModulesGroups[h._externalModules[e.currentTarget.id].group].cb()}else h._externalModules[e.currentTarget.id].onLoaded&&h._externalModules[e.currentTarget.id].onLoaded();0!==GztAuth._externalRequiredCount||h._initRun||GztAuth.Init()},h._externalModules[a].m_protocol?(t="https:"==document.location.protocol,e.src=(t?"https:":"http:")+h._externalModules[a].url):e.src=h._externalModules[a].url,(t=document.getElementsByTagName("head")[0]).parentNode.insertBefore(e,t));h.utils.LogsGoupE("Gazeta API - Auth:  Load External Modules")},CheckInputFunction:function(e){return!(!e||""===e||!(e=jQuery("input[name="+e+"]"))[0]||"yes"!==e.val()||!e.parent().is(":visible"))},getUserUId:function(){if(h.utils.userLogged())return h.utils.GetInfo(h._dataNames.uID)},CallQUEFunctions:function(){if(h.que&&h.que.elem&&h.que.elem.length){for(var e=0,t=h.que.elem.length;e<t;e++)if("function"==typeof h.que.elem[e]){GztAuth.utils.logs("Calling QUEUE","");try{h.que.elem[e].call()}catch(e){GztAuth.utils.logs("Error calling external function",e.message)}}h.que.elem=[]}}}}).prototype={_endpoint:(location.protocol||"http:")+(-1<location.hostname.indexOf("hom.")||-1<location.hostname.indexOf("hom-")||-1<location.hostname.indexOf("hm.")||-1<location.hostname.indexOf("hm-")?"//hm-api.agazeta.com.br":"//api.agazeta.com.br"),_ready:!1,_initRun:!1,_cookie:!1,_afterLogin:null,que:queA||new e||[],_error:{l01:"Os campos não podem ficar vazios!",r01:"Preencha os campos corretamente!",ce01:"Preencha os campos corretamente!",fp01:"Preencha os campos corretamente!",fcp01:"Preencha os campos corretamente!",cp01:"Preencha os campos corretamente!",cp02:"É necessário fazer o login primeiro!",general:"#999 - Tente novamente mais tarde"},_msg:{r01:"Conta criada com sucesso, enviamos para o seu email um link para confirmação da sua conta. \nCaso não encontre verifique a caixa de SPAM.",r02:"Conta criada com sucesso, faça login para continuar",r03:"Conta criada com sucesso, enviamos para o seu email um link para confirmação da sua conta. \nCaso não encontre verifique a caixa de SPAM.\nNão foi possível cadastrar na newsletter.",r04:"Conta criada com sucesso, faça login para continuar.\nNão foi possível cadastrar na newsletter.",fp01:"Enviamos uma mensagem para o seu e-email. Por favor, verifique a sua caixa de entrada para concluir a alteração de senha.",cp01:"Senha alterada com sucesso!",ve01:"Email verificado com sucesso, faça login!",fcp01:"Senha alterada com sucesso!"},_logs:0<=location.search.indexOf("gzt_debug"),_popUpId:"",_popUpIdCP:"",_popUpNormalReceiver:!0,_dataNames:{uID:"go_user_uid",idId:"go_user_id",name:"go_user_name",email:"go_user_email",uSNPId:"go_user_uSNP",time:"go_user_time",naveggsend:"navegg_send",session:"go_h_session",cnumber:"cnumber_",cstats:"cstats_",aux:"fb_aux"},_products:{gol:{_cxenseprefix:"gaz"}}},"undefined"!=typeof exports?exports.GztAuth=GztAuth:f.GztAuth=GztAuth,jQuery(function(e){(GztAuth=new GztAuth)._externalModules=[{id:"cookie",required_for_load:!0,m_protocol:!1,url:"//static.agazeta.com.br/caixa_api/assets/prod/auth/jquery.cookie.js",usable:!0,loaded:!1,onLoaded:function(){GztAuth._cookie=!0,e.cookie&&(e.cookie.raw=!0),GztAuth.Init()}}],GztAuth._externalRequiredCount=0,GztAuth.utils.logs("running",""),GztAuth.utils.ExternalModulesLoad()})}(this,document);