1function initBlock(block, initFunction) { 2 let counter = 0; 3 let invokeInit = () => { 4 try { 5 initFunction(block); 6 } catch (e) { 7 console.log('init block attempt: ', ++counter) 8 if (counter >= 10) return; 9 setTimeout(invokeInit, 300); 10 } 11 }; 12 invokeInit(); 13} 14 15function getViewportWidth() { 16 let viewportWidth; 17 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight 18 if (typeof window.innerWidth != 'undefined') { 19 viewportWidth = window.innerWidth; 20 } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { 21 // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) 22 viewportWidth = document.documentElement.clientWidth; 23 } else { 24 // older versions of IE 25 viewportWidth = document.getElementsByTagName('body')[0].clientWidth; 26 } 27 return viewportWidth; 28} 29 30function getViewportHeight() { 31 let viewportHeight; 32 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerHeight and window.innerHeight 33 if (typeof window.innerHeight != 'undefined') { 34 viewportHeight = window.innerHeight; 35 } else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientHeight != 'undefined' && document.documentElement.clientHeight != 0) { 36 // IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document) 37 viewportHeight = document.documentElement.clientHeight; 38 } else { 39 // older versions of IE 40 viewportHeight = document.getElementsByTagName('body')[0].clientHeight; 41 } 42 return viewportHeight; 43} 44 45function setWebDimensions(className, display) { 46 setWebDimensionsFixedSize(className, display); 47} 48 49function setWebDimensionsFixedSize(className, display, defaultViewportWidth, defaultViewportHeight) { 50 if (display == undefined) display = true; 51 let setWebDimensions2 = () => { 52 const viewportWidth = defaultViewportWidth || Math.min(getViewportWidth(), 1000); 53 const viewportHeight = defaultViewportHeight || getViewportHeight(); 54 const elems = $(`.${className || 'web-screen-relevant'}`); 55 if (!elems.length) return false; 56 elems.each(function() { 57 let dataScreenStyles = $(this).attr('data-screen-styles') || ''; 58 dataScreenStyles = dataScreenStyles.replace("100vw", viewportWidth + "px"); 59 dataScreenStyles = dataScreenStyles.replace("100vh", viewportHeight + "px"); 60 let vwIndex, vhIndex; 61 const replaceDimension = (index, viewport, str) => { 62 let valueStart = index - 3, value; 63 while((str.charAt(valueStart) < '0' || str.charAt(valueStart) > '9' || isNaN(value = Number(str.substring(valueStart, index)))) && valueStart < index - 1) valueStart++; 64 if (isNaN(value)) value = 0; 65 value = Number(viewport * value / 100).toFixed(0); 66 str = str.substring(0, valueStart) + value + "px" + str.substring(index + 2); 67 return str; 68 }; 69 while ((vwIndex = dataScreenStyles.indexOf("vw")) !== -1 || (vhIndex = dataScreenStyles.indexOf("vh")) !== -1) { 70 if (vwIndex !== -1) { dataScreenStyles = replaceDimension(vwIndex, viewportWidth, dataScreenStyles); continue; } 71 if (vhIndex !== -1) dataScreenStyles = replaceDimension(vhIndex, viewportHeight, dataScreenStyles); 72 } 73 dataScreenStyles = dataScreenStyles.split(';'); 74 for (let css of dataScreenStyles) { 75 css = css.trim(); 76 if (!css.length) continue; 77 $(this).css(css.substring(0, css.indexOf(':')), css.substring(css.indexOf(':') + 1).trim()); 78 } 79 if (display) { 80 $(this).removeClass('web-screen-relevant'); 81 $(this).fadeIn(400); 82 } 83 }); 84 return true; 85 } 86 87 let counter = 0; 88 let invokeSetWebDimensions = () => { 89 let success = setWebDimensions2(); 90 if (success) return; 91 console.log('set web dimensions: ', ++counter) 92 if (counter >= 10) return; 93 setTimeout(invokeSetWebDimensions, 300); 94 }; 95 invokeSetWebDimensions(); 96} 97 98/*************************************************************************************************************************************************************/ 99 100function initHeader(settings) { 101 const { 102 blockId, 103 backgroundImage, 104 speedAnimation, 105 menuItem, 106 socialMedia, 107 newWindow, 108 webdomain = '', 109 forceImageReplace = false 110 } = settings; 111 112 console.log('initHeader'); 113 114 const header = document.querySelector(`.block_website__header_${blockId}`); 115 const menuContainer = document.querySelector(`.block_website__header-menu-settings_${blockId}`); 116 const menuItems = document.querySelector(`.block_website__header-menuItems_${blockId}`); 117 const menuSocialMedia = document.querySelector(`.block_website__header-menuSocialMedia_${blockId}`); 118 const blockColor = document.querySelector(`.block_website__header-color_${blockId}`); 119 const menuHeader = document.querySelector(`.block_website__header-menu_${blockId}`); 120 const blockLogo = document.querySelector(`.block_website__header-logo_${blockId}`); 121 const logo = document.querySelector(`.block_website__header-logo-settings_${blockId}`); 122
123 let currentIndex = 0; 124 125 /* clear */ 126 $(menuItems).empty(); 127 $(menuSocialMedia).empty(); 128 if (forceImageReplace) { 129 $(blockColor).empty(); 130 } 131 132 let intervalId = $(header).attr("intervalId"); 133 !!intervalId && clearInterval(intervalId); 134 135 const menuItemLength = menuItem.filter((item) => item && item.pageTitle && item.pageTitle.trim() !== '').length; 136 if (menuItemLength === 0) { 137 menuItems.style.display = "none"; 138 } else { 139 menuItem.forEach(item => { 140 if (!item || !item.pageTitle || item.pageTitle.trim() === '') return; 141 const blockItem = document.createElement('li'); 142 blockItem.classList.add(`block_website__header-menuItem_${blockId}`); 143 144 const blockLink = document.createElement('div'); 145 blockLink.classList.add('customnode_user_link', `block_website__header-menuItem-style_${blockId}`); 146 blockLink.href = item.pageLink; 147 blockLink.setAttribute('user-link', item.pageLink); 148 blockLink.setAttribute('user-link-id', item.pageLinkId); 149 if (item.pageLinkId.indexOf('http') == 0) blockLink.setAttribute('data-target-href', item.pageLinkId); 150 else blockLink.setAttribute('data-target-id', item.pageLinkId); 151 if (newWindow) { 152 blockLink.target = '_blank'; 153 }; 154 blockLink.innerHTML = item.pageTitle; 155 blockItem.appendChild(blockLink); 156 menuItems.appendChild(blockItem); 157 }); 158 menuItems.style.display = "flex"; 159 }; 160 161 /* Creating social media */ 162 const socialMediaLength = socialMedia.filter((item) => item && item.pageLink && item.pageLink.trim() !== '').length; 163 if (socialMediaLength === 0) { 164 menuItems.style.marginBottom = "5px"; 165 menuSocialMedia.style.display = "none"; 166 } else { 167 socialMedia.forEach(item => { 168 if (!item || !item.pageLink || item.pageLink.trim() === '') return; 169 const blockSocialMedia = document.createElement('div'); 170 blockSocialMedia.classList.add('customnode_user_link', `block_website__header-menu-socialMedia_${blockId}`, `${item.pageType}_${blockId}`); 171 blockSocialMedia.href = item.pageLink; 172 blockSocialMedia.setAttribute('user-link', item.pageLink); 173 blockSocialMedia.setAttribute('user-link-id', item.pageLinkId); 174 if (item.pageLinkId.indexOf('http') == 0) blockSocialMedia.setAttribute('data-target-href', item.pageLinkId); 175 else blockSocialMedia.setAttribute('data-target-id', item.pageLinkId); 176 blockSocialMedia.target = '_blank'; 177 178 const blockSocialMediaIcon = document.createElement('img'); 179 blockSocialMediaIcon.classList.add(`block_website__header-menu-socialMedia-icon_${blockId}`); 180 blockSocialMediaIcon.src = `${webdomain}/pub/custom/templates/res/img/${item.pageType}.svg`; 181 blockSocialMediaIcon.alt = item.pageType; 182 183 blockSocialMedia.appendChild(blockSocialMediaIcon); 184 menuSocialMedia.appendChild(blockSocialMedia); 185 }); 186 menuItems.style.marginBottom = "15px"; 187 menuSocialMedia.style.display = "flex"; 188 }; 189 190 /* Logo */ 191 if (logo.getAttribute('src') == "") { 192 blockLogo.style.display = "none"; 193 menuHeader.style.borderTop = "none"; 194 menuHeader.style.paddingTop = "0"; 195 } else { 196 blockLogo.setAttribute('href', window.location.href); 197 blockLogo.style.display = "block"; 198 }; 199 200 /* Creating background images */ 201 if (!blockColor.children || !blockColor.children.length) { 202 backgroundImage.forEach((item, index) => { 203 const blockBackgroundImage = document.createElement('div'); 204 blockBackgroundImage.classList.add(`block_website__header-backgroundImage_${blockId}`); 205 const backgroundImageUrl = item; 206 blockBackgroundImage.style.backgroundImage = `url(${backgroundImageUrl})`; 207 if (index == 0) { 208 blockBackgroundImage.classList.add('active'); 209 }
210 blockColor.appendChild(blockBackgroundImage); 211 }); 212 } 213 214 /* Function for changing the background image */ 215 function changeBackground() { 216 if (backgroundImage.length === 1 || !backgroundImage[currentIndex]) return; 217 const activeImage = header.querySelector(`.block_website__header-backgroundImage_${blockId}.active`); 218 if (activeImage) activeImage.classList.remove('active'); 219 currentIndex = (currentIndex + 1) % backgroundImage.length; 220 221 const nextImage = header.querySelectorAll(`.block_website__header-backgroundImage_${blockId}`)[currentIndex]; 222 if (nextImage) { 223 nextImage.classList.add('active'); 224 }; 225 }; 226 227 intervalId = setInterval(changeBackground, speedAnimation); 228 $(header).attr("intervalId", intervalId); 229}; 230 231/*************************************************************************************************************************************************************/ 232 233const contactIcons = { 234 /* 235 phone: "M0 10.375c0 0.938 0.344 1.969 0.781 3.063s1 2.125 1.438 2.906c1.188 2.063 2.719 4.094 4.469 5.781s3.813 3.094 6.125 3.938c1.344 0.531 2.688 1.125 4.188 1.125 0.75 0 1.813-0.281 2.781-0.688 0.938-0.406 1.781-1.031 2.094-1.781 0.125-0.281 0.281-0.656 0.375-1.094 0.094-0.406 0.156-0.813 0.156-1.094 0-0.156 0-0.313-0.031-0.344-0.094-0.188-0.313-0.344-0.563-0.5-0.563-0.281-0.656-0.375-1.5-0.875-0.875-0.5-1.781-1.063-2.563-1.469-0.375-0.219-0.625-0.313-0.719-0.313-0.5 0-1.125 0.688-1.656 1.438-0.563 0.75-1.188 1.438-1.625 1.438-0.219 0-0.438-0.094-0.688-0.25s-0.5-0.281-0.656-0.375c-2.75-1.563-4.594-3.406-6.156-6.125-0.188-0.313-0.625-0.969-0.625-1.313 0-0.406 0.563-0.875 1.125-1.375 0.531-0.469 1.094-1.031 1.094-1.719 0-0.094-0.063-0.375-0.188-0.781-0.281-0.813-0.656-1.75-0.969-2.656-0.156-0.438-0.281-0.75-0.313-0.906-0.063-0.094-0.094-0.219-0.125-0.375s-0.094-0.281-0.125-0.406c-0.094-0.281-0.25-0.5-0.406-0.625-0.156-0.063-0.531-0.156-0.906-0.188-0.375 0-0.813-0.031-1-0.031-0.094 0-0.219 0-0.344 0.031h-0.406c-1 0.438-1.719 1.313-2.25 2.344-0.5 1.031-0.813 2.188-0.813 3.219z", 236 email: "M4,28c-0.8,0-1.5-0.3-2.1-0.9c-0.6-0.6-0.9-1.3-0.9-2.1V7c0-0.8,0.3-1.5,0.9-2.1S3.1,4,4,4H28c0.8,0,1.5,0.3,2.1,0.9c0.6,0.6,0.9,1.3,0.9,2.1V25c0,0.8-0.3,1.5-0.9,2.1C29.6,27.7,28.9,28,28,28H4z M16,17.5L4,10V25H28V10L16,17.5z M16,14.5L28,7H4L16,14.5z M4,10V7V25V10z", 237 address: "M 12 1 C 8.686 1 6 3.686 6 7 C 6 11.286 12 18 12 18 C 12 18 18 11.286 18 7 C 18 3.686 15.314 1 12 1 z M 12 4.8574219 C 13.184 4.8574219 14.142578 5.816 14.142578 7 C 14.142578 8.183 13.183 9.1425781 12 9.1425781 C 10.817 9.1425781 9.8574219 8.184 9.8574219 7 C 9.8574219 5.816 10.816 4.8574219 12 4.8574219 z M 4.8007812 15 L 2 22 L 22 22 L 19.199219 15 L 16.8125 15 C 16.3275 15.731 15.840578 16.408 15.392578 17 L 17.847656 17 L 19.046875 20 L 4.953125 20 L 6.1523438 17 L 8.6074219 17 C 8.1594219 16.408 7.6725 15.731 7.1875 15 L 4.8007812 15 z" 238 */ 239 phone: "M3.7,9.6c0,1,0.4,2.2,0.9,3.4s1.1,2.4,1.6,3.2c1.3,2.3,3,4.6,5,6.5s4.3,3.5,6.8,4.4c1.5,0.6,3,1.3,4.7,1.3c0.8,0,2-0.3,3.1-0.8c1-0.5,2-1.2,2.3-2c0.1-0.3,0.3-0.7,0.4-1.2c0.1-0.5,0.2-0.9,0.2-1.2c0-0.2,0-0.3,0-0.4c-0.1-0.2-0.3-0.4-0.6-0.6c-0.6-0.3-0.7-0.4-1.7-1c-1-0.6-2-1.2-2.9-1.6c-0.4-0.2-0.7-0.3-0.8-0.3c-0.6,0-1.3,0.8-1.9,1.6c-0.6,0.8-1.3,1.6-1.8,1.6c-0.2,0-0.5-0.1-0.8-0.3c-0.3-0.2-0.6-0.3-0.7-0.4c-3.1-1.7-5.1-3.8-6.9-6.8c-0.2-0.3-0.7-1.1-0.7-1.5c0-0.5,0.6-1,1.3-1.5c0.6-0.5,1.2-1.2,1.2-1.9c0-0.1-0.1-0.4-0.2-0.9c-0.3-0.9-0.7-2-1.1-3c-0.2-0.5-0.3-0.8-0.3-1c-0.1-0.1-0.1-0.2-0.1-0.4c0-0.2-0.1-0.3-0.1-0.5c-0.1-0.3-0.3-0.6-0.5-0.7c-0.2-0.1-0.6-0.2-1-0.2c-0.4,0-0.9,0-1.1,0c-0.1,0-0.2,0-0.4,0H7.1C6,3.9,5.2,4.8,4.6,6C4,7.1,3.7,8.4,3.7,9.6L3.7,9.6z", 240 email: "M6.4,25.4c-0.6,0-1.2-0.2-1.7-0.7s-0.7-1-0.7-1.7V8.5c0-0.6,0.2-1.2,0.7-1.7s1-0.7,1.7-0.7h19.3c0.6,0,1.2,0.2,1.7,0.7s0.7,1,0.7,1.7V23c0,0.6-0.2,1.2-0.7,1.7c-0.4,0.5-1,0.7-1.7,0.7H6.4z M16,16.9l-9.6-6V23h19.3V10.9L16,16.9z M16,14.5l9.6-6H6.4L16,14.5z M6.4,10.9V8.5V23V10.9z", 241 address: "M16,3.1c-4.1,0-7.4,3.3-7.4,7.4C8.6,15.7,16,24,16,24s7.4-8.3,7.4-13.5C23.4,6.4,20.1,3.1,16,3.1z M16,7.8c1.5,0,2.6,1.2,2.6,2.6c0,1.5-1.2,2.6-2.6,2.6s-2.6-1.2-2.6-2.6S14.5,7.8,16,7.8z M7.1,20.3l-3.5,8.6h24.6l-3.5-8.6h-2.9c-0.6,0.9-1.2,1.7-1.7,2.5h3l1.5,3.7H7.3l1.5-3.7h3c-0.6-0.7-1.2-1.6-1.7-2.5H7.1z" 242}; 243 244/*************************************************************************************************************************************************************/ 245 246function initFooter(settings) { 247 const { 248 blockId, 249 backgroundImage, 250 speedAnimation, 251 contacts, 252 menuItem, 253 socialMedia, 254 newWindow, 255 webdomain = '', 256 forceImageReplace = false 257 } = settings; 258 259 console.log('initFooter'); 260 261 // Getting the necessary DOM elements 262 const footer = document.querySelector(`.block_website__footer_${blockId}`); 263 const menuContainer = document.querySelector(`.block_website__footer-container-top-menu_${blockId}`); 264 const contactContainer = document.querySelector(`.block_website__footer-container-top-contact_${blockId}`); 265 const topContainer = document.querySelector(`.block_website__footer-container-top_${blockId}`); 266 const blockColor = document.querySelector(`.block_website__footer-color_${blockId}`); 267 const menuSocialMedia = document.querySelector(`.block_website__footer-container-socialMedia_${blockId}`); 268 const blockLogo = document.querySelector(`.block_website__footer-logo_${blockId}`); 269 const logo = document.querySelector(`.block_website__footer-logo-settings_${blockId}`); 270 271 /* Clear */ 272 $(menuContainer).empty(); 273 $(contactContainer).empty(); 274 $(menuSocialMedia).empty(); 275 if (forceImageReplace) { 276 $(blockColor).empty(); 277 } 278 let intervalId = $(footer).attr("intervalId"); 279 !!intervalId && clearInterval(intervalId); 280
281 let currentIndex = 0; 282 283 /* Logo */ 284 if (logo.getAttribute('src') == "") { 285 blockLogo.style.display = "none"; 286 } else { 287 blockLogo.style.display = "block"; 288 blockLogo.setAttribute('href', window.location.href); 289 }; 290 291 /* Create a contact section */ 292 const contactsLength = contacts.filter((item) => item && item.pageTitle && item.pageTitle.trim() !== '').length; 293 if (contactsLength === 0) { 294 contactContainer.style.display = "none"; 295 menuContainer.style.textAlign = "center"; 296 } else { 297 contacts.forEach(item => { 298 if (!item || !item.pageTitle || item.pageTitle.trim() === '') return; 299 const contactItem = document.createElement('div'); 300 contactItem.classList.add(`block_website__footer-container-top-contactButton_${blockId}`); 301 302 const contactItemIcon = document.createElementNS("http://www.w3.org/2000/svg", "svg"); 303 contactItemIcon.setAttribute("viewBox", "0 0 32 32"); 304 contactItemIcon.classList.add(`block_website__footer-container-top-contactButton-icon_${blockId}`, `${item.pageType}_${blockId}`); 305 const contactItemIconPath = document.createElementNS("http://www.w3.org/2000/svg", "path"); 306 contactItemIconPath.setAttribute("d", contactIcons[item.pageType]); 307 contactItemIcon.appendChild(contactItemIconPath); 308 309 const contactItemLink = document.createElement('a'); 310 if (item.reference && item.reference != '') { 311 contactItemLink.href = item.reference; 312 contactItemLink.classList.add('customnode_user_link'); 313 contactItemLink.target = '_blank'; 314 } 315 contactItemLink.innerHTML = item.pageTitle; 316 contactItemLink.classList.add(`block_website__footer-container-top-contactButton-item_${blockId}`); 317 318 contactItem.appendChild(contactItemLink); 319 contactItemLink.appendChild(contactItemIcon); 320 contactContainer.appendChild(contactItem); 321 }); 322 if ($(footer).width() < 1000) $(contactContainer).css('gap', '1px'); 323 contactContainer.style.display = "flex"; 324 menuContainer.style.textAlign = "right"; 325 }; 326 327 const menuItemLength = menuItem.filter((item) => item && item.pageTitle && item.pageTitle.trim() !== '').length; 328 if (menuItemLength === 0) { 329 menuContainer.style.display = "none"; 330 contactContainer.style.alignItems = "center"; 331 } else { 332 // Creating a menu 333 menuItem.forEach(item => { 334 if (!item || !item.pageTitle || item.pageTitle.trim() === '') return; 335 336 const blockItem = document.createElement('li'); 337 blockItem.classList.add(`block_website__footer-container-top-menuItem_${blockId}`); 338 339 const blockLink = document.createElement('div'); 340 blockLink.classList.add('customnode_user_link', `block_website__footer-container-top-menuItem-style_${blockId}`); 341 blockLink.href = item.pageLink; 342 blockLink.setAttribute('user-link', item.pageLink); 343 blockLink.setAttribute('user-link-id', item.pageLinkId); 344 if (item.pageLinkId.indexOf('http') == 0) blockLink.setAttribute('data-target-href', item.pageLinkId); 345 else blockLink.setAttribute('data-target-id', item.pageLinkId); 346 blockLink.setAttribute('data-target-id', item.pageLinkId); 347 348 blockLink.href = item.pageLink; 349 if (newWindow) { 350 blockLink.target = '_blank'; 351 } 352 blockLink.innerHTML = item.pageTitle; 353 blockItem.appendChild(blockLink); 354 menuContainer.appendChild(blockItem); 355 }); 356 if ($(footer).width() < 1000) $(menuContainer).css('gap', '0px'); 357 menuContainer.style.display = "flex"; 358 contactContainer.style.alignItems = "left"; 359 } 360 361 if (contactsLength && menuItemLength) { 362 topContainer.style.justifyContent = "space-between"; 363 topContainer.style.display = "flex"; 364 } else if (contactsLength || menuItemLength) { 365 topContainer.style.justifyContent = "center"; 366 topContainer.style.display = "flex"; 367 } else { 368 /* If there are no contacts and menus */ 369 topContainer.style.display = "none"; 370 } 371 372 /* Creating social media */ 373 const socialMediaLength = socialMedia.filter((item) => item && item.pageLink && item.pageLink.trim() !== '').length; 374 if (socialMediaLength === 0) { 375 menuSocialMedia.style.display = "none"; 376 } else {
377 socialMedia.forEach(item => { 378 if (!item || !item.pageLink || item.pageLink.trim() === '') return; 379 const blockSocialMedia = document.createElement('div'); 380 blockSocialMedia.classList.add('customnode_user_link', `block_website__footer-container-socialMedia_item_${blockId}`, `${item.pageType}_${blockId}`); 381 blockSocialMedia.href = item.pageLink; 382 blockSocialMedia.setAttribute('user-link', item.pageLink); 383 blockSocialMedia.setAttribute('user-link-id', item.pageLinkId); 384 if (item.pageLinkId.indexOf('http') == 0) blockSocialMedia.setAttribute('data-target-href', item.pageLinkId); 385 else blockSocialMedia.setAttribute('data-target-id', item.pageLinkId); 386 blockSocialMedia.target = '_blank'; 387 388 const blockSocialMediaIcon = document.createElement('img'); 389 blockSocialMediaIcon.classList.add(`block_website__footer-container-socialMedia_item_icon_${blockId}`); 390 blockSocialMediaIcon.src = `${webdomain}/pub/custom/templates/res/img/${item.pageType}.svg`; 391 blockSocialMediaIcon.alt = item.pageType; 392 393 blockSocialMedia.appendChild(blockSocialMediaIcon); 394 menuSocialMedia.appendChild(blockSocialMedia); 395 }); 396 menuSocialMedia.style.display = "flex"; 397 } 398 399 if (!blockColor.children || !blockColor.children.length) { 400 /* Creating background images */ 401 backgroundImage.forEach((item, index) => { 402 const blockBackgroundImage = document.createElement('div'); 403 blockBackgroundImage.classList.add(`block_website__footer-backgroundImage_${blockId}`); 404 const backgroundImageUrl = item; 405 blockBackgroundImage.style.backgroundImage = `url(${backgroundImageUrl})`; 406 if (index == 0) { 407 blockBackgroundImage.classList.add('active'); 408 }; 409 blockColor.appendChild(blockBackgroundImage); 410 }); 411 } 412 413 /* Function for changing the background image */ 414 function changeBackground() { 415 if (backgroundImage.length === 1 || !backgroundImage[currentIndex]) return; 416 const activeImage = footer.querySelector(`.block_website__footer-backgroundImage_${blockId}.active`); 417 if (activeImage) activeImage.classList.remove('active'); 418 currentIndex = (currentIndex + 1) % backgroundImage.length; 419 420 const nextImage = footer.querySelectorAll(`.block_website__footer-backgroundImage_${blockId}`)[currentIndex]; 421 if (nextImage) { 422 nextImage.classList.add('active'); 423 } 424 }; 425 intervalId = setInterval(changeBackground, speedAnimation); 426 $(footer).attr("intervalId", intervalId); 427} 428 429/*************************************************************************************************************************************************************/ 430 431const socialPageSvgs = { 432 facebook: 'M11.4698753,30V15H6.4698749v-5h5.0000005V7.3150005C11.4698753,2.2312498,13.946125,0,18.1711254,0 c2.0237484,0,3.09375,0.1499999,3.6000004,0.2187499V5h-2.8812504c-1.7937508,0-2.4200001,0.94625-2.4200001,2.8637505V10h5.2562485 l-0.7137489,5h-4.5424995v15H11.4698753z', 433 instagram: 'M9.0612717,0.654254c-4.6847091,0-8.4968376,3.812129-8.4968376,8.4968386v11.7648525 c0,4.6847095,3.8121288,8.4968376,8.4968376,8.4968376h11.7648525c4.6847095,0,8.4968395-3.8121281,8.4968395-8.4968376V9.1510925 c0-4.6847095-3.81213-8.4968386-8.4968395-8.4968386H9.0612717z M9.0612717,1.9614599h11.7648525 c3.9781437,0,7.1896324,3.2114885,7.1896324,7.1896324v11.7648525c0,3.9781437-3.2114887,7.1896324-7.1896324,7.1896324H9.0612717 c-3.9781432,0-7.1896319-3.2114887-7.1896319-7.1896324V9.1510925C1.8716397,5.1729484,5.0831285,1.9614599,9.0612717,1.9614599z M22.7869339,5.8830776c-0.7219486,0-1.3072052,0.5852561-1.3072052,1.3072057s0.5852566,1.3072057,1.3072052,1.3072057 s1.3072052-0.5852556,1.3072052-1.3072057S23.5088825,5.8830776,22.7869339,5.8830776z M14.9436989,7.8438864 c-3.9629831,0-7.1896329,3.2266493-7.1896329,7.1896324s3.2266498,7.1896315,7.1896329,7.1896315 s7.1896324-3.2266483,7.1896324-7.1896315S18.9066811,7.8438864,14.9436989,7.8438864z M14.9436989,9.1510925 c3.2565155,0,5.8824253,2.6259108,5.8824253,5.8824263s-2.6259098,5.8824263-5.8824253,5.8824263 s-5.8824272-2.6259117-5.8824272-5.8824263S11.6871824,9.1510925,14.9436989,9.1510925z', 434 linkedin: 'M3.3804715,7.5415444h0.038784l0,0c2.080909,0,3.3764431-1.4916911,3.3764431-3.3563051 C6.7569146,2.279604,5.5001645,0.8289342,3.4587858,0.8289342S0.0830886,2.279604,0.0830886,4.1852393 C0.0830886,6.0498533,1.3778766,7.5415444,3.3804715,7.5415444z M0.0830886,9.7790813h6.7126102v19.3919849H0.0830886V9.7790813z M29.9169121,16.8646145c0-3.9134521-3.172081-7.0855331-7.0855331-7.0855331c-2.2770672,0-4.2975636,1.0784922-5.5938416,2.747695 v-2.747695h-6.7126112v19.3919849h6.7126112V17.9833832l0,0C17.2375374,16.3358097,18.5733471,15,20.2209187,15 c1.6475735,0,2.9833832,1.3358097,2.9833832,2.9833832v11.1876831h6.7126102 C29.9169121,29.1710663,29.9169121,17.9498196,29.9169121,16.8646145z',
435 twitter: 'M30,5.6963186c-1.1041889,0.490366-2.2902966,0.820353-3.5352478,0.9691939 c1.2714882-0.7615089,2.2464523-1.9672318,2.7056637-3.4048686c-1.1884155,0.7049727-2.5060558,1.2172604-3.9090805,1.494173 c-1.1226482-1.196492-2.721817-1.9441557-4.4917488-1.9441557c-3.3990993,0-6.1543789,2.7564325-6.1543789,6.1543789 c0,0.4822893,0.0553827,0.9530401,0.1592245,1.4018688C9.6596289,10.1107655,5.1251879,7.6600909,2.088382,3.9356184 C1.5599408,4.8448133,1.2564909,5.9016957,1.2564909,7.0312676c0,2.1345334,1.0857277,4.0186915,2.7368176,5.1217256 c-1.0084226-0.0323057-1.9580016-0.3092184-2.7875848-0.7695847c0,0.0265369,0,0.050766,0,0.0773048 c0,2.9825773,2.1206875,5.4701738,4.9371176,6.0343828c-0.5157495,0.1407623-1.0603442,0.2157612-1.6222458,0.2157612 c-0.3957539,0-0.7822773-0.0392303-1.1572633-0.1096115c0.7834315,2.4449062,3.0564213,4.2252235,5.7493939,4.2748356 c-2.1056881,1.6510906-4.7594323,2.6352844-7.6439366,2.6352844c-0.4961348,0-0.9865005-0.0288448-1.4687896-0.0865364 c2.7241263,1.7457027,5.9582319,2.7645092,9.4346371,2.7645092c11.3211021,0,17.5100956-9.3781013,17.5100956-17.5112495 c0-0.2665281-0.0057678-0.5319023-0.0173073-0.7961226C28.1308403,8.0131531,29.1750317,6.9297328,30,5.6963186z', 436 whatsapp: 'M15.134634,0.1346338c-8.1966343,0-14.865366,6.6687322-14.865366,14.865366 c0,2.5594273,0.6611856,5.0761986,1.915047,7.296957l-1.8911333,6.7475815 c-0.0620467,0.2216873-0.001939,0.4595337,0.1583486,0.6243458c0.1234471,0.127327,0.2914904,0.1964817,0.4640579,0.1964817 c0.0517056,0,0.1040576-0.0064621,0.1551169-0.0187435l7.0423055-1.7444191 c2.1503067,1.1543274,4.5720692,1.7631626,7.0216236,1.7631626C23.3312664,29.865366,30,23.1966324,3
4360,15 S23.3312664,0.1346338,15.134634,0.1346338z M22.6125584,20.2455368c-0.3179893,0.8802872-1.8433056,1.6836624-2.576231,1.7915993 c-0.6579552,0.0963001-1.4904156,0.1376667-2.4043121-0.1492996c-0.553896-0.1745071-1.2648487-0.4058876-2.1755133-0.7943287 c-3.8281555-1.6326046-6.3281221-5.4387846-6.5194321-5.6902037c-0.1906652-0.2514181-1.5582795-2.0430193-1.5582795-3.8973112 s0.9856381-2.7662516,1.3359437-3.1437025c0.3503056-0.3774505,0.7633047-0.4718132,1.0179548-0.4718132 c0.2546511,0,0.5086546,0.0032315,0.7316351,0.0135727c0.2346144,0.0116334,0.5493717-0.0885463,0.8589592,0.6469669 c0.3179903,0.7549019,1.0812941,2.6091948,1.1756573,2.7985668c0.0956554,0.1887255,0.1589947,0.4091206,0.0323153,0.6605396 c-0.1266785,0.2514181-0.1900187,0.408474-0.3813286,0.6288691c-0.1913109,0.2203951-0.4007196,0.4912033-0.5726395,0.6605387 c-0.1913109,0.1880798-0.3897324,0.3916712-0.1673975,0.7691212c0.2223339,0.3774509,0.9882231,1.6112766,2.1231613,2.6104879 c1.4574528,1.2835922,2.6873999,1.6817245,3.0687304,1.870451c0.3813286,0.1887264,0.6043091,0.1570568,0.826643-0.0943623 c0.2223339-0.2520657,0.953968-1.1006832,1.2079716-1.4774876s0.5086555-0.3147583,0.8589592-0.1887264 c0.3503075,0.1253872,2.2265759,1.0366993,2.6079025,1.2254238c0.3813286,0.1887245,0.6359787,0.2830887,0.7316341,0.4401436 C22.9305496,18.6109905,22.9305496,19.3658924,22.6125584,20.2455368z', 437 youtube: 'M24.8,4.5H5.2c0,0-5.2,0-5.2,5.2v10.7c0,0,0,5.2,5.2,5.2h19.7c0,0,5.2,0,5.2-5.2V9.6C30,9.6,30,4.5,24.8,4.5z M11,20.8V9.2l9.8,5.8L11,20.8z', 438 tiktok: 'M 26.203845,6.4642643 A 6.8290275,6.8290275 0 0 1 25.61325,6.1205345 8.3039525,8.3039525 0 0 1 24.096452,4.8318426 C 22.965259,3.5375327 22.542781,2.2244779 22.387164,1.3051492 h 0.0062 C 22.2634,0.54206574 22.317147,0.0483356 22.325271,0.0483356 H 17.173033 V 19.971076 c 0,0.267484 0,0.531847 -0.01125,0.793087 0,0.03248 -0.0031,0.06248 -0.005,0.0975 0,0.01436 0,0.02934 -0.0031,0.04438 0,0.004 0,0.0075 0,0.01122 a 4.3747775,4.3747775 0 0 1 -2.201138,3.472327 4.2997813,4.2997813 0 0 1 -2.131767,0.562472 c -2.400503,0 -4.3460277,-1.957401 -4.3460277,-4.374779 0,-2.417372 1.9455247,-4.374778 4.3460277,-4.374778 a 4.306031,4.306031 0 0 1 1.338057,0.211865 l 0.0062,-5.245981 a 9.5707634,9.5707634 0 0 0 -7.3745517,2.157392 10.111361,10.111361 0 0 0 -2.2061382,2.72049 c -0.2174889,0.374981 -1.0380721,1.881777 -1.137442,4.327277 -0.062497,1.388058 0.3543569,2.826112 0.5530968,3.420451 v 0.01253 c 0.1249937,0.34998 0.609344,1.544297 1.3986793,2.551118 a 10.470092,10.470092 0 0 0 2.2317614,2.105516 v -0.01253 l 0.0125,0.01253 c 2.4942474,1.694912 5.2597314,1.583667 5.2597314,1.583667 0.478726,-0.01937 2.082394,0 3.903552,-0.863076 2.019897,-0.956831 3.169838,-2.382379 3.169838,-2.382379 a 9.9032462,9.9032462 0 0 0 1.727413,-2.870485 c 0.466226,-1.225556 0.621843,-2.695477 0.621843,-3.28295 V 10.078486 c 0.0625,0.03749 0.894954,0.588093 0.894954,0.588093 0,0 1.199315,0.768707 3.07047,1.269309 1.342431,0.35623 3.151089,0.431228 3.151089,0.431228 V 7.2523544 c -0.633718,0.06875 -1.920527,-0.131238 -3.237961,-0.7880787 z' 439}; 440 441function initSocialMedia(settings) { 442 const { 443 blockId, 444 socialMedia, 445 webdomain = '', 446 } = settings; 447 448 console.log('initSocialMedia'); 449 const menuSocialMedia = document.querySelector(`.block_socialMedia__allItems_${blockId}`); 450 451 /* Clear */ 452 $(menuSocialMedia).empty(); 453 454 socialMedia.forEach(item => { 455 if (!item || !item.pageLink || item.pageLink.trim() === '') return; 456 const blockSocialMedia = document.createElement(window.mobile ? 'a' : 'div'); 457 blockSocialMedia.classList.add('customnode_user_link', `block_socialMedia__item_${blockId}`, `${item.pageType}_${blockId}`); 458 blockSocialMedia.href = item.pageLink; 459 blockSocialMedia.setAttribute('user-link', item.pageLink); 460 blockSocialMedia.setAttribute('user-link-id', item.pageLinkId); 461 if (item.pageLinkId.indexOf('http') == 0) blockSocialMedia.setAttribute('data-target-href', item.pageLinkId); 462 else blockSocialMedia.setAttribute('data-target-id', item.pageLinkId); 463 blockSocialMedia.target = '_blank'; 464 if (window.mobile) { 465 blockSocialMedia.innerHTML = `<svg viewbox="-8 -8 48 48"><path d="${socialPageSvgs[item.pageType]}" fill="white"></path></svg>`; 466 } else { 467 const blockSocialMediaIcon = document.createElement('img'); 468 blockSocialMediaIcon.classList.add(`block_socialMedia__item-icon_${blockId}`); 469 blockSocialMediaIcon.src = `${webdomain}/pub/custom/templates/res/img/${item.pageType}.svg`; 470 blockSocialMediaIcon.alt = item.pageType; 471 blockSocialMedia.appendChild(blockSocialMediaIcon); 472 } 473 474 menuSocialMedia.appendChild(blockSocialMedia); 475 }); 476}; 477 478/*************************************************************************************************************************************************************/ 479 480function initCarousel(settings) { 481 const {blockId} = settings;
482 let carouselWrapper = document.querySelector(`.block_carousel__container_${blockId}.swiper-wrapper`); 483 for (let i = 0; i < settings.images.length; i++) { 484 let slide = document.createElement("div"); 485 slide.className = `block_carousel__default_${blockId} swiper-slide`; 486 /* add link */ 487 let link = document.createElement("a"); 488 link.className = settings.images[i].link; 489 link.target = "_blank"; 490 link.setAttribute("style", "text-decoration: none!important; cursor: pointer;"); 491 /* add image */ 492 const imgContainer = document.createElement("div"); 493 imgContainer.className = `block_carousel__bgImage_${blockId}`; 494 imgContainer.style.backgroundImage = "url(" + settings.images[i].image + ")"; 495 imgContainer["data-screen-styles"] = "box-shadow:inset 0 0 0 100vw {{barColor}}"; 496 link.appendChild(imgContainer); 497 slide.appendChild(link); 498 setTimeout(() => setWebDimensions(imgContainer.className, false), 100); 499 const bar = document.createElement("div"); 500 bar.className = `block_carousel__bar_${blockId}`; 501 const blockText = document.createElement("div"); 502 blockText.className = `block_carousel__text_${blockId}`; 503 blockText.innerHTML = settings.images[i].text; 504 if (settings.showBar) { 505 const barSettings = document.createElement("div"); 506 barSettings.className = `block_carousel__barSettings_${blockId}`; 507 bar.appendChild(barSettings); 508 imgContainer.style.boxShadow = 'none'; 509 slide.style.justifyContent = 'flex-end'; 510 } 511 bar.appendChild(blockText); 512 link.appendChild(bar); 513 carouselWrapper.appendChild(slide); 514 } 515 /* endless loop */ 516 const loopSatting = settings.loop; 517 /* gap */ 518 const imageGap = parseInt(settings.gap, 10); 519 /* init */ 520 let carousel = new Swiper(`.swiper_${blockId}`, { 521 spaceBetween: 10, 522 loop: loopSatting, 523 spaceBetween: imageGap, 524 initialSlide: 0, 525 navigation: { 526 nextEl: ".swiper-button-next", 527 prevEl: ".swiper-button-prev", 528 }, 529 pagination: { 530 el: ".swiper-pagination", 531 bulletClass: `block_carousel__paginationBullet_${blockId} swiper-pagination-bullet`, 532 bulletActiveClass: `block_carousel__paginationBulletActive_${blockId} swiper-pagination-bullet-active`, 533 }, 534 slidesPerView: "auto", 535 }); 536 /* remove comment */ 537 const notifications = document.getElementsByClassName("swiper-notification"); 538 for (let i = notifications.length - 1; i >= 0; i--) { 539 notifications[i].remove(); 540 }; 541}; 542 543/*************************************************************************************************************************************************************/ 544 545function initFlipCard(settings) { 546 const {blockId} = settings; 547 548 const frontPanel = document.querySelector(`.block_flipCard__frontPanel_${blockId}`); 549 const blockFrontButton = document.querySelector(`.block_flipCard__frontButton_${blockId}`); 550 const blockBackButton = document.querySelector(`.block_flipCard__backButton_${blockId}`); 551 const blockFlipCard = document.querySelectorAll(`.block_flipCard_${blockId}`); 552 553 if (!settings.buttons[0].frontButton) { 554 frontPanel.style.padding = '50px 10px'; 555 blockFrontButton.style.display = 'none'; 556 }; 557 558 if (!settings.buttons[1].backButton) { 559 blockBackButton.style.display = 'none' 560 }; 561 562 function toggleCard(card) { 563 if (settings.buttons[0].frontButton) { 564 return; 565 } 566 card.classList.toggle('active'); 567 }; 568 569 function closeCards() { 570 blockFlipCard.forEach(blockFlipCard => { 571 if (blockFlipCard.classList.contains('active')) { 572 blockFlipCard.classList.remove('active'); 573 }; 574 }); 575 }; 576 577 frontPanel.addEventListener('click', function(event) { 578 event.stopPropagation(); 579 if (!settings.buttons[0].frontButton) { 580 blockFlipCard.forEach(function(blockFlipCard) { 581 toggleCard(blockFlipCard); 582 }); 583 }; 584 }); 585 586 blockFrontButton.addEventListener('click', function(event) { 587 event.stopPropagation(); 588 if (settings.buttons[0].frontButton) { 589 blockFlipCard.forEach(function(blockFlipCard) { 590 blockFlipCard.classList.toggle('active'); 591 }); 592 }; 593 }); 594 595 document.addEventListener('click', function(event) { 596 closeCards(); 597 }); 598 599 blockBackButton.addEventListener('click', function(event) { 600 event.stopPropagation(); 601 }); 602}; 603 604/*************************************************************************************************************************************************************/ 605 606function initImageSlider(settings) { 607 const { blockId } = settings; 608
609 let currentImageIndex = 0; 610 const imageSlider = document.querySelector(`.block_imageSlider__default_${blockId}`); 611 const sliderElements = []; 612 613 for (let i = 0; i < settings.images.length; i++) { 614 const slide = settings.images[i]; 615 616 const link = document.createElement("a"); 617 link.className = slide.link; 618 link.target = "_blank"; 619 link.setAttribute("style", "text-decoration: none!important; cursor: pointer;"); 620 621 const imgContainer = document.createElement("div"); 622 imgContainer.className = `block_imageSlider__slide_${blockId}`; 623 imgContainer.style.backgroundImage = `url(${slide.image})`; 624 imgContainer.style.boxShadow = `inset 0 0 0 100vw ${slide.barColor}`; 625 626 const bar = document.createElement("div"); 627 bar.className = `block_imageSlider__bar_${blockId}`; 628 629 const blockText = document.createElement("div"); 630 blockText.className = `block_imageSlider__text_${blockId}`; 631 blockText.innerHTML = slide.text; 632 633 if (settings.showBar) { 634 const barSettings = document.createElement("div"); 635 barSettings.className = `block_imageSlider__barSettings_${blockId}`; 636 bar.appendChild(barSettings); 637 barSettings.style.background = `${slide.barColor}`; 638 imgContainer.style.boxShadow = 'none'; 639 imgContainer.style.justifyContent = 'flex-end'; 640 } 641 642 bar.appendChild(blockText); 643 imgContainer.appendChild(bar); 644 link.appendChild(imgContainer); 645 imageSlider.appendChild(link); 646 sliderElements.push(imgContainer); 647 } 648 649 sliderElements[currentImageIndex].className += " active"; 650 651 const speedAnimation = settings.speed 652 setInterval(() => { 653 sliderElements[currentImageIndex].className = sliderElements[currentImageIndex].className.replace(" active", ""); 654 currentImageIndex = (currentImageIndex + 1) % settings.images.length; 655 sliderElements[currentImageIndex].className += " active"; 656 }, speedAnimation); 657 658}; 659 660/*************************************************************************************************************************************************************/ 661 662function initSwiper(settings) { 663 const { blockId } = settings; 664 665 /* const swiperWrapper = document.querySelector(`.block_swiper__container_${blockId}.swiper-wrapper`); */ 666 667 /* Clear */ 668 /* $(swiperWrapper).empty(); */ 669 670 setTimeout(() => { 671 /* 672 for (let i = 0; i < settings.images.length; i++) { 673 const slide = document.createElement("div"); 674 slide.className = `block_swiper__default_${blockId} swiper-slide`; 675 676 const link = document.createElement("a"); 677 link.className = settings.images[i].link; 678 link.target = "_blank"; 679 link.setAttribute("style", "text-decoration: none!important; cursor: pointer;"); 680 681 const imgContainer = document.createElement("div"); 682 imgContainer.className = `block_swiper__bgImage_${blockId}`; 683 imgContainer.style.backgroundImage = "url(" + settings.images[i].image + ")"; 684 // TODO: imgContainer["data-screen-styles"] = "box-shadow: inset 0 0 0 100vw {{barColor}}"; 685 link.appendChild(imgContainer); 686 slide.appendChild(link); 687 setTimeout(() => setWebDimensions(imgContainer.className, false), 100); 688 689 const bar = document.createElement("div"); 690 bar.className = `block_swiper__bar_${blockId}`; 691 const blockText = document.createElement("div"); 692 blockText.className = `block_swiper__text_${blockId}`; 693 blockText.innerHTML = settings.images[i].text; 694 695 if (settings.showBar) { 696 const barSettings = document.createElement("div"); 697 barSettings.className = `block_swiper__barSettings_${blockId}`; 698 bar.appendChild(barSettings); 699 imgContainer.style.boxShadow = 'none'; 700 slide.style.justifyContent = 'flex-end'; 701 } 702 703 bar.appendChild(blockText); 704 link.appendChild(bar); 705 swiperWrapper.appendChild(slide); 706 } 707 */ 708 709 /* setTimeout(() => { */ 710 window[`swiper_${blockId}`] = new Swiper(`.swiper_${blockId}`, { 711 slidesPerView: 1, 712 spaceBetween: 60, 713 ...(settings.autoplay ? { autoplay: { delay: 5000 } } : {}), 714 loop: settings.loop || false, 715 navigation: { 716 nextEl: ".swiper-button-next", 717 prevEl: ".swiper-button-prev", 718 }, 719 pagination: { 720 el: ".swiper-pagination", 721 bulletClass: `block_swiper__paginationBullet_${blockId} swiper-pagination-bullet`, 722 bulletActiveClass: `block_swiper__paginationBulletActive_${blockId} swiper-pagination-bullet-active`, 723 }, 724 slidesPerView: "auto", 725 }); 726 727 const notifications = document.getElementsByClassName("swiper-notification"); 728 for (let i = notifications.length - 1; i >= 0; i--) { 729 notifications[i].remove(); 730 }; 731 /* }, 20); */ 732 }, 20); 733}; 734 735/*************************************************************************************************************************************************************/ 736 737function clickFaqQuestion(answerId) { 738 const $answer = $(`#${answerId}`); 739 if ($answer.css('display') == 'none') { $answer.show(); } 740 else { $answer.hide(); } 741} 742
743/*************************************************************************************************************************************************************/
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.