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.addClass("scrollbar"); 43 hash.w.find(">div").addClass("scrollbar"); 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 if (!$("#body_iframe_wrapper").length) { 144 $("<div id=\"body_iframe_wrapper\"></div>").insertBefore("#popup_iframe_wrapper"); 145 } 146 var frame = $( 147 '<div class="' + 148 name + 149 "_frame " + 150 extClass + 151 ' jqmWindow popup" data-popup="' + 152 $.fn.jqmEx.counter + 153 '"></div>' 154 ).appendTo("#body_iframe_wrapper"); 155 } else { 156 var frame = $( 157 '<div class="' + 158 name + 159 "_frame " + 160 extClass + 161 ' jqmWindow popup" data-popup="' + 162 $.fn.jqmEx.counter + 163 '"></div>' 164 ).appendTo("#popup_iframe_wrapper"); 165 } 166 167 let overlayClass = 'jqmOverlay'; 168 if (_this.data("jqm-overlay-class")) { 169 overlayClass += " " + _this.data("jqm-overlay-class"); 170 } 171 172 loadJQM(() => { 173 174 if (frame.attr('data-jqm-loaded') === '1') { 175 return; 176 } 177 178 frame.jqm({ 179 ajax: script, 180 trigger: trigger, 181 noOverlay: noOverlay, 182 overlayClass: overlayClass, 183 onLoad: function (hash) { 184 onLoadjqmPopup(name, hash); 185 }, 186 onHide: function (hash) { 187 if (hash.w.hasClass('jqm-lock-close')) { 188 return false; 189 } 190 onHidejqmPopup(name, hash); 191 }, 192 }); 193 194 _this.trigger("click"); 195 }); 196 } 197}; 198 199function loadJQM(cb) { 200 if (typeof $.fn.jqm === "function") { 201 cb(); 202 } else { 203 BX.loadScript("/bitrix/js/aspro/popup/jqModal.js?v=1", () => cb()); 204 } 205}
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.