Free javascript Hosting


4br2h5b2-1.js

Uploaded on Dec 26 2021 01:37 by ginterzx

!function(){try{function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}(function(e){function n(t){if(this.nodes={},this.opened=!1,this.attachNodes(t),this.attachEvents(),this._accountsData=[],this.params=this.pickFromJson(t.getAttribute("data-bem"),"legouser"),!this.params._noCounter&&"eu"!==this.params._tld)try{this._fetchCounter()}catch(t){}if(!this.params._accounts&&(this.nodes.multiTemplate||!this._doNotShowUserPopup()))try{this._fetchAccounts()}catch(t){}if(this.params._moveTo){var n=e.document.querySelector(this.params._moveTo);n&&n.parentNode.replaceChild(this.nodes.el,n)}this._doNotShowUserPopup(this.params)&&(this.nodes.current.setAttribute("href",this.params._userClickLink),this.nodes.current.setAttribute("target","_blank")),!this._doNotShowUserPopup()&&this.params.scope&&this.scopePopup(),this.afterInit()}var o={fb:"Facebook",tw:"Twitter",mr:"Mail.ru",gg:"Google",ok:"Odnoklassniki",vk:"Vkontakte",dz:"Deezer",fs:"Foursquare",ig:"Instagram",lf:"Last.FM",lj:"LiveJournal",in:"LinkedIn",mt:"МТС-Россия",ms:"Microsoft",yh:"Yahoo",ya:"Yandex",vf:"Vodafone-Украина",tg:"Telegram"};n.prototype={afterInit:function(){},_doNotShowUserPopup:function(){return!(!this.params._noUserPopup||!this.params._userClickLink)},attachNodes:function(t){this.nodes.el=t,this.nodes.current=t.querySelector(".legouser__current-account"),this.nodes.popup=t.querySelector(".legouser__popup"),this.nodes.ticker=t.querySelector(".ticker"),this.nodes.tickerValue=t.querySelector(".ticker__value"),this.nodes.multiTemplate=t.querySelector(".user-account_template_yes"),this.nodes.multiContainer=t.querySelector(".legouser__accounts-container")},events:[{domNode:"current",event:"click",handler:"onAccountClick"},{domNode:"multiContainer",event:"click",handler:"onMultiClick"}],onAccountClick:function(t){!0===this.opened||this._doNotShowUserPopup()||(t.preventDefault(),t.isOpeningEvent=!0,this.open())},open:function(){if(this.params.scope){var t=this.nodes.current.getBoundingClientRect().top+e.document.documentElement.scrollTop+4;this.nodes.popup.style.top=t+"px"}this.nodes.popup.classList.add("light-popup_visible_yes"),this.setHeight(),this.addDocumentEvent(),this.addScrollEvent(),this.opened=!0},close:function(){this.removeScrollEvent(),this.nodes.popup.classList.remove("light-popup_visible_yes"),this.opened=!1},addDocumentEvent:function(){},removeDocumentEvent:function(){},addScrollEvent:function(){this.onWindowScrollBind=this.onWindowScroll.bind(this),e.addEventListener("scroll",this.onWindowScrollBind)},removeScrollEvent:function(){e.removeEventListener("scroll",this.onWindowScrollBind)},onWindowScroll:function(){-10>this.nodes.popup.getBoundingClientRect().top&&this.close()},onDocumentClick:function(t){t.isOpeningEvent||this.nodes.popup.contains(t.target)||(t.preventDefault(),this.removeDocumentEvent(),this.close())},onDocumentKeyDown:function(t){27===t.keyCode&&(this.removeDocumentEvent(),this.close())},onMultiClick:function(t){for(var e=t.target;e!==this.nodes.multiContainer;){if(e.classList.contains("user-account")){var n=this.pickFromJson(e.getAttribute("data-bem"),"legouser__account");return this._changeUser(n)}e=e.parentNode}},attachEvents:function(){this.events.forEach(function(t){var e=t.domNode,n=t.event,o=t.handler;this.nodes[e]&&this.nodes[e].addEventListener(n,this[o].bind(this))}.bind(this))},scopePopup:function(){e.document.body.appendChild(this.nodes.popup)},_changeUser:function(t){var n=t.uid;if(!this.params._loggedByLink){var o=this.params,s=o._passportHost,i=o._yu,r=this.params._retpath,a=e.document.createElement("form");a.setAttribute("method","POST"),a.setAttribute("action",s+"/passport?mode=embeddedauth"),a.innerHTML='<input type="hidden" name="action" value="change_default">'+'<input type="hidden" name="uid" value="'.concat(n,'">')+'<input type="hidden" name="retpath" value="'.concat(r,'">')+'<input type="hidden" name="yu" value="'.concat(i,'">'),e.document.body.appendChild(a),a.submit()}},setHeight:function(){var t=this.nodes.popup.offsetHeight;if(t){var n=this.nodes.popup.getBoundingClientRect().top,o=e.innerHeight-n-5;if(t>o){var s=this.nodes.popup.querySelector(".legouser__menu");s.style.maxHeight=o+"px",s.style.overflowY="scroll"}}},_fetchCounter:function(){var t=this,n="https://mail.yandex.".concat(this.params._tld,"/api/v2/serp/counters?silent"),o=new e.XMLHttpRequest;o.open("GET",n),o.withCredentials=!0,o.onload=function(e){if(200===e.currentTarget.status){var n=JSON.parse(e.currentTarget.response);if(n&&n.counters&&n.counters.unread){var o=n.counters.unread,s=t.nodes,i=s.tickerValue,r=s.ticker,a=t.nodes.popup.querySelector(".legouser__menu-counter");a&&(a.textContent=o,a.classList.remove("legouser__menu-counter_state_empty")),i.textContent=99<o?99:o,i.setAttribute("title",o),r.classList.remove("ticker_state_empty")}}},o.send()},_fetchAccounts:function(){var t=this,n=new e.XMLHttpRequest;n.open("GET",this.params._accountsUrl),n.withCredentials=!0,n.onload=function(e){if(200===e.currentTarget.status){var n=JSON.parse(e.currentTarget.response);return n&&n.accounts&&n.accounts.length?void t.onFetchAccountsFinish(n.accounts):void t.onFetchAccountsFinish()}},n.send()},onFetchAccountsFinish:function(t){this.setMultiAccounts(t||[])},setMultiAccounts:function(t){var e=this;this._accountsData=t;var n=this.nodes,o=n.multiTemplate,s=n.multiContainer,i=t.filter((function(t){return t.uid!==e.params._uid})).map((function(t,n){return e._renderAccount(t,n,o)})),r=t.filter((function(t){return t.uid===e.params._uid}))[0];r&&this.processCurrentAccountData(r),i.forEach((function(t){s.appendChild(t)}))},processCurrentAccountData:function(){},_getAvatarUrls:function(t){if(this.params._isInternal){var e=this.params._avatarHost||"https://center.yandex-team.ru";return{low:e+"/api/v1/user/"+(t||"0")+"/avatar/42.jpg",high:e+"/api/v1/user/"+(t||"0")+"/avatar/100.jpg"}}var n=this.params._avatarHost||"https://avatars.mds.yandex.net";return{low:"".concat(n,"/get-yapic/").concat(t,"/islands-middle"),high:"".concat(n,"/get-yapic/").concat(t,"/islands-retina-middle")}},_renderAccount:function(n,s,i){var r,a=n.defaultEmail||n.displayName.social,c=this.params._isInternal?n.login:n.displayName.default_avatar,u=i.cloneNode(!0),p={legouser__account:{uid:n.uid,pos:s}};return a="object"===t(a)?o[a.provider]:a,u.setAttribute("data-bem",JSON.stringify(p)),u.setAttribute("data-count",JSON.stringify({name:"user-menu",id:"switch-user"})),u.classList.add("count-me"),u.classList.remove("user-account_template_yes"),u.querySelector(".user-account__name-text").textContent=n.displayName.name,a&&(u.classList.add("user-account_has-subname_yes"),u.querySelector(".user-account__subname").textContent=a),this._setAvatar(u.querySelector(".user-pic__image"),this._getAvatarUrls(c)),this.params._loggedByLink?(r=e.document.createElement("a")).setAttribute("href",this._createLoggedAccountLink(n.uid)):r=e.document.createElement("div"),r.className="menu__item",r.appendChild(u),r},_createLoggedAccountLink:function(t){var e=this.params,n=e._passportHost,o=e._loggedByLinkRetpath,s=e._yu;return"".concat(n,"/passport")+"?mode=embeddedauth&action=change_default&uid=".concat(t)+"&yu=".concat(s,"&retpath=").concat(encodeURIComponent(o||n))},updateQueryRetpath:function(t,e){return t.replace(/(retpath=).*?(&)/,"$1"+encodeURIComponent(e)+"$2")},setRetpath:function(t){var e=this.nodes.popup.querySelector(".legouser__add-account"),n=this.nodes.popup.querySelector(".legouser__menu-item_action_exit");e&&e.setAttribute("href",this.updateQueryRetpath(e.getAttribute("href"),t)),n&&n.setAttribute("href",this.updateQueryRetpath(n.getAttribute("href"),t)),this.params._retpath=t},_setAvatar:function(t,e){t.setAttribute("src",e.low),t.setAttribute("srcSet","".concat(e.low," 1x, ").concat(e.high," 2x"))},pickFromJson:function(t,e){var n={};try{n=JSON.parse(t)}catch(t){}return e&&n[e]?n[e]:n}},e.Lego=e.Lego||{},e.Lego.User2Class=n})(window),window.Lego.User2Class.prototype.addDocumentEvent=function(){this.onDocumentClickBind=this.onDocumentClick.bind(this),window.addEventListener("touchend",this.onDocumentClickBind)},window.Lego.User2Class.prototype.removeDocumentEvent=function(){window.removeEventListener("touchend",this.onDocumentClickBind)};var e=window.document.querySelectorAll(".legouser");e.length>1?window.Lego.User2=Array.prototype.slice.call(e).map((function(t){return new window.Lego.User2Class(t)})):1===e.length&&(window.Lego.User2=new window.Lego.User2Class(e[0]))}catch(t){console.error("legouser:"+t)}}();

Back to list