1function ready(fn) { 2 if (document.readyState !== 'loading') { 3 fn(); 4 } else { 5 document.addEventListener('DOMContentLoaded', fn); 6 } 7} 8 9// ready(function () { 10// console.log('ready'); 11// }); 12ready(function () { 13 14 const checkLoop = (embla) => { 15 const notEnoughToLoop = !embla.internalEngine().slideLooper.canLoop() 16 if (notEnoughToLoop) { 17 const slidesContainer = embla.slideNodes()[0].parentNode; 18 const slides = embla.slideNodes(); 19 slides.forEach((slide) => { 20 const clone = slide.cloneNode(true); 21 clone.classList.add('is-clone'); 22 slidesContainer.appendChild(clone); 23 }); 24 embla.reInit(); 25 } 26 } 27 28 const setupPrevNextBtns = (prevBtn, nextBtn, embla) => { 29 if (prevBtn) { 30 prevBtn.addEventListener('click', embla.scrollPrev, false); 31 } 32 if (nextBtn) { 33 nextBtn.addEventListener('click', embla.scrollNext, false); 34 } 35 }; 36 37 const updateActiveSlide = (embla) => { 38 const slides = embla.slideNodes(); 39 const setActiveSlide = () => {
40 slides.forEach(slide => slide.classList.remove('embla__slide--active')); 41 const selectedIndex = embla.selectedScrollSnap(); 42 slides[selectedIndex].classList.add('embla__slide--active'); 43 }; 44 embla.on('init', setActiveSlide); 45 embla.on('select', setActiveSlide); 46 }; 47 48 const setupEmblaCarousel = (emblaNode) => { 49 const viewPort = emblaNode.querySelector(".embla__viewport"); 50 const prevBtn = emblaNode.querySelector(".embla__button--prev"); 51 const nextBtn = emblaNode.querySelector(".embla__button--next"); 52 53 if (emblaNode.classList.contains('type--banners')) { 54 options = { align: 'center', loop: true }; 55 } else if (emblaNode.classList.contains('type--bannersCollection')) { 56 options = { align: 'start', loop: true }; 57 } else if (emblaNode.classList.contains('type--gallery')) { 58 options = { align: 'start', loop: false }; 59 } 60 61 const embla = EmblaCarousel(viewPort, options); 62 checkLoop(embla); 63 setupPrevNextBtns(prevBtn, nextBtn, embla); 64 updateActiveSlide(embla); 65 }; 66 67 const emblaNodes = [].slice.call(document.querySelectorAll(".embla")); 68 const emblaCarousels = emblaNodes.map(emblaNode => setupEmblaCarousel(emblaNode)); 69 70}); 71ready(function () { 72 Fancybox.bind("[data-fancybox]", {}); 73}); 74ready(function () { 75 76 const accordions = document.querySelectorAll('.blockAccordion details'); 77 accordions.forEach((accordion) => { 78 accordion.addEventListener('toggle', () => { 79 if (accordion.open) { 80 accordions.forEach((otherAccordion) => { 81 if (otherAccordion !== accordion) { 82 otherAccordion.open = false; 83 } 84 }); 85 } 86 }); 87 }); 88 89}); 90ready(function () { 91 document.querySelectorAll('a[href^="#"]').forEach(anchor => { 92 anchor.addEventListener('click', function (e) { 93 e.preventDefault(); 94 const targetId = this.getAttribute('href'); 95 const targetElement = document.querySelector(targetId); 96 if (targetElement) { 97 targetElement.scrollIntoView({ 98 behavior: 'smooth' 99 }); 100 targetElement.focus(); 101 } 102 }); 103 }); 104}); 105ready(function(){ 106 const appHeight = () => { 107 const doc = document.documentElement; 108 doc.style.setProperty('--app-height', `${window.innerHeight}px`); 109 } 110 window.addEventListener('resize', appHeight); 111 appHeight(); 112}); 113ready(function () { 114 115 // -- accesible menus from anysurfer -- 116 // ------------------------------------ 117 118 class DisclosureNav { 119 constructor(domNode) { 120 this.rootNode = domNode; 121 this.controlledNodes = []; 122 this.openIndex = null; 123 this.useArrowKeys = true; 124 this.topLevelNodes = [ 125 ...this.rootNode.querySelectorAll( 126 'button[aria-expanded][aria-controls]' 127 ), 128 ]; 129 130 this.topLevelNodes.forEach((node) => { 131 // handle button + menu 132 if ( 133 node.tagName.toLowerCase() === 'button' && 134 node.hasAttribute('aria-controls') 135 ) { 136 const menu = node.parentNode.querySelector('ul'); 137 if (menu) { 138 // save ref controlled menu 139 this.controlledNodes.push(menu); 140 141 // collapse menus 142 node.setAttribute('aria-expanded', 'false'); 143 this.toggleMenu(menu, false); 144 145 // attach event listeners 146 menu.addEventListener('keydown', this.onMenuKeyDown.bind(this)); 147 node.addEventListener('click', this.onButtonClick.bind(this)); 148 node.addEventListener('keydown', this.onButtonKeyDown.bind(this)); 149 } 150 } 151 // handle links 152 else { 153 this.controlledNodes.push(null); 154 node.addEventListener('keydown', this.onLinkKeyDown.bind(this)); 155 } 156 }); 157 158 this.rootNode.addEventListener('focusout', this.onBlur.bind(this)); 159 } 160 161 controlFocusByKey(keyboardEvent, nodeList, currentIndex) { 162 switch (keyboardEvent.key) { 163 case 'ArrowUp': 164 case 'ArrowLeft': 165 keyboardEvent.preventDefault(); 166 if (currentIndex > -1) { 167 var prevIndex = Math.max(0, currentIndex - 1); 168 nodeList[prevIndex].focus(); 169 } 170 break; 171 case 'ArrowDown': 172 case 'ArrowRight': 173 keyboardEvent.preventDefault(); 174 if (currentIndex > -1) { 175 var nextIndex = Math.min(nodeList.length - 1, currentIndex + 1); 176 nodeList[nextIndex].focus(); 177 } 178 break; 179 case 'Home': 180 keyboardEvent.preventDefault(); 181 nodeList[0].focus(); 182 break; 183 case 'End': 184 keyboardEvent.preventDefault(); 185 nodeList[nodeList.length - 1].focus(); 186 break; 187 } 188 } 189 190 // public function to close open menu 191 close() { 192 this.toggleExpand(this.openIndex, false); 193 } 194 195 onBlur(event) { 196 var menuContainsFocus = this.rootNode.contains(event.relatedTarget); 197 if (!menuContainsFocus && this.openIndex !== null) { 198 this.toggleExpand(this.openIndex, false); 199 } 200 } 201 202 onButtonClick(event) { 203 var button = event.target.closest('button'); 204 if (button) { 205 var buttonIndex = this.topLevelNodes.indexOf(button); 206 var buttonExpanded = button.getAttribute('aria-expanded') === 'true'; 207 this.toggleExpand(buttonIndex, !buttonExpanded); 208 } 209 } 210 211 onButtonKeyDown(event) { 212 var targetButtonIndex = this.topLevelNodes.indexOf(document.activeElement); 213 214 // close on escape 215 if (event.key === 'Escape') { 216 this.toggleExpand(this.openIndex, false); 217 } 218 219 // move focus into the open menu if the current menu is open 220 else if ( 221 this.useArrowKeys && 222 this.openIndex === targetButtonIndex && 223 event.key === 'ArrowDown' 224 ) { 225 event.preventDefault(); 226 this.controlledNodes[this.openIndex].querySelector('a').focus(); 227 } 228 229 // handle arrow key navigation between top-level buttons, if set 230 else if (this.useArrowKeys) { 231 this.controlFocusByKey(event, this.topLevelNodes, targetButtonIndex); 232 } 233 } 234 235 onLinkKeyDown(event) { 236 var targetLinkIndex = this.topLevelNodes.indexOf(document.activeElement); 237 238 // handle arrow key navigation between top-level buttons, if set 239 if (this.useArrowKeys) { 240 this.controlFocusByKey(event, this.topLevelNodes, targetLinkIndex); 241 } 242 } 243 244 onMenuKeyDown(event) { 245 if (this.openIndex === null) { 246 return; 247 } 248 249 var menuLinks = Array.prototype.slice.call( 250 this.controlledNodes[this.openIndex].querySelectorAll('a') 251 ); 252 var currentIndex = menuLinks.indexOf(document.activeElement); 253 254 // close on escape 255 if (event.key === 'Escape') { 256 this.topLevelNodes[this.openIndex].focus(); 257 this.toggleExpand(this.openIndex, false); 258 } 259 260 // handle arrow key navigation within menu links, if set 261 else if (this.useArrowKeys) { 262 this.controlFocusByKey(event, menuLinks, currentIndex); 263 } 264 } 265 266 toggleExpand(index, expanded) { 267 // close open menu, if applicable 268 if (this.openIndex !== index) { 269 this.toggleExpand(this.openIndex, false); 270 } 271
272 // handle menu at called index 273 if (this.topLevelNodes[index]) { 274 this.openIndex = expanded ? index : null; 275 this.topLevelNodes[index].setAttribute('aria-expanded', expanded); 276 this.toggleMenu(this.controlledNodes[index], expanded); 277 } 278 } 279 280 toggleMenu(domNode, show) { 281 if (domNode) { 282 if (window.innerWidth >= 768) { 283 domNode.style.display = show ? 'block' : 'none'; 284 } 285 } 286 } 287 288 updateKeyControls(useArrowKeys) { 289 this.useArrowKeys = useArrowKeys; 290 } 291 } 292 293 // -- Initialize Disclosure Menus -- 294 window.addEventListener( 295 'load', 296 function () { 297 let menus = document.querySelectorAll('.disclosure-nav'); 298 let disclosureMenus = []; 299 for (var i = 0; i < menus.length; i++) { 300 disclosureMenus[i] = new DisclosureNav(menus[i]); 301 } 302 }, 303 false 304 ); 305 306}); 307ready(function () { 308 309 // -- collection artist details -- 310 const readMoreBtn = document.querySelector('.btn__readmore'); 311 const readLessBtn = document.querySelector('.btn__readless'); 312 const readMoreContent = document.querySelector('.readmore__content'); 313 const mainContent = document.querySelector('.main'); 314 315 // -- Read more -- 316 if (readMoreBtn && readMoreContent) { 317 readMoreBtn.addEventListener('click', function (e) { 318 e.preventDefault(); 319 readMoreBtn.style.display = 'none'; 320 fadeIn(readMoreContent); 321 scrollToElement(readMoreContent); 322 }); 323 } 324 325 // -- Read less -- 326 if (readLessBtn && mainContent && readMoreBtn && readMoreContent) { 327 readLessBtn.addEventListener('click', function (e) { 328 e.preventDefault(); 329 scrollToElement(mainContent); 330 fadeIn(readMoreBtn); 331 fadeOut(readMoreContent); 332 }); 333 } 334 335 function scrollToElement(element) { 336 element.scrollIntoView({ behavior: 'smooth', block: 'start' }); 337 } 338 339 function fadeIn(element) { 340 element.style.opacity = 0; 341 element.style.display = 'block'; 342 343 let opacity = 0; 344 const timer = setInterval(function () { 345 if (opacity >= 1) { 346 clearInterval(timer); 347 } 348 opacity += 0.1; 349 element.style.opacity = opacity; 350 }, 30); 351 } 352 353 function fadeOut(element) { 354 let opacity = 1; 355 const timer = setInterval(function () { 356 if (opacity <= 0) { 357 clearInterval(timer); 358 element.style.display = 'none'; 359 } 360 opacity -= 0.1; 361 element.style.opacity = opacity; 362 }, 30); 363 } 364 365}); 366 367document.addEventListener('DOMContentLoaded', function () { 368 const resetBtn = document.getElementById('resetFilters'); 369 if (!resetBtn) return; 370 371 resetBtn.addEventListener('click', function () { 372 const form = document.querySelector('.filtersForm'); 373 if (!form) return; 374 375 // Reset all input/select fields 376 form.querySelectorAll('input, select').forEach(field => { 377 if (field.tagName === 'SELECT') { 378 field.value = '*'; // default value 379 } else { 380 field.value = ''; // clear dates 381 } 382 }); 383 384 // Submit form without query params 385 const action = form.getAttribute('action').split('?')[0]; 386 form.setAttribute('action', action); 387 form.submit(); 388 }); 389}); 390ready(function () { 391 392 // -- sticky menu -- 393 // ----------------- 394 395 let lastScroll = 0; 396 const header = document.querySelector("header"); 397 window.addEventListener("scroll", () => { 398 const currentScroll = window.pageYOffset; 399 if (currentScroll > lastScroll && currentScroll > header.offsetHeight) { 400 header.classList.add("-translate-y-full"); 401 } else { 402 header.classList.remove("-translate-y-full"); 403 } 404 lastScroll = currentScroll; 405 }); 406 407 408 409 // -- mobile menu -- 410 // ------------------ 411 412 const mainMenuBurgerBtn = document.getElementById("mainMenuBurgerBtn"); 413 const header__mainMenu = document.getElementById("header__mainMenu"); 414 const iconBurger = mainMenuBurgerBtn.querySelector(".icon-burger"); 415const iconClose = mainMenuBurgerBtn.querySelector(".icon-burger-close"); 416 417 mainMenuBurgerBtn.addEventListener('click', (e) => { 418 if (mainMenuBurgerBtn.classList.contains("mainMenu--open")) { 419 mainMenuBurgerBtn.classList.remove("mainMenu--open"); 420 header__mainMenu.classList.remove("mainMenu--open"); 421 document.body.classList.remove("overflow-hidden"); 422 423 // Switch icons 424 iconBurger.classList.remove("hidden"); 425 iconBurger.classList.add("block"); 426 iconClose.classList.remove("block"); 427 iconClose.classList.add("hidden"); 428 } else { 429 mainMenuBurgerBtn.classList.add("mainMenu--open"); 430 header__mainMenu.classList.add("mainMenu--open"); 431 document.body.classList.add("overflow-hidden"); 432 433 // Switch icons 434 iconBurger.classList.remove("block"); 435 iconBurger.classList.add("hidden"); 436 iconClose.classList.remove("hidden"); 437 iconClose.classList.add("block"); 438 } 439 440 }); 441 442 // -- reset open menu (mobile) -- 443 ['resize','orientationchange'].forEach(function(eventType){ 444 window.addEventListener(eventType, (e) => { 445 mainMenuBurgerBtn.classList.remove("mainMenu--open"); 446 header__mainMenu.classList.remove("mainMenu--open"); 447 iconBurger.classList.remove("hidden"); 448iconBurger.classList.add("block"); 449iconClose.classList.remove("block"); 450iconClose.classList.add("hidden"); 451 452 }); 453 }); 454 455 456}); 457document.addEventListener('DOMContentLoaded', function () { 458 /** 459 * Throttle function to delay the execution of a callback 460 */ 461 function throttle(func, delay) { 462 let timer = null; 463 return function () { 464 const context = this; 465 const args = arguments; 466 clearTimeout(timer); 467 timer = setTimeout(function () {
468 func.apply(context, args); 469 }, delay || 300); 470 }; 471 } 472 473 /** 474 * Reset the search list display 475 */ 476 function resetSearchList() { 477 document.querySelectorAll('.search__list .all__results, .search__list .results__wrapper').forEach(el => { 478 el.style.display = 'none'; 479 }); 480 document.querySelectorAll('.search__list .results').forEach(el => { 481 el.innerHTML = ''; 482 }); 483 document.querySelector('.search__list').style.overflow = 'hidden'; 484 } 485 486 /** 487 * Helper to fade in an element 488 */ 489 function fadeIn(el) { 490 el.style.opacity = 0; 491 el.style.display = 'block'; 492 let last = +new Date(); 493 const tick = function () { 494 el.style.opacity = +el.style.opacity + (new Date() - last) / 200; 495 last = +new Date(); 496 497 if (+el.style.opacity < 1) { 498 requestAnimationFrame(tick); 499 } 500 }; 501 tick(); 502 } 503 504 // -- open search form -- 505 document.querySelector('.searchTrigger').addEventListener('click', function () { 506 document.body.classList.add('search--open'); 507 document.querySelector('.search__input').focus(); 508 }); 509 510 //-- close search form -- 511 document.querySelector('.btn__close').addEventListener('click', function () { 512 document.body.classList.remove('search--open'); 513 document.querySelector('.search__input').blur(); 514 }); 515 516 // -- search autocomplete logic -- 517 let lastValue = ''; 518 519 document.querySelector('.search__input').addEventListener('keyup', throttle(function (e) { 520 const input = e.target; 521 const val = input.value; 522 const jsonUrl = document.querySelector('.search__form').getAttribute('data-jsonurl'); 523 524 if (val.length === 0) { 525 resetSearchList(); 526 return; 527 } 528 529 if (val.length <= 1 || val === lastValue) { 530 return; 531 } 532 533 resetSearchList(); 534 535 // Helper to fetch JSON and return data 536 function fetchJSON(url, callback) { 537 fetch(url) 538 .then(response => response.json()) 539 .then(json => callback(json.data)); 540 } 541 542 543 const jsonUrlAll = jsonUrl + '?q=' + encodeURIComponent(val); 544 fetchJSON(jsonUrlAll, function (data) { 545 const sections = { 546 artists: [], 547 events: [], 548 exhibitions: [], 549 artworks: [], 550 publications: [], 551 news: [], 552 mainMenu: [] 553 }; 554 555 const sectionMap = { 556 typeArtists: 'artists', 557 typeEvents: 'events', 558 typeExhibitions: 'exhibitions', 559 typeSmallMuseum: 'exhibitions', 560 typeVirtualResidency: 'exhibitions', 561 typeArtworks: 'artworks', 562 typePublications: 'publications', 563 typeNews: 'news', 564 typeWebpage: 'mainMenu', 565 typeCollection: 'mainMenu', 566 typeChannelList: 'mainMenu', 567 }; 568 569 data.forEach(item => { 570 const html = `<li><a href="${item.url}">${item.title}</a></li>`; 571 const key = sectionMap[item.sectionType]; 572 if (key && sections[key]) { 573 sections[key].push(html); 574 } 575 }); 576 577 document.querySelector('.search__list').style.overflow = 'scroll'; 578 579 if (Object.values(sections).some(arr => arr.length > 0)) { 580 fadeIn(document.querySelector('.search__list .all__results')); 581 } 582 583 if (sections.artists.length) { 584 document.querySelector('.results--artists').innerHTML = sections.artists.join(''); 585 fadeIn(document.querySelector('.artists__wrapper')); 586 } 587 if (sections.events.length) { 588 document.querySelector('.results--events').innerHTML = sections.events.join(''); 589 fadeIn(document.querySelector('.events__wrapper')); 590 } 591 if (sections.exhibitions.length) { 592 document.querySelector('.results--exhibitions').innerHTML = sections.exhibitions.join(''); 593 fadeIn(document.querySelector('.exhibitions__wrapper')); 594 } 595 if (sections.artworks.length) { 596 document.querySelector('.results--artworks').innerHTML = sections.artworks.join(''); 597 fadeIn(document.querySelector('.artworks__wrapper')); 598 } 599 if (sections.publications.length) { 600 document.querySelector('.results--publications').innerHTML = sections.publications.join(''); 601 fadeIn(document.querySelector('.publications__wrapper')); 602 } 603 if (sections.news.length) { 604 document.querySelector('.results--news').innerHTML = sections.news.join(''); 605 fadeIn(document.querySelector('.news__wrapper')); 606 } 607 if (sections.mainMenu.length) { 608 document.querySelector('.results--others').innerHTML = sections.mainMenu.join(''); 609 fadeIn(document.querySelector('.others__wrapper')); 610 } 611 }); 612 613 /* const jsonUrlCategories = jsonUrl + '/categories?q=' + encodeURIComponent(val); 614 615 fetchJSON(jsonUrlCategories, function (data) { 616 const categories = { 617 thematics: [], 618 tags: [] 619 }; 620 621 data.forEach(item => { 622 const html = `<li><a href="${item.url}">${item.title}</a></li>`; 623 if (categories[item.group]) { 624 categories[item.group].push(html); 625 } 626 }); 627 628 if (categories.thematics.length || categories.tags.length) { 629 fadeIn(document.querySelector('.search__list .all__results')); 630 } 631 632 if (categories.thematics.length) { 633 document.querySelector('.results--thematics').innerHTML = categories.thematics.join(''); 634 fadeIn(document.querySelector('.thematics__wrapper')); 635 } 636 if (categories.tags.length) { 637 document.querySelector('.results--tags').innerHTML = categories.tags.join(''); 638 fadeIn(document.querySelector('.thematics__wrapper')); 639 } 640 }); */ 641 642 643 644
645 lastValue = val; 646 647 }, 400)); 648 649 });//# sourceMappingURL=maps/scripts.js.map
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.