PageSourceSearch

https://www.law-russia.ru/local/templates/lawrussia/js/custom.js?v=11

js law-russia.ru collected 2026-10-04 21:08:29 UTC 8,318 bytes, 214 lines download raw bytes

1$(function(){
2
3  // === Banner Form (header hero) ===
4  var $bf = $("#bannerForm");
5  if ($bf.length) {
6    $bf.on("submit", function(e){
7      e.preventDefault();
8      var $f = $(this);
9      if (!$f.find("[name=iaccept_1]").is(":checked")) {
10        alert("Подтвердите согласие на обработку данных");
11        return;
12      }
13      var $btn = $f.find(".btn-submit");
14      if ($btn.data("busy")) return;
15      $btn.data("busy", true).text("Отправляю...");
16      $.ajax({
17        type: "POST",
18        url: "/local/ajax/lt_form.php",
19        data: $f.serialize(),
20        success: function(res){
21          var d = typeof res === "string" ? JSON.parse(res) : res;
22          if (d && d.status === "ok") {
23            $f.find(".banner-form-success").show();
24            $btn.hide();
25            $f.trigger("reset");
26          } else {
27            if (d && d.code === "captcha" && typeof window.lrRefreshCaptcha === "function") window.lrRefreshCaptcha($f[0]);
28            alert(d && d.message ? d.message : "Ошибка");
29            $btn.data("busy", false).text("Отправить");
30          }
31        },
32        error: function(){ alert("Ошибка соединения"); $btn.data("busy", false).text("Отправить"); }
33      });
34    });
35  }
36
37  // === Footer Form ===
38  var $ff = $("#footerForm");
39  if ($ff.length) {
40    $ff.on("submit", function(e) {
41      e.preventDefault();
42      var $f = $(this);
43      if (!$f.find("[name=iaccept_1]").is(":checked")) {
44        alert("Подтвердите согласие на обработку данных");
45        return;
46      }
47      var $btn = $f.find(".btn-submit");
48      if ($btn.data("busy")) return;
49      $btn.data("busy", true).text("Отправляю...");
50      $.ajax({
51        type: "POST",
52        url: "/local/ajax/lt_form.php",
53        data: $f.serialize(),
54        success: function(res) {
55          var d = typeof res === "string" ? JSON.parse(res) : res;
56          if (d && d.status === "ok") {
57            $f.find(".footer-form-success").show();
58            $btn.hide();
59            $f.trigger("reset");
60            if (typeof window.ltSendGoalZayavka === "function") { window.ltSendGoalZayavka(); }
61          } else {
62            if (d && d.code === "captcha" && typeof window.lrRefreshCaptcha === "function") window.lrRefreshCaptcha($f[0]);
63            alert(d && d.message ? d.message : "Ошибка");
64            $btn.data("busy", false).text("ОТПРАВИТЬ");
65          }
66        },
67        error: function() {
68          alert("Ошибка соединения");
69          $btn.data("busy", false).text("ОТПРАВИТЬ");
70        }
71      });
72    });
73  }
74
75  // === Content Form (formback in page) ===
76  var $cf = $("#contentForm");
77  if ($cf.length) {
78    $cf.on("submit", function(e) {
79      e.preventDefault();
80      var $f = $(this);
81      if (!$f.find("[name=iaccept_1]").is(":checked")) {
82        alert("Подтвердите согласие на обработку данных");
83        return;
84      }
85      var $btn = $f.find(".btn-submit");
86      if ($btn.data("busy")) return;
87      $btn.data("busy", true).text("Отправляю...");
88      $.ajax({
89        type: "POST",
90        url: "/local/ajax/lt_form.php",
91        data: $f.serialize(),
92        success: function(res) {
93          var d = typeof res === "string" ? JSON.parse(res) : res;
94          if (d && d.status === "ok") {
95            $f.find(".content-form-success").text("✓ Заявка отправлена!").show();
96            $btn.hide();
97            $f.trigger("reset");
98            if (typeof window.ltSendGoalZayavka === "function") { window.ltSendGoalZayavka(); }
99          } else {
100            if (d && d.code === "captcha" && typeof window.lrRefreshCaptcha === "function") window.lrRefreshCaptcha($f[0]);
101            alert(d && d.message ? d.message : "Ошибка");
102            $btn.data("busy", false).text("ОТПРАВИТЬ");
103          }
104        },
105        error: function() {
106          alert("Ошибка соединения");
107          $btn.data("busy", false).text("ОТПРАВИТЬ");
108        }
109      });
110    });
111  }
112
113});
114
115// Fix fancybox popup sizing
116$(document).on("afterShow.fb", function() {
117  var $wrap = $(".fancybox-wrap");
118  if ($wrap.find("#form_popap").length) {
119    $wrap.css({"width": "460px", "left": "50%", "position": "fixed", "margin-left": "0", "transform": "translate(-50%, -50%)", "top": "50%"});
120    $wrap.find(".fancybox-inner").css({"width": "auto", "overflow": "visible"});
121    $wrap.find(".fancybox-skin").css({"padding": "0", "background": "transparent", "box-shadow": "none"});
122  }
123});
124// Also try fancybox afterShow callback
125if ($.fancybox && $.fancybox.defaults) {
126  var origAfterShow = $.fancybox.defaults.afterShow || function(){};
127  $.fancybox.defaults.afterShow = function() {
128    origAfterShow.apply(this, arguments);
129    var $wrap = $(".fancybox-wrap");
130    if ($wrap.find("#form_popap").length) {
131      $wrap.css({"width": "460px", "left": "50%", "position": "fixed", "margin-left": "0", "transform": "translate(-50%, -50%)", "top": "50%"});
132      $wrap.find(".fancybox-inner").css({"width": "auto", "overflow": "visible"});
133      $wrap.find(".fancybox-skin").css({"padding": "0", "background": "transparent", "box-shadow": "none"});
134    }
135  };
136}
137
138// Fallback: MutationObserver
139var popupObserver = new MutationObserver(function(mutations) {
140  mutations.forEach(function(m) {
141    if (m.target.classList && m.target.classList.contains("fancybox-wrap") && m.target.style.width) {
142      if ($(m.target).find("#form_popap").length) {
143        m.target.style.width = "460px";
144        m.target.style.left = "50%";
145        m.target.style.marginLeft = "-230px";
146        $(m.target).find(".fancybox-inner").css({"width": "auto", "overflow": "visible"});
147        $(m.target).find(".fancybox-skin").css({"padding": "0", "background": "transparent", "box-shadow": "none"});
148      }
149    }
150  });
151});
152$(".fancybox-wrap").each(function() {
153  popupObserver.observe(this, {attributes: true, attributeFilter: ["style"]});
154});
155// Observe body for new fancybox-wrap
156var bodyObs = new MutationObserver(function(mutations) {
157  $(".fancybox-wrap").each(function() {
158    if ($(this).find("#form_popap").length && this.style.width !== "460px") {
159      this.style.width = "460px"; this.style.position = "fixed";
160      this.style.left = "50%";
161      this.style.marginLeft = "0"; this.style.top = "50%"; this.style.transform = "translate(-50%, -50%)";
162      $(this).find(".fancybox-inner").css({"width": "auto", "overflow": "visible"});
163      $(this).find(".fancybox-skin").css({"padding": "0", "background": "transparent", "box-shadow": "none"});
164    }
165  });
166});
167bodyObs.observe(document.body, {childList: true, subtree: true, attributes: true, attributeFilter: ["style"]});
168
169// Custom calltype dropdown (popup)
170$(document).on("click", "#popup_calltype_btn", function(e) {
171  e.stopPropagation();
172  $("#popup_calltype_list").toggleClass("open");
173});
174$(document).on("click", ".lr-calltype-option", function() {
175  var val = $(this).data("value");
176  var html = $(this).html();
177  $("#popup_calltype").val(val);
178  $("#popup_calltype_btn").html(html);
179  $("#popup_calltype_list").removeClass("open");
180});
181$(document).on("click", function() {
182  $("#popup_calltype_list").removeClass("open");
183});
184
185// === Phone mask for all forms ===
186$(function() {
187  if ($.fn.mask) {
188    $("input[name=phone]").mask("+7 (999) 999-99-99");
189  }
190});
191
192// FAQ accordion
193document.addEventListener("DOMContentLoaded", function() {
194    document.querySelectorAll("ul.faq li h4").forEach(function(h4) {
195        h4.addEventListener("click", function() {
196            this.parentElement.classList.toggle("open");
197        });
198    });
199});
200
201// Push JivoChat widget above mobile bar on mobile
202(function(){
203    if (window.innerWidth > 991) return;
204    function pushJivo() {
205        document.querySelectorAll('jdiv[class*="wrap_"], jdiv[class*="__jivoMobileButton"]').forEach(function(el) {
206            el.style.setProperty('bottom', '80px', 'important');
207        });
208    }
209    setTimeout(pushJivo, 2000);
210    setTimeout(pushJivo, 5000);
211    setTimeout(pushJivo, 10000);
212    var observer = new MutationObserver(pushJivo);
213    observer.observe(document.body, { childList: true, subtree: true });
214})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.