PageSourceSearch

https://xn--63-dlcajagc1a9bj4a1d1e.xn--p1ai/bitrix/components/aspro/theme.max/templates/.default/script.js

js xn--63-dlcajagc1a9bj4a1d1e.xn--p1ai collected 2026-10-04 03:05:48 UTC 12,266 bytes, 388 lines download raw bytes

1var timerHide = false;
2var timerDynamicLeftSide = false;
3var timerResponse = false;
4var hoveredSwitcher = false;
5window.array = [];
6
7// when change on-off checkbox or selectbox in front options
8var submitTimer = false;
9var timeoutSubmit = 800
10
11$(document).ready(function () {
12  checkNeedRequest = function () {
13    return $(".style-switcher-body.loading_block").length;
14  };
15  /* get updates for solutions from aspro.ru */
16  getExternalNews = function () {
17    if (!$(".section-block.updates_tab").hasClass("hidden")) {
18      return;
19    }
20    $.ajax({
21      url: "https://aspro.ru/demo/updates/index.php",
22      type: "POST",
23      data: { AJAX_FORM: "Y" },
24      success: function (html) {
25        $(".section-block.updates_tab").removeClass("hidden");
26        $(".right-block .inner-content .contents.updates .body_block").html(html);
27      },
28      error: function (jqXhr) {
29        console.log(jqXhr);
30      },
31    });
32  };
33  /**/
34
35  getWidgetHtml = function (callback) {
36    if (checkNeedRequest()) {
37      if ($(".top_block_switch").hasClass("loading")) {
38        if (typeof callback === "function") {
39          let t = setInterval(function() {
40            if (!$(".top_block_switch").hasClass("loading")) {
41              clearInterval(t);
42              callback();
43            }
44          }, 100);
45
46          return;
47        } 
48        else {
49          return;
50        }
51      }
52    }
53    else {
54      if (typeof callback === "function") {
55        callback();
56      }
57      
58      return;
59    }
60    
61    $(".top_block_switch").addClass("loading");
62
63    try {
64      BX.ajax({
65        url: arMaxOptions["SITE_DIR"] + "?BLOCK=widget",
66        method: "POST",
67        data: BX.ajax.prepareData({ ajax: "Y" }),
68        dataType: "html",
69        processData: false,
70        start: true,
71        headers: [{ name: "X-Requested-With", value: "XMLHttpRequest" }],
72        onfailure: function (error) {
73          console.error(error);
74        },
75        onsuccess: function (html) {
76          var ob = BX.processHTML(html);
77
78          BX.loadCSS(ob.STYLE);
79
80          setTimeout(function () {
81            $(".top_block_switch").removeClass("loading");
82            $(".style-switcher-body").removeClass("loading_block").html(ob.HTML);
83             BX.ajax.processScripts(ob.SCRIPT);
84            
85                        
86            var eventdata = { action: "widgetLoaded" };
87            BX.onCustomEvent("onWidgedLoaded", [eventdata]);
88          }, 100);
89
90          if (typeof callback === "function") {
91            setTimeout(function () {
92              callback();
93            }, 150);
94          }
95        },
96      });
97    } catch (error) {
98      console.error(error);
99    }
100  };
101
102  HideHintBlock = function (bHideOverlay) {
103    if (typeof bHideOverlay === "undefined" || bHideOverlay) {
104      HideOverlay();
105    }
106    $.cookie("clickedSwitcher", "Y", { path: "/" });
107    if ($(".hint-theme").length) {
108      $(".hint-theme").fadeIn(300, function () {
109        $(".hint-theme").remove();
110      });
111    }
112  };
113
114  $(".top_block_switch").mouseenter(function () {
115    getWidgetHtml();
116    hoveredSwitcher = true;
117  });
118
119  $("html, body").on("mousedown", function (e) {
120    if (typeof e.target.className == "string" && e.target.className.indexOf("adm") < 0) {
121      e.stopPropagation();
122      if (!$(e.target).closest(".style-switcher .dynamic_left_side").length) {
123        $(".style-switcher .dynamic_left_side").removeClass("active");
124      }
125
126      if (!$(e.target).closest(".style-switcher .contents.wizard").length) {
127        $(".style-switcher .contents.wizard").removeClass("active");
128      }
129    }
130  });
131
132  $(".dynamic_left_side")
133    .find("*")
134    .on("mousedown", function (e) {
135      e.stopPropagation();
136    });
137
138  $(document).on("click", ".presets .thematik .item", function () {
139    var thematic = $(this).data("code");
140    selectThematic(thematic, true);
141  });
142
143  $(document).on("click", ".style-switcher .presets .preset-block .apply_conf_block", function (e) {
144    var preset = $(this).closest(".preset-block").data("id");
145    selectPreset(preset);
146  });
147
148  $(document).on("click", ".style-switcher .switch", function (e) {
149    e.preventDefault();
150
151    var _this = $(this);
152    var styleswitcher = _this.closest(".style-switcher");
153    var bSwitchPresets = _this.hasClass("presets_action");
154    
155    if (_this.hasClass("loadings")) return;
156    _this.addClass("loadings");
157
158    setWidgetHtml(styleswitcher, _this, bSwitchPresets);
159  });
160
161  setWidgetHtml = function (styleswitcher, _this, bSwitchPresets) {
162    getWidgetHtml(function () {
163      var presets = styleswitcher.find(".presets");
164      var parametrs = styleswitcher.find(".parametrs");
165
166      styleswitcher.find(".section-block").removeClass("active");
167      _this.removeClass("loadings");
168
169      getExternalNews();
170
171      if (typeof getAjaxForm === "function") {
172        //   getAjaxForm();
173        getAjaxForm(function () {
174          $(".section-block.demos_tab").removeClass("hidden");
175        });
176      }
177
178      if (styleswitcher.hasClass("active")) {
179        if (typeof restoreThematics === "function") {
180          restoreThematics();
181        }
182
183        // current switch type
184        var typeSwitcher = $.cookie("styleSwitcherType");
185
186        // change switcher bgcolor
187        styleswitcher.find(".switch").removeClass("active");
188        styleswitcher.find(".presets_action").removeClass("active");
189
190        if ((bSwitchPresets && typeSwitcher === "presets") || (!bSwitchPresets && typeSwitcher === "parametrs")) {
191          HideHintBlock(true);
192
193          // remove switcher type
194          $.removeCookie("styleSwitcherType", { path: "/" });
195
196          // save switcher as hidden
197          $.removeCookie("styleSwitcher", { path: "/" });
198
199          // hide switcher with transition
200          styleswitcher.addClass("closes");
201          setTimeout(function () {
202            styleswitcher.removeClass("active");
203          }, 300);
204        } else {
205          HideHintBlock(false);
206
207          // save switcher type
208          $.cookie("styleSwitcherType", bSwitchPresets ? "presets" : "parametrs", { path: "/" });
209
210          // hide switcher title
211          styleswitcher.find(".header .title").hide();
212
213          // hide any content
214          styleswitcher.find(".right-block .inner-content .contents").removeClass("active");
215
216          // set presets visible or hidden with transition and change switcher bgcolor
217          if (bSwitchPresets) {
218            // styleswitcher.find('.header .title.title-presets').show();
219            styleswitcher.find(".section-block.presets_tab").addClass("active");
220            presets.addClass("active");
221          } else if ($(this).hasClass("demo_action")) {
222            styleswitcher.find(".section-block.demos_tab").removeClass("hidden").addClass("active");
223            styleswitcher.find(".inner-content .contents.demos").addClass("active");
224
225            $.removeCookie("styleSwitcherType", { path: "/" });
226            $.removeCookie("styleSwitcher", { path: "/" });
227          } else {
228            // styleswitcher.find('.header .title.title-parametrs').show();
229            styleswitcher.find(".section-block.parametrs_tab").addClass("active");
230            parametrs.addClass("active");
231          }
232
233          $(this).addClass("active");
234        }
235      } else {
236        HideHintBlock(true);
237
238        // change switcher bgcolor
239        _this.addClass("active");
240
241        // save switcher type
242        $.cookie("styleSwitcherType", bSwitchPresets ? "presets" : "parametrs", { path: "/" });
243
244        // save switcher as open
245        $.cookie("styleSwitcher", "open", { path: "/" });
246
247        // hide any content
248        styleswitcher.find(".right-block .inner-content .contents").removeClass("active");
249
250        // set presets visible or hidden immediately before adding .active to .style-switcher
251        if (bSwitchPresets) {
252          // styleswitcher.find('.header .title.title-presets').show();
253          styleswitcher.find(".section-block.presets_tab").addClass("active");
254          presets.addClass("active");
255        } else if (_this.hasClass("demo_action")) {
256          styleswitcher.find(".section-block.demos_tab").removeClass("hidden").addClass("active");
257          styleswitcher.find(".inner-content .contents.demos").addClass("active");
258
259          $.removeCookie("styleSwitcherType", { path: "/" });
260          $.removeCookie("styleSwitcher", { path: "/" });
261        } else {
262          // styleswitcher.find('.header .title.title-parametrs').show();
263          styleswitcher.find(".section-block.parametrs_tab").addClass("active");
264          parametrs.addClass("active");
265        }
266
267        // show overlay
268        ShowOverlay();
269
270        // show switcher with transition
271        styleswitcher.removeClass("closes").addClass("active");
272      }
273    });
274  };
275
276  $(document).on("click", ".close-overlay", function () {
277    HideHintBlock();
278  });
279
280  $(".close_block").click(function () {
281    $(".jqmOverlay").trigger("click");
282  });
283
284  $(document).on("click", ".jqmOverlay", function () {
285    var styleswitcher = $(".style-switcher");
286
287    if (!$(".hint-theme").length) {
288      HideOverlay();
289    }
290
291    styleswitcher.each(function () {
292      var _this = $(this);
293      _this.addClass("closes");
294
295      setTimeout(function () {
296        _this.removeClass("active");
297      }, 300);
298
299      $(".form_demo-switcher")
300        .animate(
301          {
302            left: "-" + $(".form_demo-switcher").outerWidth() + "px",
303          },
304          100
305        )
306        .removeClass("active abs");
307    });
308
309    $(".style-switcher .switch,.style-switcher .presets_action").removeClass("active");
310
311    restoreThematics();
312
313    $.removeCookie("styleSwitcherType", { path: "/" });
314    $.removeCookie("styleSwitcher", { path: "/" });
315  });
316
317  $(document).on("click", ".sharepreset-trigger-open", function (e) {
318    e.preventDefault();
319    $(".section-block.share_tab").trigger("click");
320  });
321
322  $(document).on("click", ".style-switcher .apply", function () {
323    $("form[name=style-switcher]").submit();
324  });
325
326  $(document).on("click", ".style-switcher .preview_conf_block .btn", function () {
327    var _this = $(this);
328
329    if ($(".dynamic_left_side").length) $(".dynamic_left_side").remove();
330
331    $('<div class="dynamic_left_side"><div class="items_inner"><div class="titles_block"></div></div></div>').appendTo(
332      _this.closest(".contents.presets .presets_block")
333    );
334    $(".dynamic_left_side .titles_block").html(
335      '<div class="title">' +
336        _this.closest(".preset-block").find(".info .title").text() +
337        "</div>" +
338        '<div class="blocks_wrapper">' +
339        '<div class="cl" title="' +
340        BX.message("FANCY_CLOSE") +
341        '">' +
342        $(".close_block .closes").html() +
343        "</div>" +
344        (_this.closest(".preset-block").find(".apply_conf_block").hasClass("hidden")
345          ? ""
346          : '<div class="ch" data-id="' +
347            _this.closest(".preset-block").data("id") +
348            '">' +
349            _this.closest(".preset-block").find(".apply_conf_block").html() +
350            "</div>") +
351        "</div>"
352    );
353
354    $('<div class="desc">' + _this.closest(".preset-block").find(".info .description").text() + "</div>").appendTo(
355      $(".dynamic_left_side .items_inner")
356    );
357    if (_this.closest(".preset-block").find(".info .description").data("img"))
358      $(
359        '<div class="img"><img src="' +
360          _this.closest(".preset-block").find(".info .description").data("img") +
361          '" /></div>'
362      ).appendTo($(".dynamic_left_side .items_inner"));
363
364    /*$(".dynamic_left_side").mCustomScrollbar({
365      mouseWheel: {
366        scrollAmount: 150,
367        preventDefault: true,
368      },
369    });*/
370    if (timerDynamicLeftSide) {
371      clearTimeout(timerDynamicLeftSide);
372      timerDynamicLeftSide = false;
373    }
374    timerDynamicLeftSide = setTimeout(function () {
375      $(".dynamic_left_side").addClass("active scrollblock");
376    }, 100);
377  });
378
379  $(document).on("click", ".dynamic_left_side .ch .btn", function (e) {
380    var preset = $(this).parent().data("id");
381    selectPreset(preset);
382    $(".dynamic_left_side").removeClass("active");
383  });
384
385  $(document).on("click", ".dynamic_left_side .cl", function (e) {
386    $(".dynamic_left_side").removeClass("active");
387  });
388});

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.