1(function(window) { 2 3 if (!window.BX || BX.CatalogMenu) 4 return; 5 6 BX.CatalogMenu = { 7 items : {}, 8 idCnt : 1, 9 currentItem : null, 10 overItem : null, 11 outItem : null, 12 timeoutOver : null, 13 timeoutOut : null, 14 15 getItem : function(item) 16 { 17 if (!BX.type.isDomNode(item)) 18 return null; 19 20 var id = !item.id || !BX.type.isNotEmptyString(item.id) ? (item.id = "menu-item-" + this.idCnt++) : item.id; 21 22 if (!this.items[id]) 23 this.items[id] = new CatalogMenuItem(item); 24 25 return this.items[id]; 26 }, 27 28 itemOver : function(item) 29 { 30 var menuItem = this.getItem(item); 31 if (!menuItem) 32 return; 33 34 if (this.outItem == menuItem) 35 { 36 clearTimeout(menuItem.timeoutOut); 37 } 38 39 this.overItem = menuItem; 40 41 if (menuItem.timeoutOver) 42 { 43 clearTimeout(menuItem.timeoutOver); 44 } 45 46 menuItem.timeoutOver = setTimeout(function() { 47 if (BX.CatalogMenu.overItem == menuItem) 48 { 49 menuItem.itemOver(); 50 } 51 52 }, 100); 53 }, 54 55 itemOut : function(item) 56 { 57 var menuItem = this.getItem(item); 58 if (!menuItem) 59 return; 60 61 this.outItem = menuItem; 62 63 if (menuItem.timeoutOut) 64 { 65 clearTimeout(menuItem.timeoutOut); 66 } 67 68 menuItem.timeoutOut = setTimeout(function() { 69 70 if (menuItem != BX.CatalogMenu.overItem) 71 { 72 menuItem.itemOut(); 73 } 74 if (menuItem == BX.CatalogMenu.outItem) 75 { 76 menuItem.itemOut(); 77 } 78 79 }, 100); 80 }, 81 82 removeHover : function(curItem) 83 { 84 if (typeof curItem !== "object") 85 return false; 86 87 var items = curItem.parentNode.querySelectorAll('[data-role="bx-menu-item"]'); 88 for (var i=0; i<items.length; i++) 89 { 90 if (curItem == items[i]) 91 continue; 92 93 if (BX.hasClass(items[i], "bx-hover")) 94 BX.removeClass(items[i], "bx-hover") 95 } 96 } 97 }; 98 99 var CatalogMenuItem = function(item) 100 { 101 this.element = item; 102 this.popup = BX.findChild(item, { className: "bx_children_container" }, false, false); 103 this.isLastItem = BX.lastChild(this.element.parentNode) == this.element; 104 }; 105 106 CatalogMenuItem.prototype.itemOver = function() 107 { 108 if (!BX.hasClass(this.element, "bx-hover")) 109 { 110 BX.addClass(this.element, "bx-hover"); 111 112 var popup = BX.findChild(this.element, {className:"bx-nav-2-lvl-container"}, true, false); 113 if (popup) 114 { 115 var popupRightEdge = popup.getBoundingClientRect().left + popup.offsetWidth; 116 if (popupRightEdge > document.body.clientWidth) 117 popup.style.right = 0; 118 } 119 } 120 }; 121 122 CatalogMenuItem.prototype.itemOut = function() 123 { 124 BX.removeClass(this.element, "bx-hover"); 125 }; 126})(window); 127 128BX.namespace("BX.Main.MenuComponent"); 129BX.Main.MenuComponent.CatalogHorizontal = (function() 130{ 131 var CatalogHorizontal = function(menuBlockId, itemImgDesc) 132 { 133 this.menuBlockId = menuBlockId || ""; 134 this.itemImgDesc = itemImgDesc || ""; 135 136 this.resizeMenu(); 137 BX.bind(window, "resize", BX.proxy(this.resizeMenu, this)); 138 }; 139 140 CatalogHorizontal.prototype.clickInMobile = function(element, event) 141 { 142 if (!BX.hasClass(element, "bx-hover")) 143 { 144 event.preventDefault(); 145 } 146 }; 147 148 CatalogHorizontal.prototype.toggleInMobile = function(element) 149 { 150 var parentObj = BX.findParent(element, {className: "bx-nav-parent"}); 151 var arrow = element.firstChild; 152 if (BX.hasClass(parentObj, "bx-opened")) 153 { 154 BX.removeClass(parentObj, "bx-opened"); 155 BX.removeClass(arrow, "bx-nav-angle-top"); 156 BX.addClass(arrow, "bx-nav-angle-bottom"); 157 } 158 else 159 { 160 BX.addClass(parentObj, "bx-opened"); 161 BX.addClass(arrow, "bx-nav-angle-top"); 162 BX.removeClass(arrow, "bx-nav-angle-bottom"); 163 } 164 }; 165 166 CatalogHorizontal.prototype.resizeMenu = function() 167 { 168 var templateWrap = this.templateWrap; 169 var menuMobile = document.body.querySelector("[data-role='bx-menu-mobile']"); 170 var menuMobileButton = document.body.querySelector("[data-role='bx-menu-button-mobile']"); 171 var menuMobilePosition = document.body.querySelector("[data-role='bx-menu-button-mobile-position']"); 172 173 if (document.body.clientWidth <= 767) //mobile 174 { 175 if (!menuMobile) 176 { 177 menuMobile = BX.create("div", { 178 attrs: { 179 className: "bx-aside-nav", 180 "data-role" : "bx-menu-mobile" 181 }, 182 children: [ BX.clone(BX("ul_" + this.menuBlockId)) ] 183 }); 184 document.body.insertBefore(menuMobile, document.body.firstChild); 185 } 186 187 if (!menuMobileButton) 188 { 189 menuMobileButton = BX.create("div", { 190 attrs: {className: "bx-aside-nav-control bx-closed", "data-role" : "bx-menu-button-mobile"}, 191 children: [ 192 BX.create("i", { 193 attrs: {className: "bx-nav-bars"} 194 }) 195 ], 196 events: { 197 "click" : function() { 198 if (BX.hasClass(this, "bx-opened")) 199 { 200 BX.removeClass(this, 'bx-opened'); 201 BX.removeClass(menuMobile, 'bx-opened'); 202 BX.addClass(this, 'bx-closed'); 203 document.body.style.overflow = ""; 204 BX.removeClass(document.body, 'bx-opened'); 205 } 206 else 207 { 208 209 BX.addClass(this, 'bx-opened'); 210 BX.addClass(menuMobile, 'bx-opened'); 211 BX.removeClass(this, 'bx-closed'); 212 document.body.style.overflow = "hidden"; 213 BX.addClass(document.body, 'bx-opened'); 214 } 215 } 216 } 217 }); 218 219 // document.body.insertBefore(menuMobileButton, document.body.firstChild); 220 221 menuMobilePosition.appendChild(menuMobileButton); 222 } 223 } 224 else 225 { 226 BX.removeClass(menuMobile, 'bx-opened'); 227 BX.removeClass(document.body, 'bx-opened'); 228 document.body.style.overflow = ""; 229 230 if (menuMobileButton) 231 BX.removeClass(menuMobileButton, 'bx-opened'); 232 } 233 }; 234 235 CatalogHorizontal.prototype.changeSectionPicure = function(element, itemId) 236 { 237 var curLi = BX.findParent(element, {className: "bx-nav-1-lvl"}); 238 if (!curLi) 239 return; 240 241 var imgDescObj = curLi.querySelector("[data-role='desc-img-block']"); 242 if (!imgDescObj) 243 return; 244 245 var imgObj = BX.findChild(imgDescObj, {tagName: "img"}, true, false); 246 if (imgObj) 247 imgObj.src = this.itemImgDesc[itemId]["PICTURE"]; 248 249 var linkObj = BX.findChild(imgDescObj, {tagName: "a"}, true, false);
250 if (linkObj) 251 linkObj.href = element.href; 252 253 var descObj = BX.findChild(imgDescObj, {tagName: "p"}, true, false); 254 if (descObj) 255 descObj.innerHTML = this.itemImgDesc[itemId]["DESC"]; 256 257 }; 258 259 return CatalogHorizontal; 260})(); 261 262 263
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.