1var obCatalogMenu = { 2 click:function(self){ 3 var $self=$(self); 4 var $parent=$self.parents("[data-parent]:first"); 5 var $ul = $parent.find("[data-slide]"); 6 if(!$ul.length) return true; 7 8 $ul.slideToggle(); 9 $parent.toggleClass("selected"); 10 return false; 11 }, 12 clickSecond:function(self){ 13 var $self=$(self); 14 var $idToggleBlock=$self.data("id-toggle-block"); 15 var $toggleBlock = $(document).find("[data-id-block='"+$idToggleBlock+"']"); 16 17 18 $toggleBlock.slideToggle(); 19 $toggleBlock.toggleClass("catalog_menu_second-close"); 20 $self.toggleClass("catalog_menu_second-arrow-close"); 21 return false; 22 }, 23 mousein:function(self){ 24 var $self=$(self); 25 var $menu=$("[data-droppable-parent-class]"); 26 $menu.width($self.width()); 27 } 28}; 29 30var height_menu = 0; 31$('.menuOpenCatalog .cat_nav > li').each(function (i) { 32 if (i < 14) { 33 34 height_menu += $(this)[0].offsetHeight; 35 } 36 37}) 38 39$('document').ready(function () { 40 41 42 43 // $('.menuOpenCatalog').css({ 'height': height_menu }) 44 45 /* $(".menuOpenCatalog ").mCustomScrollbar({ 46 //axis: "y", 47 });*/ 48}); 49 50;(function () { 51 if (window.mkCatalogSubmenuDelayBound) return; 52 window.mkCatalogSubmenuDelayBound = true; 53 54 var closeDelay = 350; 55 var closeTimers = new WeakMap(); 56 57 function isDesktop() { 58 return window.matchMedia('(min-width: 1025px)').matches; 59 } 60 61 function getMenuItem(target) { 62 if (!target || !target.closest) return null; 63 64 var item = target.closest('.catalog-menu .menu-item-has-children'); 65 return item && item.querySelector(':scope > ul') ? item : null; 66 } 67 68 function cancelClose(item) { 69 var timer = closeTimers.get(item); 70 if (!timer) return; 71 72 window.clearTimeout(timer); 73 closeTimers.delete(item); 74 } 75 76 function activateItem(item) { 77 var catalogMenu = item.closest('.catalog-menu'); 78 if (!catalogMenu) return; 79 80 Array.prototype.forEach.call( 81 catalogMenu.querySelectorAll('.menu-item-has-children.submenu-delay-active'), 82 function (otherItem) { 83 cancelClose(otherItem); 84 if (otherItem !== item) { 85 otherItem.classList.remove('submenu-delay-active'); 86 } 87 } 88 ); 89 90 cancelClose(item); 91 item.classList.add('submenu-delay-active'); 92 catalogMenu.dataset.submenuDelayBound = '1'; 93 } 94 95 function scheduleClose(item) { 96 cancelClose(item); 97 closeTimers.set(item, window.setTimeout(function () { 98 item.classList.remove('submenu-delay-active'); 99 closeTimers.delete(item); 100 }, closeDelay)); 101 } 102 103 // ÐелегиÑование ÑÐ¾Ñ ÑанÑÐµÑ ÑабоÑÑ Ð¿Ð¾Ñле Ð·Ð°Ð¼ÐµÐ½Ñ Ð¼ÐµÐ½Ñ ÐºÐ¾Ð¼Ð¿Ð¾Ð·Ð¸ÑнÑм кеÑем Bitrix. 104 document.addEventListener('mouseover', function (event) { 105 if (!isDesktop()) return; 106 107 var item = getMenuItem(event.target); 108 if (item) activateItem(item); 109 }); 110 111 document.addEventListener('mouseout', function (event) { 112 if (!isDesktop()) return; 113 114 var item = getMenuItem(event.target); 115 if (!item) return; 116 117 var nextTarget = event.relatedTarget; 118 if (nextTarget && item.contains(nextTarget)) return; 119 120 scheduleClose(item); 121 }); 122 123 document.addEventListener('click', function () { 124 window.setTimeout(function () { 125 Array.prototype.forEach.call( 126 document.querySelectorAll('.catalog-menu:not(.is-active) .submenu-delay-active'), 127 function (item) { 128 cancelClose(item); 129 item.classList.remove('submenu-delay-active'); 130 } 131 ); 132 }, 0); 133 }); 134})(); 135 136;(function () { 137 if (window.mkCatalogDesktopHoverBound) return; 138 window.mkCatalogDesktopHoverBound = true; 139 140 var closeTimer = null; 141 var closeDelay = 350; 142 143 function isDesktop() { 144 return window.matchMedia('(min-width: 1025px)').matches; 145 } 146 147 function getCatalogMenu() { 148 return document.querySelector('.catalog-menu'); 149 } 150 151 function cancelClose() { 152 if (!closeTimer) return; 153 154 window.clearTimeout(closeTimer); 155 closeTimer = null; 156 } 157 158 function openMenu() { 159 var catalogMenu = getCatalogMenu(); 160 if (!catalogMenu) return; 161 162 cancelClose(); 163 catalogMenu.classList.add('is-active'); 164 document.body.style.overflow = 'hidden'; 165 } 166 167 function closeMenu() { 168 var catalogMenu = getCatalogMenu(); 169 if (!catalogMenu) return; 170 171 catalogMenu.classList.remove('is-active'); 172 document.body.style.overflow = ''; 173 closeTimer = null; 174 } 175 176 function scheduleClose() { 177 cancelClose(); 178 closeTimer = window.setTimeout(closeMenu, closeDelay); 179 } 180 181 function isCatalogArea(target) { 182 return !!( 183 target && 184 target.closest && 185 (target.closest('.popup-menu-button') || target.closest('.catalog-menu')) 186 ); 187 } 188 189 function isPointInside(element, clientX, clientY) { 190 if (!element) return false;
191 192 var rect = element.getBoundingClientRect(); 193 return clientX >= rect.left && clientX <= rect.right && 194 clientY >= rect.top && clientY <= rect.bottom; 195 } 196 197 // ÐелегиÑование пÑÐ¾Ð´Ð¾Ð»Ð¶Ð°ÐµÑ ÑабоÑаÑÑ Ð¿Ð¾Ñле композиÑной Ð¿Ð¾Ð´Ð¼ÐµÐ½Ñ Ñапки. 198 document.addEventListener('mouseover', function (event) { 199 if (!isDesktop() || !isCatalogArea(event.target)) return; 200 201 cancelClose(); 202 if (event.target.closest('.popup-menu-button')) { 203 openMenu(); 204 } 205 }); 206 207 document.addEventListener('mouseout', function (event) { 208 if (!isDesktop() || !isCatalogArea(event.target)) return; 209 if (isCatalogArea(event.relatedTarget)) return; 210 211 scheduleClose(); 212 }); 213 214 // ÐÐ¾Ð´Ð¼ÐµÐ½Ñ Ð¿Ð¾Ð·Ð¸ÑиониÑÑеÑÑÑ absolute оÑноÑиÑелÑно .catalog-menu-wrapper и 215 // ÑизиÑеÑки вÑÑ Ð¾Ð´Ð¸Ñ Ð·Ð° пÑÑмоÑголÑник .catalog-menu, поÑÑÐ¾Ð¼Ñ Ð¿ÑовеÑка по 216 // кооÑдинаÑам ÑÑиÑала пÑавÑÑ ÑаÑÑÑ Ð¼ÐµÐ½Ñ Ð²Ð½ÐµÑней облаÑÑÑÑ Ð¸ закÑÑвала его. 217 function isPointInsideOpenSubmenu(catalogMenu, clientX, clientY) { 218 var submenus = catalogMenu.querySelectorAll('.menu-item-has-children > ul'); 219 220 for (var i = 0; i < submenus.length; i++) { 221 var submenu = submenus[i]; 222 var style = window.getComputedStyle(submenu); 223 224 if (style.visibility === 'hidden' || style.opacity === '0') continue; 225 if (isPointInside(submenu, clientX, clientY)) return true; 226 } 227 228 return false; 229 } 230 231 // ÐекоÑоÑÑе вложеннÑе ÑлеменÑÑ Ð¼ÐµÐ½Ñ Ð¿ÐµÑекÑÑваÑÑ ÐµÐ³Ð¾ конÑÐµÐ¹Ð½ÐµÑ Ð¸ бÑаÑÐ·ÐµÑ 232 // не вÑегда ÑообÑÐ°ÐµÑ mouseover конÑейнеÑÑ. ÐооÑдинаÑÑ Ð´Ð°ÑÑ Ð½Ð°Ð´ÑжнÑÑ 233 // ÑÑÑÐ°Ñ Ð¾Ð²ÐºÑ Ð¿Ñи диагоналÑном движении Ð¾Ñ ÐºÐ½Ð¾Ð¿ÐºÐ¸ к лÑбой ÑаÑÑи менÑ. 234 document.addEventListener('mousemove', function (event) { 235 if (!isDesktop()) return; 236 237 var catalogMenu = getCatalogMenu(); 238 if (!catalogMenu || !catalogMenu.classList.contains('is-active')) return; 239 240 var catalogButton = document.querySelector('.popup-menu-button'); 241 if ( 242 isCatalogArea(event.target) || 243 isPointInside(catalogButton, event.clientX, event.clientY) || 244 isPointInside(catalogMenu, event.clientX, event.clientY) || 245 isPointInsideOpenSubmenu(catalogMenu, event.clientX, event.clientY) 246 ) { 247 cancelClose(); 248 } else if (!closeTimer) { 249 scheduleClose(); 250 } 251 }); 252 253 // Ðа деÑкÑопе кнопка ÑлÑÐ¶Ð¸Ñ ÑолÑко облаÑÑÑÑ Ð½Ð°Ð²ÐµÐ´ÐµÐ½Ð¸Ñ. ÐобилÑнÑй клик, 254 // коÑоÑÑй Ñже Ñеализован в обÑем bundle.js, оÑÑаÑÑÑÑ Ð±ÐµÐ· изменений. 255 document.addEventListener('click', function (event) { 256 if (!isDesktop() || !event.target.closest) return; 257 if (!event.target.closest('.popup-menu-button')) return; 258 259 event.preventDefault(); 260 event.stopPropagation(); 261 }, true); 262 263 window.addEventListener('resize', function () { 264 if (!isDesktop()) cancelClose(); 265 }); 266})();
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.