1;(function() { 2 "use strict"; 3 4 BX(function() { 5 if (typeof BX.Landing === "undefined" || typeof BX.Landing.Main === "undefined") 6 { 7 // region INIT 8 BX.namespace("BX.Landing"); 9 10 const blocks = [].slice.call(document.getElementsByClassName("block-wrapper")); 11 if (!!blocks && blocks.length) 12 { 13 blocks.forEach(function(block) { 14 var event = new BX.Landing.Event.Block({block: block}); 15 BX.onCustomEvent("BX.Landing.Block:init", [event]); 16 }); 17 } 18 19 if (BX.Landing.EventTracker) 20 { 21 BX.Landing.EventTracker.getInstance().run(); 22 } 23 // endregion 24 25 // region PSEUDO LINKS 26 const pseudoLinks = [].slice.call(document.querySelectorAll('[data-pseudo-url*="{"]')); 27 if (pseudoLinks.length > 0) 28 { 29 pseudoLinks.forEach((link) => { 30 const linkOptions = BX.Landing.Utils.data(link, 'data-pseudo-url'); 31 if ( 32 linkOptions.href 33 && linkOptions.enabled 34 && linkOptions.href.indexOf('/bitrix/services/main/ajax.php?action=landing.api.diskFile.download') !== 0 35 ) 36 { 37 if (linkOptions.target === '_self' || linkOptions.target === '_blank') 38 { 39 link.addEventListener('click', (event) => { 40 event.preventDefault(); 41 let url = null; 42 try 43 { 44 url = new URL(linkOptions.href); 45 } 46 catch (error) 47 { 48 console.error(error); 49 } 50 if (url) 51 { 52 const isSameHost = url.hostname === window.location.hostname; 53 const isIframe = url.searchParams.get('IFRAME') === 'Y'; 54 55 if (isSameHost && !isIframe) 56 { 57 const isDifferentPath = url.pathname !== window.location.pathname; 58 if (isDifferentPath) 59 { 60 BX.addClass(document.body, 'landing-page-transition'); 61 linkOptions.href = url.href; 62 setTimeout(() => { 63 openPseudoLinks(linkOptions, event); 64 }, 400); 65 setTimeout(() => { 66 BX.removeClass(document.body, 'landing-page-transition'); 67 }, 3000); 68 } 69 else if (isBlockLink(linkOptions.href)) 70 { 71 onBlockLinkClick(event); 72 } 73 } 74 else 75 { 76 openPseudoLinks(linkOptions, event); 77 } 78 } 79 }); 80 } 81 82 // stop click from children 83 const childLinks = link.getElementsByTagName('a'); 84 if (childLinks.length > 0) 85 { 86 [].slice.call(childLinks).map(function (node) 87 { 88 stopPropagation(node); 89 }); 90 } 91 92 if (BX.hasClass(link, 'g-bg-cover')) 93 { 94 const child = link.firstElementChild; 95 if (child) 96 { 97 stopPropagation(child); 98 } 99 } 100 } 101 }); 102 } 103 // endregion 104 105 // region STOP PROPAGATION for sub-elements in pseudo-link nodes - old variant 106 const stopPropagationNodes = [].slice.call(document.querySelectorAll("[data-stop-propagation]")); 107 if (stopPropagationNodes.length) 108 { 109 stopPropagationNodes.forEach(function(node) { 110 stopPropagation(node); 111 }); 112 } 113 // endregion 114 115 // region all LINKS FOR MOBILE 116 if (typeof BXMobileApp !== 'undefined') 117 { 118 const allLinks = [].slice.call(document.querySelectorAll('a')); 119 if (allLinks.length) 120 { 121 allLinks.forEach(function(link) { 122 //file links 123 if (link.href && link.href.indexOf('file:') === 0) 124 { 125 link.addEventListener('click', function(event) { 126 event.preventDefault(); 127 BXMobileApp.PageManager.loadPageBlank({ 128 url: link.href, 129 cache: false, 130 bx24ModernStyle: true, 131 }); 132 }); 133 } 134 }); 135 } 136 } 137 // endregion 138 139 // region SCROLL-TO for #block links 140 /*if (typeof BXMobileApp === "undefined") 141 { 142 const blocksLinks = [].slice.call(document.querySelectorAll('a[href*="#"]')) 143 if (!!blocksLinks && blocksLinks.length) 144 { 145 blocksLinks.forEach(link => { 146 const href = link.getAttribute("href"); 147 if (link.target === '_self' || link.target === '') 148 { 149 if (isBlockLink(href)) 150 { 151 link.addEventListener("click", onBlockLinkClick); 152 } 153 } 154 }); 155 } 156 }*/ 157 // endregion 158
159 const setLinks = [].slice.call(document.querySelectorAll("a")); 160 setLinks.forEach(function(link) { 161 const href = link.getAttribute("href"); 162 if (link.target === '_self' && !isBlockLink(href)) 163 { 164 link.addEventListener("click", event => { 165 const url = new URL(link.href); 166 if ( 167 url.hostname === window.location.host 168 && url.pathname !== window.location.pathname 169 && url.searchParams.get('IFRAME') !== "Y" 170 ) 171 { 172 event.preventDefault(); 173 BX.addClass(document.body, "landing-page-transition"); 174 setTimeout(() => { 175 top.open(url.href, link.target); 176 }, 400); 177 setTimeout(() => { 178 BX.removeClass(document.body, "landing-page-transition"); 179 }, 3000); 180 } 181 }); 182 } 183 }); 184 185 // region FUNCTIONS 186 function stopPropagation(node) 187 { 188 node.addEventListener("click", function(event) { 189 event.stopPropagation(); 190 }); 191 } 192 193 /** 194 * Check if url move to block at current page 195 * @param {string} url 196 * @returns {boolean} 197 */ 198 function isBlockLink(url) 199 { 200 if (url !== null && (url === '#' || url.startsWith('#/'))) 201 { 202 return false; 203 } 204 205 if (isValidURL(url)) 206 { 207 const urlObj = new URL(url, document.location); 208 209 return urlObj.hash !== '' 210 && urlObj.pathname === document.location.pathname 211 && urlObj.hostname === document.location.hostname; 212 } 213 214 if (url !== null && url.startsWith('#') && isValidAnchor(url)) 215 { 216 return true; 217 } 218 219 return false; 220 } 221 222 function isValidURL(url) 223 { 224 try 225 { 226 new URL(url); 227 228 return true; 229 } 230 catch 231 { 232 return false; 233 } 234 } 235 236 // height of float header 237 let headerOffset = 0; 238 const headerFix = document.querySelector('.u-header.u-header--sticky'); 239 if (!!headerFix) 240 { 241 const navbar = headerFix.querySelector('.navbar'); 242 if (!!navbar) 243 { 244 const navSection = BX.findParent(navbar, {class: 'u-header__section'}); 245 headerOffset = !!navSection 246 ? navSection.offsetHeight 247 : navbar.offsetHeight; 248 } 249 } 250 251 // scroll correction if open page by link with hash (to block) 252 if (headerOffset && isBlockLink(document.URL)) 253 { 254 document.addEventListener('DOMContentLoaded', () => { 255 if (window.pageYOffset > 0) 256 { 257 window.scrollTo({ 258 top: window.pageYOffset - headerOffset, 259 }); 260 } 261 }); 262 } 263 264 function onBlockLinkClick(event) 265 { 266 try 267 { 268 event.preventDefault(); 269 270 let targetSelector = null; 271 let urlForHistory = null; 272 const link = event.currentTarget; 273 // hash/anchor can be not valid for various reasons 274 if (link.tagName === 'A') 275 { 276 targetSelector = link.hash; 277 urlForHistory = link.href; 278 } 279 else if (link.hasAttribute('data-pseudo-url')) 280 { 281 const linkOptions = BX.Landing.Utils.data(link, "data-pseudo-url"); 282 if (isValidAnchor(linkOptions.href)) 283 { 284 linkOptions.href = window.location.origin + window.location.pathname + linkOptions.href; 285 } 286 const urlObj = new URL(linkOptions.href); 287 targetSelector = urlObj.hash; 288 urlForHistory = urlObj.href; 289 } 290 291 if (!targetSelector || !urlForHistory) 292 { 293 return; 294 } 295 296 const target = document.querySelector(targetSelector); 297 window.scrollTo({ 298 top: target.offsetTop - headerOffset, 299 behavior: 'smooth' 300 }); 301 link.blur(); // disable :focus after click 302 history.pushState({}, '', urlForHistory); 303 } 304 catch (e) {} 305 } 306 307 function openPseudoLinks(linkOptions, event) 308 { 309 if (linkOptions.href.indexOf('/bitrix/services/main/ajax.php?action=landing.api.diskFile.download') === 0) 310 { 311 return; 312 } 313 // mobile device 314 if (typeof BXMobileApp !== "undefined") 315 { 316 BXMobileApp.PageManager.loadPageBlank({ 317 url: linkOptions.href, 318 cache: false, 319 bx24ModernStyle: true, 320 }); 321 } 322 // desktop 323 else 324 { 325 if ( 326 linkOptions.target === '_self' 327 && isBlockLink(linkOptions.href) 328 ) 329 { 330 onBlockLinkClick(event); 331 } 332 else 333 { 334 if (linkOptions.query) 335 { 336 linkOptions.href += (linkOptions.href.indexOf('?') === -1) ? '?' : '&'; 337 linkOptions.href += linkOptions.query; 338 } 339 340 if (isValidURL(linkOptions.href)) 341 { 342 top.open(linkOptions.href, linkOptions.target); 343 } 344 345 if (isValidAnchor(linkOptions.href)) 346 { 347 onBlockLinkClick(event); 348 } 349 } 350 } 351 } 352 // endregion 353 354 function isValidAnchor(anchor) 355 { 356 if (anchor.charAt(0) !== '#' || anchor.length === 1) 357 { 358 return false;
359 } 360 const regex = /^[\w-]+$/; 361 362 return regex.test(anchor.slice(1)); 363 } 364 } 365 366 document.addEventListener('DOMContentLoaded', () => { 367 const elements = document.querySelectorAll('[style]'); 368 for (const element of elements) 369 { 370 let styleValue = element.getAttribute('style'); 371 if (styleValue) 372 { 373 styleValue = styleValue.replaceAll(/--[\w-]*: ;/gi, ''); 374 element.setAttribute('style', styleValue); 375 } 376 } 377 }); 378 }); 379})();
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.