meraproject/content/merakomis/js/all.min.js
keboss-m 5c21d25d45 Initial commit: Merakomis portal, Docker stack and user-reader API.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-24 11:04:05 +03:00

1 line
15 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var A,API,API_THEME,API_THEME2,H;A={init:function(){return A.w=$(window),A.P.init(),A.W.init(),A.FORM.init(),A.w.scroll(A.scroll)},scroll:function(){return A.P.scroll()},isMobile:function(){return $(window).width()<=520},mail:/^([A-Za-z0-9_-]+\.)*[A-Za-z0-9_-]+@[A-Za-z0-9_-]+(\.[A-Za-z0-9_-]+)*\.[A-Za-z]{2,6}$/,FORM:{globalPrepareValidate:function(t,o){return $(".error_text",t.$wrap).remove(),t.$wrap.removeClass("error good")},globalGood:function(t,o){return t.$wrap.addClass("good")},globalBad:function(t,o){return t.$wrap.addClass("error"),t.$wrap.append($('<div class="error_text">'+o.errors.join("<br/>")+"</div>"))},init:function(){return $.fn.FORM("setGlobalGood",A.FORM.globalGood),$.fn.FORM("setGlobalBad",A.FORM.globalBad),$.fn.FORM("setPrepareValidate",A.FORM.globalPrepareValidate)}},setCookie:function(t,o,n){var e,r;return r=" domain="+window.location.host+";",e=t+"="+o+"; expires="+new Date(n||(new Date).getTime()+5184e6).toGMTString()+"; path=/;",document.cookie=e+r,console.log(e+r),e},getCookie:function(t){return!!new RegExp("(?:; )?"+t+"=([^;]*);?").test(document.cookie)&&decodeURIComponent(RegExp.$1)},reach:function(t){return A.reachYandex(t),A.reachGoogle(t)},reachYandex:function(t){return console.log("yandex",t),"undefined"!=typeof yaCounter56139889&&null!==yaCounter56139889?yaCounter56139889.reachGoal(t):void 0},reachGoogle:function(t,o,n){return console.log("google",t,o,n),"function"==typeof gtag?gtag("event",t,{event_category:"conversion",event_action:t}):void 0}},$(document).ready(A.init),API=function(t,o={},n=null,e={}){var r;return o.nocache=(new Date).getTime(),r="/api/"+t+"/",console.log(r,o),$.ajax({url:r,type:"POST",dataType:void 0!==o.dataType?o.dataType:"html",data:o,success:function(t){if(null!==n)return"function"==typeof n?n(t,e):void 0},error:function(){return"function"==typeof n?n({error:1},e):void 0}})},API_THEME="themes.merakomis/",API_THEME2="themes.merakomis",A.F={recall:function(t){var o,n;return t=(o=$(t)).FORM(),n=t.json(),$(".res",o).hide(300),console.log("recall",n),t.validate({success:function(){return console.log(n),API(API_THEME+"sendForm",n,function(t){return console.log(t)}),o.replaceWith('<p class="send_success">Данные успешно отправлены</p>')}}),!1},recallFile:function(t){var o,n;return t=(o=$(t)).FORM(),n=t.json(),$(".res",o).hide(300),console.log("recall",n),t.validate({success:function(){var t;return console.log(n),o.ajaxForm(),t="/api/"+API_THEME+"sendForm/",o.ajaxSubmit({url:t,data:n,type:"POST",method:"POST",success:function(t){return console.log(t),o.replaceWith('<div class="send_success">Данные успешно отправлены</div>'),A.W.openThankYou()}})}}),!1}},H={menu:{},selected:{},top_selected:null,inited:!1,dir:"",title:null,data:null,scroll:[],isLoading:!1,ready:function(){if(!H.inited)return $(window).on("popstate",H.switchByWindow),H.inited=!0,H.body=$("#content"),H.title=$("title"),H.keywords=$("meta[name=keywords]"),H.description=$("meta[name=description]"),H.title=$("title"),H.$html=$("html,body"),$(window).on("scroll",H.onScroll),H.checkPage()},onScroll:function(){if(!H.isLoading)return H.scroll[window.location.href]=H.$html.scrollTop()},checkPage:function(){var t;return t=H.parse(),console.log("checkPage",t,""===t[0]),$("body").toggleClass("main",0===t.length)},reload:function(){return H.switch()},formGo:function(t){var o,n,e;return e=(o=$(t)).serialize(),void 0===(n=o.attr("action"))&&(n=window.location.pathname),H.go(n+"?"+e),!1},go:function(t,o=null,n="",e=!0){var r;if("/"===t.substr(0,1)&&(t=t.substr(1)),r="/"+t,H.data=o,history.pushState(o,n,r),e)return H.switch()},setTitle:function(t){return H.title.text(t)},switchByWindow:function(t){return H.switch(t)},switch:function(t=null){var o;return o="/"===(o=H.parse().join("/"))||""===o?"/?justContent=1":`/${o}/?justContent=1`,window.location.search.length>0&&(o+="&"+window.location.search.substr(1)),H.isLoading=!0,$.ajax({url:o,dataType:"JSON",success:function(o){var n,e,r,i,a,l,s,c;if(console.log("time_compile",o.time_compile,"bd_time",o.time_bd),"string"==typeof o.location&&""!==o.location)return H.go(o.location);if(console.log("TITLE",o.title),H.title.text(o.title),n=$(o.content),e=$(n[0]),H.setTitle(o.data.title),H.keywords.attr("content",o.keywords),H.description.attr("content",o.description),c=0,void 0!==H.scroll[window.location.href]&&null!==t&&(c=H.scroll[window.location.href]),H.body.html(e),A.P.initMini(e),n.length>1)for(r=i=1,a=n.length-1;1<=a?i<=a:i>=a;r=1<=a?++i:--i)s=document.createElement("script"),"SCRIPT"!==(l=n[r].tagName)&&"script"!==l||(s.innerHTML=$(n[r]).html(),H.body[0].appendChild(s));return H.checkPage(),H.$html.scrollTop(c),H.isLoading=!1},error:function(){return console.log("history error ")}})},SEARCH:{set:function(t,o=!1){var n;return n=window.location.pathname+"?"+t,H.go(n,null,"",o)},parse:function(){var t,o,n,e,r;if(n={},window.location.search.length>0)for(t in r=window.location.search.substr(1).split("&"))(o=(e=r[t]).indexOf("="))>=0?n[e.substr(0,o)]=e.substr(o+1):n[e]=null;return n},setValue:function(t,o,n=!1){var e,r;return(r=H.SEARCH.parse())[t]=o,e=H.SEARCH.toString(r),H.SEARCH.set(e)},toString:function(t){var o,n,e;for(o in n=[],t)e=t[o],n.push(o+"="+(null!=e?e:""));return n.join("&")},get:function(t){try{return decodeURI(H.SEARCH.parse()[t])}catch(o){return o,H.SEARCH.parse()[t]}}},parse:function(t=null){var o,n,e,r,i;for(i=[],e=0,r=(o=null!==t?t.split("/"):window.location.pathname.split("/")).length;e<r;e++)""!==(n=o[e])&&i.push(n);return i}},$(window).ready(H.ready),A.I={waitInput:function(t){return $(t).each(function(){var t,o,n;return o=(t=$(this)).attr("onclick"),n=$.trim(t.val()),t.attr("onclick","").attr("data-val",n).val(""===n?"":"Отправляется...").addClass("wait").attr("data-onclick",o).attr("disabled","disabled")})},unwaitInput:function(t){return $(t).each(function(){var t;return(t=$(this)).val(t.attr("data-val")).removeClass("wait").attr("onclick",t.attr("data-onclick")).removeAttr("disabled")})},waitButton:function(t){return $(t).each(function(){var t,o,n;if(o=(t=$(this)).attr("onclick"),"?"!==(n=$.trim(t.html())))return t.attr("onclick","").attr("data-val",n).html(""===n||"&nbsp;"===n?"":"Отправляется...").addClass("wait").attr("data-onclick",o).attr("disabled","disabled")})},unwaitButton:function(t){return $(t).each(function(){var t;return(t=$(this)).html(t.attr("data-val")).removeClass("wait").attr("onclick",t.attr("data-onclick")).removeAttr("disabled")})}},A.P={scrollTimeout:null,$scrollNumber:null,getScrollTop:function(){return Math.max(A.P.body.scrollTop(),A.P.$body.scrollTop(),A.P.$html.scrollTop())},scrollToTop:function(t=0){return A.P.$body.scrollTop(t),A.P.$html.scrollTop(t)},scrollToTopAnimate:function(){return A.P.$body.animate({scrollTop:0},500),A.P.$html.animate({scrollTop:0},500)},scrollToAnimate:function(t){return A.P.$body.animate({scrollTop:t},500),A.P.$html.animate({scrollTop:t},500)},init:function(){return A.P.body=$("body"),A.P.$body=$("body"),A.P.$html=$("html"),A.P.html=$("html,body"),A.P.initMini(),$("#b_add-basket .btn").click(function(){return $("#b_add-basket").removeClass("open")}),A.P.$totop=$("#totop"),A.P.$footer=$("#b_footer"),A.P.$soc=$("#b_footer .soc"),$(document).click(function(t){})},removeSearch:function(t){return event.stopPropagation(),event.preventDefault(),$(`.search[data-id=${t}]`).remove(),API(API_THEME2+".search/remove",{id:t},function(t){return console.log(t)})},scroll:function(){return A.P.$totop.toggleClass("show",A.w.scrollTop()>10),A.P.html.toggleClass("scroll",A.w.scrollTop()>1)},aScroll:function(){return A.P.$html.removeClass("scroll")},firstInit:function(t=A.P.body){},openMenu:function(){var t;return $("body").addClass("open_menu"),t=document.body,A.P.scrollPosition=window.pageYOffset,t.style.overflow="hidden",t.style.position="fixed",t.style.top="-"+A.P.scrollPosition+"px",t.style.width="100%"},closeMenu:function(){var t;return $("body").removeClass("open_menu"),(t=document.body).style.removeProperty("overflow"),t.style.removeProperty("position"),t.style.removeProperty("top"),t.style.removeProperty("width"),window.scrollTo(0,A.P.scrollPosition)},toMobMenu:function(){return $("#mob_menu .back").hide(),$("#mob_menu .blocks").hide(),$("#mob_menu .menu_footer2").hide(),$("#mob_menu .menu_footer").show(),$("#mob_menu .menu").show()},openMobMenu:function(){var t;return $("#mob_menu .back").show(),$("#mob_menu .blocks").show(),$("#mob_menu .blocks").html(""),$("#mob_menu .menu_footer2").show(),$("#mob_menu .menu_footer").hide(),$("#mob_menu .menu").hide(),t=$(this).attr("data-group"),API(API_THEME2+"/menu",{id:t},function(t){return $("#mob_menu .blocks").replaceWith(t),A.P.initMini($("#mob_menu .blocks"))})},initMini:function(t=A.P.body){return $("#mob_menu .subel").click(A.P.openMobMenu),$(".news",t).owlCarousel({loop:!0,nav:!0,margin:0,items:1}),$(".copy",t).click(function(t){var o,n,e;return t.stopPropagation(),t.preventDefault(),n=$(this),o=$('<div class="copy_text">'+n.attr("data-copy")+"</div>"),n.append(o),window.getSelection().removeAllRanges(),(e=document.createRange()).selectNode(o[0]),window.getSelection().addRange(e),document.execCommand("copy"),e.setEnd(n[0],0),n.addClass("copied"),setTimeout(function(){return n.removeClass("copied"),o.remove()},2e3)}),$(".i.phone").mask("+7 (999) 999-99-99"),A.P.initPreventLink(t)},getPropsForCart:function(){var t;return t={},$(".prop_price.selected").each(function(){var o;return o=$(this),t[o.attr("data-prop-id")]=o.attr("data-id")}),t},initPreventLink:function(t){},preventALink:function(t){var o,n,e;if(e=(n=$(this)).attr("href"),console.log(e,"#"===e.substr(0,1),""===e||"#"===e),n.hasClass("propagation"))return t.preventDefault(),t.stopPropagation();if(""===e||"#"===e)return t.preventDefault();if("#"===e.substr(0,1)){if(console.log("sex"),t.stopPropagation(),(o=$(e)).length>0)return A.P.scrollToAnimate(o.offset().top-60)}else if(void 0!==e){if(n.hasClass("_to_card"))return t.preventDefault(),t.stopPropagation(),$.fn.CARD("openNew",{api:n.attr("data-module"),id:n.attr("data-id")});if("/"===e.substr(0,1))return t.preventDefault(),t.stopPropagation(),H.go($(this).attr("href")),A.P.closeMenu()}}},A.W={back:null,w:null,i:null,init:function(){return console.log("ready",$("#wback")),A.W.back=$("#wback"),A.W.back.length>0?(A.W.w=$("#window"),A.W.i=$("#w_inner")):delete A.W},startLoad:function(){return A.W.i.addClass("load").html("Загрузка данных")},finishLoad:function(t){var o;return o=$(t),A.W.i.removeClass("load").html(o),A.P.initMini(o)},setHtml:function(t){return A.W.finishLoad(t)},open:function(t){return A.P.body.css("overflow","hidden"),A.W.back.addClass("open"),A.W.w.css({maxWidth:void 0!==t?t+"px":"auto"})},close:function(){var t;return A.W.back.removeClass("open"),A.P.body.css("overflow","auto"),A.W.i.html(""),"function"==typeof(t=A.W).onClose?t.onClose():void 0},openCase:function(t){return A.W.open(),A.W.startLoad(),API(API_THEME+"case",{id:t},A.W.setHtml)},openActivity:function(t){return A.W.open(),A.W.startLoad(),API(API_THEME+"activity",{id:t},A.W.setHtml)},openRecall:function(t={title:"Обратный звонок",form_type:"recall"}){return A.W.open(400),A.W.startLoad(),API(API_THEME+"formRecall",t,A.W.setHtml)},openAuth:function(){return A.W.open(600),A.W.startLoad(),API(API_THEME+"formAuth",{},A.W.setHtml)},openReg:function(){return A.W.open(600),A.W.startLoad(),API(API_THEME+"formReg",{},A.W.setHtml)},openRestore:function(){return A.W.open(600),A.W.startLoad(),API(API_THEME+"formRestore",{},A.W.setHtml)},openThankYou:function(){return A.W.open(600),A.W.startLoad(),API(API_THEME+"formThankYou",{},A.W.setHtml)},openAbuy:function(t){return A.W.open(400),A.W.startLoad(),API(API_THEME+"abuy",{id:t},A.W.setHtml)},openOneClick:function(t){return A.W.open(400),A.W.startLoad(),API(API_THEME+"oneClick",{id:t},A.W.setHtml)},openCartOneClick:function(){return A.W.open(400),A.W.startLoad(),API(API_THEME+"cartOneClick",{},A.W.setHtml)},openMap:function(){return A.W.open(1e3),A.W.startLoad(),API(API_THEME+"openMap",{},A.W.setHtml)}},function(t){var o;t.fn.PROFILE=function(n){return o[n]?o[n].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof n&&n?t.error("Метод с именем "+n+" не существует для jQuery.PROFILE"):o.init.apply(this,arguments)},o={exit:function(){return API(API_THEME2+".emp/exit",{},function(t){return window.location.href="/"})},admin:function(o){var n,e,r;return o=(n=t(o)).FORM(),(r=o.json()).dataType="JSON",e=t(".res",n).hide(300),console.log(r),o.validate({success:function(){var o;return A.I.waitButton(o=t("button",n)),API(API_THEME2+".emp/login",r,function(t){return A.I.unwaitButton(o),console.log(t),!1===t.e?window.location.reload():e.html(t.e).show(300)})}}),!1},to_sign:function(o){return t(".window").hide(),t("#sign").show()},new_pass:function(o){var n,e;return o=(n=t(o)).FORM(),(e=o.json()).dataType="JSON",t(".res",n).hide(300),console.log(e),o.validate({success:function(){var o;return A.I.waitButton(o=t("button",n)),API(API_THEME2+".emp/new_pass",e,function(n){return A.I.unwaitButton(o),console.log(n),0===n.e?(t("#sign").hide(),t("#new_pass").show()):1===n.e?alert(n.m):void 0})}}),!1},remind:function(o){var n,e;return o=(n=t(o)).FORM(),(e=o.json()).dataType="JSON",t(".res",n).hide(300),console.log(e),o.validate({success:function(){var o;return A.I.waitButton(o=t("button",n)),API(API_THEME2+".emp/remind",e,function(n){return A.I.unwaitButton(o),console.log(n),0===n.e?(t("#sign").hide(),t("#check_mail").show()):1===n.e?(t(".unknown_login").text(e.login),t("#sign").hide(),t("#unknown").show()):void 0})}}),!1},login:function(o){var n,e,r;return o=(n=t(o)).FORM(),(r=o.json()).dataType="JSON",e=t(".res",n).hide(300),o.validate({success:function(){var o;return A.I.waitButton(o=t("button",n)),API(API_THEME2+".emp/login",r,function(n){return A.I.unwaitButton(o),console.log(n),!1===n.e?window.location.reload():1===n.e?(t(".unknown_login").text(r.login),t("#sign").hide(),t("#unknown").show()):2===n.e?e.text("Неверный пароль").show(300):3===n.e?(t("[data-name=code]").show(),t("[data-name=key]").val(n.key),e.text("Введите код, отправленный в телеграм").show(300)):4===n.e?e.text("Неверный код").show(300):void 0})}}),!1},reg:function(o){var n,e;return o=(n=t(o)).FORM(),(e=o.json()).dataType="JSON",t(".res",n).hide(300),console.log(e),o.validate({success:function(){var o;return A.I.waitButton(o=t("button",n)),API(API_THEME2+".emp/reg",e,function(n){return console.log(n),A.I.unwaitButton(o),!1===n.e||0===n.e?window.location.href="/":2===n.e?(t(".unknown_login").text(e.login),t("#sign").hide(),t("#repeat_reg").show()):1===n.e?(t(".unknown_login").text(e.login),t("#sign").hide(),t("#unknown").show()):void 0})}}),!1}}}(jQuery);var indexOf=[].indexOf;!function(t){var o;t.fn.PROJECT=function(n){return o[n]?o[n].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof n&&n?t.error("Метод с именем "+n+" не существует для jQuery.PROJECT"):o.init.apply(this,arguments)},o={init:function(o){return t(".project_filter",o).each(function(){var o,n,e;return o=t(this),e=function(){var o,e,r;return o=t(this),e=o.attr("data-id"),r=o.hasClass("selected"),n.removeClass("selected"),r?e=0:o.addClass("selected"),console.log(e,r),t(".project").each(function(){var n;o=t(this);try{n=JSON.parse(o.attr("data-sections"))}catch(t){t,n=[]}return Array.isArray(n)||(n=[]),o.toggleClass("show",indexOf.call(n,e)>=0||0===e)})},(n=t(".section",o)).click(e)})}}}(jQuery);