PageSourceSearch

https://chipokids.ru/bitrix/components/aspro/marketing.popup/templates/max/js/jqmInit.js?17576139875742

js chipokids.ru collected 2026-10-06 11:07:06 UTC 5,742 bytes, 202 lines download raw bytes

1$(document).on("click", '*[data-event="mp_jqm"]', function (e) {
2  e.preventDefault();
3  e.stopPropagation();
4
5  var _this = $(this);
6  
7  if (!$(this).hasClass("clicked")) {
8    $(this).addClass("clicked");
9    $(this).jqmExPopup();
10  }
11  
12  return false;
13});
14
15
16if (!BX.type.isFunction("onLoadjqmPopup")) {
17  var onLoadjqmPopup = function (name, hash) {
18    hash.w.attr('data-jqm-loaded', '1');
19
20    if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
21      $("body").addClass("jqm-initied");
22    }
23    
24    //marketings
25    if (name == "dyn_mp_jqm") { 
26      var eventdata = { hash: hash };
27      BX.onCustomEvent("onMarketingPopupShow", [eventdata]);
28    }
29
30    $.each($(hash.t).get(0).attributes, function (index, attr) {
31      if (/^data\-autoload\-(.+)$/.test(attr.nodeName)) {
32        var key = attr.nodeName.match(/^data\-autoload\-(.+)$/)[1];
33        var el = $('input[data-sid="' + key.toUpperCase() + '"]');
34        var value = $(hash.t).data("autoload-" + key);
35        value = String(value).replace(/%99/g, "\\"); // replace symbol \
36        el.val(BX.util.htmlspecialcharsback(value)).attr("readonly", "readonly");
37        el.closest(".form-group").addClass("input-filed");
38        el.attr("title", el.val());
39      }
40    });
41
42    // hash.w.find(">div").addClass("scrollblock");
43    hash.w.addClass("scrollblock");
44    hash.w.addClass("show").css({
45      opacity: 1,
46    });
47
48    if (hash.c.noOverlay === undefined || (hash.c.noOverlay !== undefined && !hash.c.noOverlay)) {
49      // let scrollbarWidth = window.innerWidth - document.documentElement.clientWidth + 'px';
50      // $("body").css({ "padding-right": scrollbarWidth, overflow: "hidden", height: "100vh" });
51      $("body").css({ overflow: "hidden", height: "100vh" });
52      hash.w.closest("#popup_iframe_wrapper").css({ "z-index": 3000, display: "flex" });
53    }
54
55    if (hash.c.noOverlay !== undefined && hash.c.noOverlay) {
56      hash.w.closest("#body_iframe_wrapper").css({ "z-index": 2999, display: "flex" });
57    }
58
59    $("." + name + "_frame").show();
60  };
61}
62
63if (!BX.type.isFunction("onHidejqmPopup")) {
64  var onHidejqmPopup = function (name, hash) {
65
66    if (name == "dyn_mp_jqm") { 
67      var eventdata = { hash: hash };
68      BX.onCustomEvent("onMarketingPopupClose", [eventdata]);
69    }
70
71    hash.w.animate({ opacity: 0 }, 200, function () {
72      hash.w.hide();
73      hash.w.empty();
74      hash.o.remove();
75      hash.w.removeClass("show");
76
77      
78      if (!hash.w.closest("#popup_iframe_wrapper").find(".jqmOverlay").length) {
79        $("body").css({ "padding-right": "", overflow: "", height: "" });
80        hash.w.closest("#popup_iframe_wrapper").css({ "z-index": "", display: "" });
81      }
82
83      if (!hash.w.closest("#body_iframe_wrapper").find(".jqmWindow.show").length) {
84        hash.w.closest("#body_iframe_wrapper").css({ "z-index": "", display: "" });
85      }
86
87      if (!$(".jqmOverlay:not(.mobp)").length || $(".jqmOverlay.waiting").length) {
88        $("body").removeClass("jqm-initied");
89      }
90
91    });
92
93    window.b24form = false;
94
95    // hide bx calc
96    let items = document.querySelectorAll(".bx-calendar");
97    if (items) {
98      items.forEach(item => {
99        item.closest(".popup-window").style.display = "none";
100      });
101    }
102  };
103}
104
105$.fn.jqmExPopup = function () {
106  var _this = $(this);
107  var name = _this.data("name");
108
109  if (name.length && _this.attr("disabled") != "disabled") {
110    var extClass = "",
111      paramsStr = "",
112      trigger = "";
113
114    // call counter
115    if (typeof $.fn.jqmEx.counter === "undefined") {
116      $.fn.jqmEx.counter = 0;
117    } else {
118      ++$.fn.jqmEx.counter;
119    }
120
121    // trigger attrs and params
122    $.each(_this.get(0).attributes, function (index, attr) {
123      var attrName = attr.nodeName;
124      var attrValue = _this.attr(attrName);
125      if (attrName !== "onclick") {
126        trigger += "[" + attrName + '="' + attrValue + '"]';
127      }
128      if (/^data\-param\-(.+)$/.test(attrName)) {
129        var key = attrName.match(/^data\-param\-(.+)$/)[1];
130        paramsStr += key + "=" + attrValue + "&";
131      }
132    });   
133
134    // popup url
135    var script = arAsproOptions["SITE_DIR"] + "ajax/form.php";
136    script += "?" + paramsStr;
137
138    // use overlay?
139    var noOverlay = _this.data("noOverlay") == "Y";
140
141    // unique frame to each trigger
142    if (noOverlay) {
143      var frame = $(
144        '<div class="' +
145          name +
146          "_frame " +
147          extClass +
148          ' jqmWindow popup" data-popup="' +
149          $.fn.jqmEx.counter +
150          '"></div>'
151      ).appendTo("#body_iframe_wrapper");
152    } else {
153      var frame = $(
154        '<div class="' +
155          name +
156          "_frame " +
157          extClass +
158          ' jqmWindow popup" data-popup="' +
159          $.fn.jqmEx.counter +
160          '"></div>'
161      ).appendTo("#popup_iframe_wrapper");
162    }
163
164    let overlayClass = 'jqmOverlay';
165    if (_this.data("jqm-overlay-class")) {
166      overlayClass += " " + _this.data("jqm-overlay-class");
167    }
168
169    loadJQM(() => {
170      
171      if (frame.attr('data-jqm-loaded') === '1') { 
172        return;
173      }
174      
175      frame.jqm({
176        ajax: script,
177        trigger: trigger,
178        noOverlay: noOverlay,
179        overlayClass: overlayClass,
180        onLoad: function (hash) {
181          onLoadjqmPopup(name, hash);
182        },
183        onHide: function (hash) {
184          if (hash.w.hasClass('jqm-lock-close')) {
185            return false;
186          }
187          onHidejqmPopup(name, hash);
188        },
189      });
190      
191      _this.trigger("click");
192    });
193  }
194};
195
196function loadJQM(cb) {
197  if (typeof $.fn.jqm === "function") {
198    cb();
199  } else {
200    BX.loadScript("/bitrix/js/aspro/popup/jqModal.js?v=1", () => cb());
201  }
202}

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.