1;(function(){ 2"use strict"; 3document.addEventListener('DOMContentLoaded',function(){ 4const body=document.querySelector('body'); 5const offsetMenu=bootstrap.Offcanvas.getOrCreateInstance(document.getElementById('navigation')); 6const reduceMotion=window.matchMedia('(prefers-reduced-motion: reduce)').matches; 7const isMobile=/Mobi|Android|webOS|iPhone|iPod|BlackBerry|Windows Phone|IEMobile|Opera Mini/i.test(navigator.userAgent); 8function wrap(el,wrapper){ 9el.parentNode.insertBefore(wrapper,el); 10wrapper.appendChild(el); 11} 12function isElement(element){ 13return element instanceof Element||element instanceof HTMLDocument; 14} 15setInterval(function(){ 16body.classList.remove('en-chargement'); 17},50); 18[...document.querySelectorAll('.accordion-button')].forEach(elem=>{ 19elem.classList.add('cursor-show'); 20elem.dataset.cursorTitle='Déplier'; 21}); 22const cursorCircle=document.getElementById('cursor-circle'); 23const cursorShowElements=document.querySelectorAll('.cursor-show'); 24if(isElement(cursorCircle)&&cursorShowElements.length>0){ 25var mouseX=0,mouseY=0; 26var xp=0,yp=0; 27var pageWidth=body.offsetWidth; 28var pageHeight=body.offsetHeight; 29window.addEventListener("resize",(event)=>{ 30pageWidth=body.offsetWidth; 31pageHeight=body.offsetHeight; 32}); 33document.addEventListener('mousemove',(event)=>{ 34mouseX=event.pageX-140; 35mouseY=event.pageY+20; 36if(mouseX>(pageWidth-160)) 37mouseX=pageWidth-160; 38if(mouseY>(pageHeight-20-120)) 39mouseY=pageHeight-20-120; 40}); 41setInterval(function(){ 42if(Math.abs(mouseX-xp)>1||Math.abs(mouseY-yp)>1){ 43xp+=((mouseX-xp)/6); 44yp+=((mouseY-yp)/6); 45cursorCircle.style.left=xp+'px'; 46cursorCircle.style.top=yp+'px'; 47} 48},20); 49cursorShowElements.forEach(function(itemEl){ 50itemEl.addEventListener('mouseenter',(event)=>{ 51if(itemEl.classList.contains('collapsed')) 52cursorCircle.innerText="Déplier"; 53else if(itemEl.classList.contains('accordion-button')) 54cursorCircle.innerText="Replier"; 55else 56cursorCircle.innerText=itemEl.dataset.cursorTitle; 57cursorCircle.classList.add('visible'); 58}); 59itemEl.addEventListener('mouseleave',(event)=>{ 60cursorCircle.classList.remove('visible'); 61}); 62}); 63} 64function previewMainImageLoaded(event){ 65event.target.classList.add('cover-with-preview-loaded'); 66} 67document.querySelectorAll('.cover-with-preview>picture>img').forEach(function(itemEl){ 68if(!itemEl.complete){ 69itemEl.classList.add('cover-with-preview-incoming'); 70itemEl.addEventListener('load',previewMainImageLoaded); 71} 72}); 73if(document.querySelector('.menu-niveau-2-rubrique.show')) 74document.querySelector('.menu-niveau-2').classList.add('show'); 75if(document.querySelector('.menu-niveau-3-rubrique.show')) 76document.querySelector('.menu-niveau-3').classList.add('show'); 77const navigation=document.getElementById('navigation'); 78let menuNiv2toshow=null; 79let menuNiv3toshow=null; 80navigation.addEventListener('show.bs.offcanvas',event=>{ 81menuNiv2toshow=document.querySelector('.menu-niveau-2-rubrique.show'); 82if(isElement(menuNiv2toshow)){ 83menuNiv2toshow.style.display='none'; 84menuNiv2toshow.classList.remove('show'); 85} 86menuNiv3toshow=document.querySelector('.menu-niveau-3-rubrique.show'); 87if(isElement(menuNiv3toshow)){ 88menuNiv3toshow.style.display='none'; 89menuNiv3toshow.classList.remove('show'); 90} 91}); 92navigation.addEventListener('shown.bs.offcanvas',event=>{ 93if(isElement(menuNiv2toshow)){ 94menuNiv2toshow.style.display='block'; 95setTimeout(()=>{ 96menuNiv2toshow.classList.add('show'); 97},20); 98} 99if(isElement(menuNiv3toshow)){ 100menuNiv3toshow.style.display='block'; 101setTimeout(()=>{ 102menuNiv3toshow.classList.add('show'); 103},320); 104} 105}); 106document.querySelectorAll('.offcanvas-nav-item-withsub').forEach(function(itemEl){ 107itemEl.addEventListener('click',function(e){ 108if(this.dataset.navNiveau=='2'){ 109document.querySelectorAll('.offcanvas-nav-item-withsub.active').forEach(function(active){ 110active.classList.remove('active'); 111}); 112} 113if(this.dataset.navNiveau=='3'){ 114document.querySelectorAll('.menu-niveau-2 .offcanvas-nav-item-withsub.active').forEach(function(active){ 115active.classList.remove('active'); 116}); 117} 118this.classList.add('active'); 119if(this.dataset.navNiveau=='2'){ 120document.querySelector('.menu-niveau-2').classList.add('show'); 121document.querySelector('.menu-niveau-3').classList.remove('show'); 122if(document.querySelector('.menu-niveau-3.active')) 123document.querySelector('.menu-niveau-3.active').classList.remove('show'); 124} 125if(this.dataset.navNiveau=='3'){ 126document.querySelector('.menu-niveau-3').classList.add('show'); 127} 128document.querySelectorAll('.menu-subniveau[data-nav-niveau="'+this.dataset.navNiveau+'"]').forEach(function(rub){ 129rub.style.display='none'; 130rub.classList.remove('show'); 131}); 132document.querySelectorAll('.menu-subniveau[data-nav-niveau="3"]').forEach(function(rub){ 133rub.style.display='none'; 134rub.classList.remove('show'); 135}); 136document.querySelector('.menu-subniveau[data-nav-rubrique="'+this.dataset.navRubrique+'"]').style.display='block'; 137setTimeout(()=>{ 138document.querySelector('.menu-subniveau[data-nav-rubrique="'+this.dataset.navRubrique+'"]').classList.add('show'); 139},50); 140document.querySelector('.menu-subniveau[data-nav-rubrique="'+this.dataset.navRubrique+'"] a:first-of-type').focus(); 141}); 142}); 143document.querySelectorAll('.menu-subniveau-close').forEach(function(itemEl){ 144itemEl.addEventListener('click',function(e){ 145e.stopPropagation(); 146if(this.dataset.navNiveau=='2'){ 147document.querySelectorAll('.offcanvas-nav-item-withsub.active').forEach(function(active){ 148active.classList.remove('active'); 149}); 150document.querySelector('.menu-niveau-2.show').classList.remove('show'); 151} 152if(this.dataset.navNiveau=='3'){ 153document.querySelectorAll('.menu-niveau-2 .offcanvas-nav-item-withsub.active').forEach(function(active){ 154active.classList.remove('active'); 155}); 156document.querySelector('.menu-niveau-3.show').classList.remove('show'); 157} 158}
158); 159}); 160var offcanvasBackdropRowTriggerList=[].slice.call(document.querySelectorAll('.offcanvas-body .row')) 161var offcanvasBackdropRowList=offcanvasBackdropRowTriggerList.map(function(offcanvasBackdropRowTriggerEl){ 162offcanvasBackdropRowTriggerEl.addEventListener('click',function(e){ 163if(this==e.target){ 164offsetMenu.hide(); 165} 166}); 167}); 168document.querySelectorAll('a.spip_out, a.img-spip-clic-out').forEach(function(lien){ 169lien.setAttribute('target','_blank'); 170if(lien.getAttribute('rel')!==null&&lien.getAttribute('rel').indexOf('noopener')===-1) 171lien.setAttribute('rel',lien.getAttribute('rel')+' noopener'); 172else 173lien.setAttribute('rel','noopener'); 174}); 175document.querySelectorAll('table.spip').forEach(function(tableau){ 176let wrapper=document.createElement('div'); 177wrapper.classList.add('table-responsive'); 178wrap(tableau,wrapper); 179}); 180document.querySelectorAll('iframe[src*="docs.google.com"]').forEach(function(frame){ 181frame.classList.add('iframe-google-doc'); 182frame.setAttribute('width','100%'); 183}); 184document.querySelectorAll('iframe:not(.iframe-google-doc):not([src^="https://www.google.com/recaptcha"])').forEach(function(frame){ 185frame.classList.add('embed-responsive-item'); 186let wrapper=document.createElement('div'); 187wrapper.classList.add('ratio','ratio-16x9'); 188wrap(frame,wrapper); 189}); 190var choixLangue=document.querySelector('.choix-langue'); 191if(choixLangue!==null){ 192choixLangue.addEventListener('change',function(evt){ 193window.location.assign(this.value); 194}); 195} 196document.querySelectorAll('video[data-video-mp4]').forEach(function(video){ 197let autoplay=video.getAttribute('autoplay')!=null?true:false; 198if(reduceMotion){ 199video.setAttribute('autoplay','false'); 200autoplay=false; 201} 202if(!isMobile||(isMobile&&video.dataset.videoMobile=='true')){ 203video.innerHTML='<source src="'+video.dataset.videoMp4+'" type="video/mp4">'; 204if(video.dataset.videoControlledBy){ 205let toggle=document.getElementById(video.dataset.videoControlledBy); 206if(isElement(toggle)){ 207if(autoplay){ 208toggle.querySelector('[data-video-toggle="play"]').classList.add('d-none'); 209toggle.querySelector('[data-video-toggle="pause"]').classList.remove('d-none'); 210}else{ 211toggle.querySelector('[data-video-toggle="play"]').classList.remove('d-none'); 212toggle.querySelector('[data-video-toggle="pause"]').classList.add('d-none'); 213} 214} 215} 216}else{ 217if(video.dataset.videoControlledBy){ 218let toggle=document.getElementById(video.dataset.videoControlledBy); 219if(isElement(toggle)){ 220toggle.classList.add('d-none'); 221} 222} 223} 224}); 225document.querySelectorAll('[data-video-play-toggle="true"]').forEach(function(toggle){ 226let video=document.getElementById(toggle.dataset.videoControls); 227if(isElement(video)){ 228toggle.addEventListener("click",function(t){ 229if(video.paused){ 230video.play(); 231toggle.querySelector('[data-video-toggle="play"]').classList.add('d-none'); 232toggle.querySelector('[data-video-toggle="pause"]').classList.remove('d-none'); 233}else{ 234video.pause(); 235toggle.querySelector('[data-video-toggle="play"]').classList.remove('d-none'); 236toggle.querySelector('[data-video-toggle="pause"]').classList.add('d-none'); 237} 238},false); 239} 240}); 241const intro=document.querySelector('header.header'); 242if(intro!=null){ 243let observerOptions={ 244root:null, 245rootMargin:"0px 0px 0px 0px", 246threshold:[0,0.1,0.2,0.3,0.4] 247}; 248let observer=new IntersectionObserver(introIntersectionCallback,observerOptions); 249observer.observe(intro); 250} 251function introIntersectionCallback(entries){ 252if(entries[0].intersectionRatio>0.3){ 253document.body.classList.remove('page-defilee'); 254}else{ 255document.body.classList.add('page-defilee'); 256document.body.classList.add('page-defilee-once'); 257} 258} 259const footer=document.querySelector('footer.footer'); 260if(footer!=null){ 261let observerOptions={ 262root:null, 263rootMargin:"0px 0px 0px 0px", 264threshold:[0,0.1,0.2,0.3,0.4] 265}; 266let observer=new IntersectionObserver(footerIntersectionCallback,observerOptions); 267observer.observe(footer); 268} 269function footerIntersectionCallback(entries){ 270if(entries[0].intersectionRatio<0.3){ 271footer.classList.remove('footer-visible'); 272}else{ 273footer.classList.add('footer-visible'); 274footer.classList.add('footer-visible-once'); 275} 276} 277var fadingWithScrollElements,fadingWithScrollOffsetStart,fadingWithScrollOffsetEnd; 278const fadingWithScrollEvent=function(scrollPosition=0){ 279if(fadingWithScrollElements==null) 280return; 281for(var i=0,len=fadingWithScrollElements.length|0;i<len;i=i+1|0){ 282let opacity=0; 283if(scrollPosition<=fadingWithScrollOffsetStart[i]) 284opacity=1; 285else if(scrollPosition<=fadingWithScrollOffsetEnd[i]) 286opacity=1-(scrollPosition-fadingWithScrollOffsetStart[i])/(fadingWithScrollOffsetEnd[i]-fadingWithScrollOffsetStart[i]); 287fadingWithScrollElements[i].style.opacity=opacity; 288} 289} 290function fadingWithScrollSetParameters(){ 291fadingWithScrollOffsetStart=new Array(fadingWithScrollElements.length), 292fadingWithScrollOffsetEnd=new Array(fadingWithScrollElements.length); 293for(var i=0,len=fadingWithScrollElements.length|0;i<len;i=i+1|0){ 294let rect=fadingWithScrollElements[i].getBoundingClientRect(); 295let h=fadingWithScrollElements[i].offsetHeight; 296let vpOffset=0; 297if(fadingWithScrollElements[i].dataset.scrollviewport!==undefined) 298vpOffset=window.innerHeight*(-parseInt(fadingWithScrollElements[i].dataset.scrollviewport)/100); 299fadingWithScrollOffsetStart[i]=rect.top+window.scrollY+vpOffset+h*parseInt(fadingWithScrollElements[i].dataset.scrolloffsetstart)/100; 300fadingWithScrollOffsetEnd[i]=rect.bottom+window.scrollY+vpOffset+h*parseInt(fadingWithScrollElements[i].dataset.scrolloffsetend)/100; 301} 302} 303function fadingWithScroll(){ 304fadingWithScrollElements=document.getElementsByClassName('fading-on-scroll'); 305if(fadingWithScrollElements.length>0){ 306fadingWithScrollSetParameters(); 307if(lenisActivated!=null){ 308lenisInstance.on('scroll',({scroll})=>fadingWithScrollEvent(scroll)); 309}else{ 310document.addEventListener('scroll',(event)=>fadingWithScrollEvent(window.scrollY),{passive:true}); 311} 312} 313} 314if(!reduceMotion){ 315fadingWithScroll(); 316window.addEventListener('resize',(event)=>fadingWithScrollSetParameters()); 317} 318var boutonImprimer=document.querySelector('.imprimer-page'); 319if(boutonImprimer!==null){ 320boutonImprimer.addEventListener('click',(e)=>{ 321e.preventDefault(); 322window.print(); 323}); 324} 325var boutonPartageNatif=document.querySelector('.partage-natif'); 326if(boutonPartageNatif!==null){ 327let shareData={ 328title:boutonPartageNatif.dataset.title, 329text:boutonPartageNatif.dataset.title, 330url:boutonPartageNatif.dataset.url, 331} 332if(navigator.canShare&&navigator.canShare(shareData)){ 333boutonPartageNatif.classList.add('d-inline-block'); 334boutonPartageNatif.addEventListener('click',async()=>{ 335navigator.share(shareData); 336}); 337} 338} 339var boutonCopieArk=document.getElementById('btn-copier-ark'); 340if(boutonCopieArk!==null){ 341boutonCopieArk.addEventListener('click',function(){ 342var input=document.getElementById('lien_ark'); 343navigator.clipboard.writeText(input.value).then(function(){
344var btn=document.getElementById('btn-copier-ark'); 345var originalHTML=btn.innerHTML; 346btn.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-check-lg" viewBox="0 0 16 16" aria-hidden="true"><path d="M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425z"/></svg>'; 347setTimeout(function(){btn.innerHTML=originalHTML;},2000); 348}); 349}); 350} 351let lightgalleryElms=Array.from(document.querySelectorAll('.lightgallery-video, .lightgallery-image, .article .img-spip-clic-image, a.img-spip-clic, .documents-portfolio a, .article-oeuvres-hd .texte a, .oeuvre-fiche-image .oeuvre-image')); 352if(lightgalleryElms.length>=1){ 353import('/squelettes/javascript/lightGallery/lightgallery.min.js') 354.then(module=>{ 355const lightboxTraductions={ 356closeGallery:'Fermer la gallerie', 357toggleMaximize:'Agrandir au maximum', 358previousSlide:'Diapositive précédente', 359nextSlide:'Diapositive suivante', 360download:'Télécharger', 361playVideo:'Lire la vidéo', 362} 363let docElms=Array.from(document.querySelectorAll('.article .img-spip-clic-image')); 364if(docElms.length>=1){ 365import('/squelettes/javascript/lightGallery/plugins/mediumZoom/lg-medium-zoom.min.js') 366.then(module=>{ 367const lightboxArticles=Array.from(document.querySelectorAll('.article')); 368lightboxArticles.forEach((item)=>{ 369lightGallery(item,{ 370licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 371selector:'.img-spip-clic-image', 372plugins:[lgMediumZoom], 373backgroundColor:'#222', 374download:false, 375strings:lightboxTraductions, 376mobileSettings:{ 377controls:false, 378showCloseIcon:true, 379}, 380}); 381}); 382}); 383} 384const lightboxLignes=Array.from(document.querySelectorAll('.img-spip-lignes-container')); 385lightboxLignes.forEach((item)=>{ 386lightGallery(item,{ 387licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 388selector:'a.img-spip-clic', 389zoomFromOrigin:false, 390download:false, 391allowMediaOverlap:true, 392strings:lightboxTraductions, 393mobileSettings:{ 394controls:false, 395showCloseIcon:true, 396}, 397}); 398}); 399const lightboxCarrousels=Array.from(document.querySelectorAll('.carrousel-main')); 400lightboxCarrousels.forEach((item)=>{ 401lightGallery(item,{ 402licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 403selector:'.splide__slide:not(.splide__slide--clone) a.img-spip-clic', 404zoomFromOrigin:false, 405download:false, 406allowMediaOverlap:true, 407strings:lightboxTraductions, 408mobileSettings:{ 409controls:false, 410showCloseIcon:true, 411}, 412}); 413item.addEventListener('lgAfterSlide',(event)=>{ 414const{index,prevIndex}=event.detail; 415for(var i=splideObjects.length-1;i>=0;i--){ 416if(splideObjects[i].root==item){ 417splideObjects[i].go(index); 418} 419} 420}); 421}); 422const lightboxPorfolios=Array.from(document.querySelectorAll('.documents-portfolio')); 423lightboxPorfolios.forEach((item)=>{ 424lightGallery(item,{ 425licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 426selector:'a', 427zoomFromOrigin:false, 428download:false, 429allowMediaOverlap:true, 430strings:lightboxTraductions, 431mobileSettings:{ 432controls:false, 433showCloseIcon:true, 434}, 435}); 436}); 437const lightboxImages=Array.from(document.querySelectorAll('.lightgallery-image')); 438lightboxImages.forEach((item)=>{ 439lightGallery(item,{ 440licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 441selector:'this', 442zoomFromOrigin:false, 443controls:false, 444counter:false, 445download:false, 446hideScrollbar:true, 447allowMediaOverlap:true, 448strings:lightboxTraductions, 449mobileSettings:{ 450controls:false, 451showCloseIcon:true, 452}, 453}); 454}); 455const lightboxVideos=Array.from(document.querySelectorAll('.lightgallery-video')); 456if(lightboxVideos.length>=1){ 457import('/squelettes/javascript/lightGallery/plugins/video/lg-video.min.js') 458.then(module=>{ 459lightboxVideos.forEach((item)=>{ 460lightGallery(item,{ 461licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 462selector:'this', 463plugins:[lgVideo], 464zoomFromOrigin:false, 465counter:false, 466download:false, 467hideScrollbar:true, 468allowMediaOverlap:true, 469strings:lightboxTraductions, 470mobileSettings:{ 471controls:false, 472showCloseIcon:true, 473}, 474}); 475}); 476}); 477} 478const lightboxGigascopes=Array.from(document.querySelectorAll('.article-oeuvres-hd .texte a'));
479lightboxGigascopes.forEach((item)=>{ 480item.setAttribute('data-iframe','true'); 481lightGallery(item,{ 482licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 483selector:'this', 484counter:false, 485download:false, 486hideScrollbar:true, 487strings:lightboxTraductions, 488iframeMaxHeight:"90%", 489iframeMaxWidth:"90%", 490}); 491}); 492const lightboxOeuvreImage=Array.from(document.querySelectorAll('.oeuvre-fiche-image')); 493lightboxOeuvreImage.forEach((item)=>{ 494lightGallery(item,{ 495licenseKey:'22CA2D35-C60948C4-B1607D48-FA94AF46', 496selector:'a.oeuvre-image', 497zoomFromOrigin:false, 498download:false, 499hideScrollbar:true, 500allowMediaOverlap:false, 501strings:lightboxTraductions, 502mobileSettings:{ 503controls:false, 504showCloseIcon:true, 505}, 506}); 507}); 508}); 509} 510let splideElms=document.querySelectorAll('.splide:not(.splide-nav)'); 511var splideObjects=new Array(); 512if(splideElms.length>=1){ 513import('/squelettes/javascript/splide.js') 514.then(module=>{ 515Splide.defaults={ 516type:'fade', 517speed:1200, 518rewindSpeed:1200, 519waitForTransition:false, 520i18n:{ 521prev:'Diapositive précédente', 522next:'Diapositive suivante', 523first:'Aller à la première diapositive', 524last:'Aller à la dernière diapositive', 525slideX:'Aller à la diapositive n°%s', 526pageX:'Aller à la page n°%s', 527play:'Lecture automatique', 528pause:'Mettre en pause', 529carousel:'Carrousel', 530select:'Choisissez une diapositive à afficher', 531slide:'Diapositive', 532slideLabel:'%s sur %s', 533}, 534} 535for(let i=0;i<splideElms.length;i++){ 536let navElem=document.getElementById(splideElms[i].getAttribute('data-splide-nav')); 537let nav; 538let slider; 539if(navElem!=null){ 540slider=new Splide(splideElms[i],{type:'loop'}); 541nav=new Splide(navElem,{type:'slide'}); 542slider.sync(nav); 543}else{ 544slider=new Splide(splideElms[i],{type:'fade'}); 545} 546slider.mount(); 547if(navElem!=null){ 548nav.mount(); 549} 550splideObjects.push(slider); 551} 552}); 553} 554var forms=document.querySelectorAll('.validate-form'); 555Array.prototype.slice.call(forms) 556.forEach(function(form){ 557form.querySelector('[type=submit]').addEventListener('click',function(event){ 558if(!form.checkValidity()){ 559form.classList.add('validate-form-done'); 560} 561},false) 562}); 563}); 564})(); 565;(function($){ 566"use strict"; 567Array.prototype.move=function(from,to){ 568this.splice(to,0,this.splice(from,1)[0]); 569}; 570$.fn.random=function(){ 571return this.eq(Math.floor(Math.random()*this.length)); 572} 573$.fn.rechercheOeuvreInitSelect=function(selectedOption){ 574let dropdown=$(this); 575dropdown.empty(); 576dropdown.append('<option value="">...</option>'); 577if(!selectedOption)dropdown.prop('selectedIndex',0); 578let searchParams=new URLSearchParams(window.location.search) 579let parametresSupplementaires=''; 580searchParams.forEach(function(index,el){ 581if(el.startsWith('Zone')&&searchParams.get(el)!=selectedOption&&searchParams.get(el)!='') 582parametresSupplementaires+='&autresChamps[]='+searchParams.get(el); 583if(el=='recherche_libre') 584parametresSupplementaires+='&recherche_libre='+searchParams.get(el); 585if(el=='musee') 586parametresSupplementaires+='&musee='+searchParams.get(el); 587}); 588const url=document.location.origin+'/squelettes/ajax/oeuvres_champs.php?id_zone='+$(this).data('zone')+'&champ='+$(this).data('champ')+'&parent='+$(this).data('parent')+parametresSupplementaires; 589$.getJSON(url,function(data){ 590if(data.length>0){ 591dropdown.prop('disabled',false); 592$.each(data,function(key,entry){ 593dropdown.append($('<option></option>').attr('value',entry.id_contenu).text(entry.contenu)); 594}); 595if(selectedOption){ 596dropdown.val(selectedOption); 597} 598}else{ 599if(dropdown.parent().find('.oeuvres-select').length==1){ 600dropdown.append($('<option selected="selected"> aucun choix disponible</option>')); 601dropdown.prop('disabled',true); 602}else{ 603dropdown.parent().find('.oeuvres-select-separation').last().remove(); 604dropdown.remove(); 605} 606} 607}); 608return dropdown; 609} 610$.fn.rechercheOeuvreInitCritereFromParameter=function(zoneChamp,contenu){ 611let leCritere=$(this); 612leCritere.append('<button class="btn critere-supp"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16"> <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg></button><span class="critere-libelle">'+$('.ajouter-critere').find('option[value='+zoneChamp+']').text()+'</span><span class="oeuvres-select-separation"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-compact-right" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671z"/></svg></span>') 613const url=document.location.origin+'/squelettes/ajax/oeuvres_arbochamps.php?id_zone='+zoneChamp.split('-')[0]+'&champ='+zoneChamp.split('-')[1]+'&contenu='+contenu; 614$.getJSON(url,function(data){ 615if(data.length>0){ 616$.each(data,function(key,entry){ 617if(key>0) 618leCritere.append('<span class="oeuvres-select-separation"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-compact-right" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671z"/></svg></span>'); 619leCritere.append('<select class="form-select oeuvres-select" data-zone="'+zoneChamp.split('-')[0]+'" data-champ="'+zoneChamp.split('-')[1]+'" data-parent="'+entry+'"></select></div>'); 620if(key<data.length) 621leCritere.find('.oeuvres-select').last().rechercheOeuvreInitSelect(data[key+1]); 622else 623leCritere.find('.oeuvres-select').last().rechercheOeuvreInitSelect(); 624}); 625} 626}); 627return leCritere; 628} 629$(document).on('click','.input-group-recherche-libre button',function(event){ 630event.preventDefault(); 631let rechercheLibre=$('.input-group-recherche-libre input').val(); 632var url=new URL(document.location.href); 633if(rechercheLibre!=''){ 634url.searchParams.set('recherche_libre',rechercheLibre); 635}else{ 636url.searchParams.delete('recherche_libre'); 637} 638url.searchParams.delete('debut_oeuvres'); 639window.history.pushState("object or string","Title",url.href); 640setOeuvresURLretour(); 641$('#oeuvres-recherche').attr('action',url.href); 642$('#oeuvres-recherche').submit(); 643$('.oeuvres-select').each(function(index,el){ 644$(this).rechercheOeuvreInitSelect($(this).val()); 645}); 646}); 647$(document).on('click','.btn-recherche-musee',function(event){ 648event.preventDefault(); 649var url=new URL(document.location.href); 650if($(this).data('musee')!=''||$(this).data('musee')=='0'){ 651url.searchParams.set('musee',$(this).data('musee')); 652}else{ 653url.searchParams.delete('musee'); 654} 655url.searchParams.delete('debut_oeuvres'); 656window.history.pushState("object or string","Title",url.href); 657setOeuvresURLretour(); 658if($(this).data('musee')!=''||$(this).data('musee')=='0'){ 659const oldMuseeIDrubrique=$('.btn-musee-active').data('musee-rubrique'); 660$('.btn-musee-active').removeClass('btn-musee-'+oldMuseeIDrubrique).removeClass('btn-musee-active').addClass('btn-white').addClass('btn-musee-hover-'+oldMuseeIDrubrique);
661$(this).removeClass('btn-white').addClass('btn-musee-'+$(this).data('musee-rubrique')).addClass('btn-musee-active'); 662$('.btn-recherche-musee-tous').removeClass('btn-black').addClass('btn-white').addClass('btn-white-to-black'); 663}else{ 664const oldMuseeIDrubrique=$('.btn-musee-active').data('musee-rubrique'); 665$('.btn-musee-active').removeClass('btn-musee-'+oldMuseeIDrubrique).removeClass('btn-musee-active').addClass('btn-white').addClass('btn-musee-hover-'+oldMuseeIDrubrique); 666$('.btn-recherche-musee-tous').addClass('btn-black').removeClass('btn-white').removeClass('btn-white-to-black'); 667} 668$('#oeuvres-recherche').attr('action',url.href); 669$('#oeuvres-recherche').submit(); 670$('.oeuvres-select').each(function(index,el){ 671$(this).rechercheOeuvreInitSelect($(this).val()); 672}); 673}); 674$(document).on('change','.ajouter-critere',function(event){ 675event.preventDefault(); 676$('<div class="critere-recherche clearfix" data-zone="'+$(this).val().split('-')[0]+'" data-champ="'+$(this).val().split('-')[1]+'"><button class="btn critere-supp"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x" viewBox="0 0 16 16"> <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/></svg></button><span class="critere-libelle">'+$(this).find('option:selected').text()+'</span><span class="oeuvres-select-separation"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-compact-right" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671z"/></svg></span><select class="form-select oeuvres-select" data-zone="'+$(this).val().split('-')[0]+'" data-champ="'+$(this).val().split('-')[1]+'" data-parent=""></select></div>').insertBefore($(this)); 677$('.critere-recherche').last().find('.oeuvres-select').rechercheOeuvreInitSelect(); 678$(this).find('option:selected').prop('disabled',true); 679$(this).prop('selectedIndex',0); 680}); 681$(document).on('change','.oeuvres-select',function(event){ 682event.preventDefault(); 683$(this).nextAll().remove(); 684var url=new URL(document.location.href); 685if($(this).val()!=''){ 686url.searchParams.set($(this).data('zone')+'-'+$(this).data('champ'),$(this).val()); 687}else{ 688let prevSelect=$(this).prev('.oeuvres-select-separation').prev('.oeuvres-select'); 689if(prevSelect.length>0){ 690url.searchParams.set(prevSelect.data('zone')+'-'+prevSelect.data('champ'),prevSelect.val()); 691}else{ 692url.searchParams.delete($(this).data('zone')+'-'+$(this).data('champ')); 693} 694} 695url.searchParams.delete('debut_oeuvres'); 696window.history.pushState("object or string","Title",url.href); 697setOeuvresURLretour(); 698$('#oeuvres-recherche').attr('action',url.href); 699$('#oeuvres-recherche').submit(); 700if($(this).val()!=''){ 701$('<span class="oeuvres-select-separation"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-chevron-compact-right" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M6.776 1.553a.5.5 0 0 1 .671.223l3 6a.5.5 0 0 1 0 .448l-3 6a.5.5 0 1 1-.894-.448L9.44 8 6.553 2.224a.5.5 0 0 1 .223-.671z"/></svg></span><select class="form-select oeuvres-select" data-zone="'+$(this).data('zone')+'" data-champ="'+$(this).data('champ')+'" data-parent="'+$(this).val()+'"></select></div>').insertAfter($(this)); 702} 703$('.oeuvres-select').each(function(index,el){ 704$(this).rechercheOeuvreInitSelect($(this).val()); 705}); 706}); 707$(document).on('click','.critere-supp',function(event){ 708event.preventDefault(); 709var url=new URL(document.location.href); 710url.searchParams.delete($(this).parent().data('zone')+'-'+$(this).parent().data('champ')); 711url.searchParams.delete('debut_oeuvres'); 712window.history.pushState("object or string","Title",url.href); 713setOeuvresURLretour(); 714$('.ajouter-critere').find('option[value='+$(this).parent().data('zone')+'-'+$(this).parent().data('champ')+']').prop('disabled',false); 715$(this).parent().remove(); 716$('#oeuvres-recherche').attr('action',url.href); 717$('#oeuvres-recherche').submit(); 718}); 719$(document).on('change','#checkbox_visuel_hd',function(event){ 720event.preventDefault(); 721var url=new URL(document.location.href); 722if($(this).is(':checked')){ 723url.searchParams.set('visuel_hd',$(this).val()); 724}else{ 725url.searchParams.delete('visuel_hd'); 726} 727window.history.pushState("object or string","Title",url.href); 728setOeuvresURLretour(); 729$('#oeuvres-recherche').attr('action',url.href); 730$('#oeuvres-recherche').submit(); 731}); 732$(document).ready(function(){ 733if($('.ajouter-critere').length>0){ 734let searchParams=new URLSearchParams(window.location.search)
735searchParams.forEach(function(index,el){ 736if(el.startsWith('Zone')){ 737$('<div class="critere-recherche clearfix" data-zone="'+el.split('-')[0]+'" data-champ="'+el.split('-')[1]+'"></div>').rechercheOeuvreInitCritereFromParameter(el,searchParams.get(el)).insertBefore('.ajouter-critere'); 738$('.ajouter-critere').find('option[value='+el+']').prop('disabled',true); 739} 740}); 741let nbSearchParams=[...new Set(searchParams.keys())].length; 742if(nbSearchParams==0){ 743Cookies.remove('oeuvres_url_retour'); 744}else{ 745setOeuvresURLretour(); 746} 747$('input').keypress(function(e){ 748if(e.which==13){ 749e.preventDefault(); 750$('.input-group-recherche-libre button').click(); 751} 752}); 753} 754}); 755function setOeuvresURLretour(){ 756var url=new URL(document.location.href); 757Cookies.set('oeuvres_url_retour',url.href,{ 758expires:new Date(new Date().getTime()+15*60*1000) 759}); 760} 761$(document).on('click','.supprimer-du-panier',function(event){ 762event.preventDefault(); 763let panier=localStorage.getItem('panier-oeuvres'); 764if(typeof panier==='string'||panier instanceof String){ 765panier=JSON.parse(panier); 766let oeuvreIndex=panier.indexOf($(this).data('idoeuvre')); 767if(oeuvreIndex!=-1){ 768panier.splice(oeuvreIndex,1); 769localStorage.setItem('panier-oeuvres',JSON.stringify(panier)); 770$('.item-oeuvre-'+$(this).data('idoeuvre')).remove(); 771} 772} 773$('.panier-nb-oeuvres').updatePanierNbOeuvres(); 774if($('.admin-selection-notices').length>0){ 775$('.admin-selection-notices').each(function(i){ 776$(this).setModeleSyntaxePanier(); 777}); 778} 779}); 780$(document).on('click','.vider-panier',function(event){ 781event.preventDefault(); 782localStorage.setItem('panier-oeuvres',''); 783$('.mon-panier .portfolio-liste .item').remove(); 784$.post("spip.php?page=ajax-oeuvres-panier",{},function(data){ 785$(".panier-liste").html(data); 786}); 787$('.panier-nb-oeuvres').updatePanierNbOeuvres(); 788if($('.admin-selection-notices').length>0){ 789$('.admin-selection-notices').each(function(i){ 790$(this).setModeleSyntaxePanier(); 791}); 792} 793}); 794$(document).on('click','.bouger-oeuvre-panier',function(event){ 795event.preventDefault(); 796let panier=localStorage.getItem('panier-oeuvres'); 797if(typeof panier==='string'||panier instanceof String){ 798panier=JSON.parse(panier); 799let oeuvreIndex=panier.indexOf($(this).data('idoeuvre')); 800if(oeuvreIndex!=-1){ 801if($(this).hasClass('bouger-oeuvre-panier-haut')&&oeuvreIndex>0){ 802panier.move(oeuvreIndex,oeuvreIndex-1); 803localStorage.setItem('panier-oeuvres',JSON.stringify(panier)); 804$($('.item-oeuvre-'+$(this).data('idoeuvre'))).insertBefore($('.item-oeuvre-'+$(this).data('idoeuvre')).prev()); 805} 806if($(this).hasClass('bouger-oeuvre-panier-bas')&&oeuvreIndex<panier.length){ 807panier.move(oeuvreIndex,oeuvreIndex+1); 808localStorage.setItem('panier-oeuvres',JSON.stringify(panier)); 809$($('.item-oeuvre-'+$(this).data('idoeuvre'))).insertAfter($('.item-oeuvre-'+$(this).data('idoeuvre')).next()); 810} 811} 812} 813if($('.admin-selection-notices').length>0){ 814$('.admin-selection-notices').each(function(i){ 815$(this).setModeleSyntaxePanier(); 816}); 817} 818}); 819function initBindsAjaxable(event,xhr,settings){ 820var oeuvresMasonry=document.querySelector('.oeuvres-masonry'); 821if(oeuvresMasonry!==null){ 822var masonry=new MiniMasonry({ 823container:'.oeuvres-masonry', 824baseWidth:280, 825surroundingGutter:false, 826gutterX:20, 827gutterY:20 828}); 829} 830$('#agenda-recherche select').change(function(){ 831$("#agenda-recherche").submit(); 832}); 833$('#agenda-recherche input:radio[id^="id_agenda_rubrique_"]').change(function(){ 834$("#agenda-recherche").submit(); 835}); 836$('#blog-recherche input:radio[id^="id_mot_"]').change(function(){ 837$("#blog-recherche").submit(); 838}); 839} 840$(document).ready(function(){ 841initBindsAjaxable(); 842$('a.spip_out').attr("target","_blank"); 843$('table.spip').wrap('<div class="table-responsive"></div>'); 844$('iframe:not(.embed-responsive-item):not(.gigapixel)').addClass('embed-responsive-item').wrap('<div class="embed-container"></div>').wrap('<div class="embed-responsive embed-responsive-16by9"></div>'); 845const tooltipTriggerList=document.querySelectorAll('[data-bs-toggle="tooltip"]') 846const tooltipList=[...tooltipTriggerList].map(tooltipTriggerEl=>new bootstrap.Tooltip(tooltipTriggerEl)) 847$('.accessibilite-print').click(function(event){ 848event.preventDefault(); 849window.print(); 850}); 851$('.accessibilite-textsize').click(function(event){ 852event.preventDefault(); 853var max=30; 854$(".article p, .article h1, .article h2, .article h3, .article h4, .article li, " 855+".presentation-musee p, .product-info .tab-content p, .product-info .tab-content h3, " 856+".agenda-colonne-droite, .agenda-item-focus>p, .agenda-item .agenda-infos, .blog-post-single .content p, .blog-post-single .content h3, .sidebar-widget .content p").each(function(){ 857var curSize=parseInt($(this).css('font-size'),10); 858if(curSize<=max){ 859var newSize=curSize+2; 860$(this).css('font-size',newSize); 861} 862}
862); 863return false; 864}); 865if($('.oeuvres-lien-retour').length>0){ 866if(history.length<=1){ 867$('.oeuvres-lien-retour-label-neutre').css('display','inline'); 868}else{ 869const previousURL=document.referrer; 870if(previousURL!=""){ 871const isPreviousURLExternal=new URL(previousURL).origin!=new URL(location).origin; 872const isPreviousURLSearch=new URL(previousURL).pathname.startsWith('/fr/musee-numerique/oeuvres-en-ligne'); 873const isPreviousURLOeuvre=new URL(previousURL).pathname.startsWith('/oeuvre/'); 874const isPreviousURLHomepage=new URL(previousURL).pathname=='/'?true:false; 875const isPreviousURLMuseenumerique=new URL(previousURL).pathname=='/fr/musee-numerique/'?true:false; 876if(isPreviousURLSearch){ 877$('.oeuvres-lien-retour-label-recherche').css('display','inline'); 878$('.oeuvres-lien-retour').attr('href',"javascript:history.back();"); 879}else if(isPreviousURLOeuvre){ 880$('.oeuvres-lien-retour-label-oeuvre').css('display','inline'); 881$('.oeuvres-lien-retour').attr('href',"javascript:history.back();"); 882}else if(isPreviousURLHomepage||isPreviousURLMuseenumerique){ 883$('.oeuvres-lien-retour-label-neutre').css('display','inline'); 884}else if(!isPreviousURLExternal){ 885$('.oeuvres-lien-retour-label-article').css('display','inline'); 886$('.oeuvres-lien-retour').attr('href',"javascript:history.back();"); 887}else{ 888$('.oeuvres-lien-retour-label-neutre').css('display','inline'); 889} 890}else{ 891$('.oeuvres-lien-retour-label-neutre').css('display','inline'); 892} 893} 894} 895$('.oeuvre-images-nav button').on('mouseenter',function(event){ 896event.preventDefault(); 897$('.oeuvre-image').removeClass('oeuvre-image-affichee'); 898$('.oeuvre-image').css('z-index','1'); 899$($(this).data('navfor')).addClass('oeuvre-image-affichee'); 900$($(this).data('navfor')).css('z-index','10'); 901$('.oeuvre-images-nav button').removeClass('oeuvre-images-nav-courant'); 902$(this).addClass('oeuvre-images-nav-courant'); 903}); 904if($('.oeuvres-en-rapport').length>=1){ 905let hauteur_max=180; 906$('.oeuvres-en-rapport .slick-slide').each(function(index,el){ 907let ratio=$("img",this).attr('width')/275; 908let hauteur_image=$("img",this).attr('height')/ratio; 909if(hauteur_image>hauteur_max)hauteur_max=hauteur_image; 910}); 911hauteur_max+=145; 912$('body:not(.oeuvre-print-complet):not(.oeuvre-print-simple) .oeuvre-fiche-partielle-avecoeuvresenrapport').css('padding-bottom',hauteur_max+'px'); 913} 914$('.oeuvre-fiche-complete h2').each(function(index,el){ 915if($(this).next().is('h2')||$(this).next().is('p.etat-savoir')||$(this).next().length==0) 916$(this).css('display','none'); 917}); 918if($('.oeuvre-print-simple, .oeuvre-print-complet').length>=1){ 919window.print(); 920} 921if(location.hash.startsWith('#forum')){ 922$('a[name="forum_moderation"]').after('<div class="alert alert-success alert-dismissible fade show my-5 py-2 px-3" role="alert">Merci ! Votre contribution apparaîtra <strong>après validation par lâadministrateur du site</strong>.</div>'); 923document.getElementById('forum_moderation').scrollIntoView({behavior:'smooth'}); 924} 925$('#telechargerVisuel').on('show.bs.modal',function(event){ 926let button=$(event.relatedTarget); 927let notice=button.data('notice'); 928let oeuvre=button.data('oeuvre'); 929let image=button.data('image'); 930let vignette=button.data('vignette'); 931let musee=button.data('musee'); 932let numinventaire=button.data('numinventaire'); 933let oeuvretitre=button.data('oeuvretitre'); 934let oeuvreauteur=button.data('oeuvreauteur'); 935let droits=button.data('droits'); 936let imagepoids=button.data('imagepoids'); 937let modal=$(this); 938modal.find('.modal-body input[name="notice"]').val(notice); 939modal.find('.modal-body input[name="oeuvre"]').val(oeuvre); 940modal.find('.modal-body input[name="musee"]').val(musee); 941modal.find('.modal-body input[name="numinventaire"]').val(numinventaire); 942modal.find('.modal-body input[name="oeuvretitre"]').val(oeuvretitre); 943modal.find('.modal-body input[name="oeuvreauteur"]').val(oeuvreauteur); 944modal.find('.modal-body input[name="droits"]').val(droits); 945modal.find('.modal-body input[name="image"]').val(image); 946modal.find('.modal-body input[name="imagepoids"]').val(imagepoids); 947modal.find('.modal-body .telecharger-vignette').attr('src',vignette); 948modal.find('.modal-body .oeuvre-titre').text(oeuvretitre);
949modal.find('.modal-body .oeuvre-auteur').text(oeuvreauteur); 950modal.find('.modal-body .image-poids').text(imagepoids); 951if(Cookies.get("telecharger_vousetes")=="Autre"){ 952oeuvreTelechargerVousEtesAutre(true); 953}else{ 954oeuvreTelechargerVousEtesAutre(false); 955} 956if(Cookies.get("telecharger_vousvoulez")=="Autre"){ 957oeuvreTelechargerVousVoulezAutre(true); 958}else{ 959oeuvreTelechargerVousVoulezAutre(false); 960} 961if(Cookies.get("telecharger_vousvoulez")=="Publier"){ 962oeuvreTelechargerInformationsPublier(true); 963}else{ 964oeuvreTelechargerInformationsPublier(false); 965} 966}); 967function oeuvreTelechargerVousEtesAutre(afficher){ 968if(afficher==true){ 969$('.vous-etes-autre').show('300'); 970$('.vous-etes-autre input[name="vous-etes-autre"]').attr('required','required'); 971}else{ 972$('.vous-etes-autre').hide('300'); 973$('.vous-etes-autre input[name="vous-etes-autre"]').removeAttr('required'); 974} 975} 976function oeuvreTelechargerVousVoulezAutre(afficher){ 977if(afficher==true){ 978$('.vous-voulez-autre').show('300'); 979$('.vous-voulez-autre input[name="vous-voulez-autre"]').attr('required','required'); 980}else{ 981$('.vous-voulez-autre').hide('300'); 982$('.vous-voulez-autre input[name="vous-voulez-autre"]').removeAttr('required'); 983} 984} 985function oeuvreTelechargerInformationsPublier(afficher){ 986if(afficher==true){ 987$('.informations-pour-publier').show('300'); 988$('.informations-pour-publier input[name="nom"]').attr('required','required'); 989$('.informations-pour-publier input[name="prenom"]').attr('required','required'); 990$('.informations-pour-publier input[name="email"]').attr('required','required'); 991$('.informations-pour-publier input[name="datepublication"]').attr('required','required'); 992$('.informations-pour-publier input[name="typepublication"]').attr('required','required'); 993$('.informations-pour-publier input[name="auteur"]').attr('required','required'); 994$('.informations-pour-publier input[name="editeur"]').attr('required','required'); 995}else{ 996$('.informations-pour-publier').hide('300'); 997$('.informations-pour-publier input[name="nom"]').removeAttr('required'); 998$('.informations-pour-publier input[name="prenom"]').removeAttr('required'); 999$('.informations-pour-publier input[name="email"]').removeAttr('required'); 1000$('.informations-pour-publier input[name="datepublication"]').removeAttr('required'); 1001$('.informations-pour-publier input[name="typepublication"]').removeAttr('required'); 1002$('.informations-pour-publier input[name="auteur"]').removeAttr('required'); 1003$('.informations-pour-publier input[name="editeur"]').removeAttr('required'); 1004} 1005} 1006$('.formulaire_oeuvre_telecharger select[name="vous-etes"]').on('change',function(event){ 1007event.preventDefault(); 1008if($(this).val()=="Autre"){ 1009oeuvreTelechargerVousEtesAutre(true); 1010}else{ 1011oeuvreTelechargerVousEtesAutre(false); 1012} 1013}); 1014$('.formulaire_oeuvre_telecharger select[name="vous-voulez"]').on('change',function(event){ 1015event.preventDefault(); 1016if($(this).val()=="Autre"){ 1017oeuvreTelechargerVousVoulezAutre(true); 1018}else{ 1019oeuvreTelechargerVousVoulezAutre(false); 1020} 1021if($(this).val()=="Publier"){ 1022oeuvreTelechargerInformationsPublier(true); 1023}else{ 1024oeuvreTelechargerInformationsPublier(false); 1025} 1026}); 1027$.fn.updateButtonAjouterPanier=function(){ 1028let panier=localStorage.getItem('panier-oeuvres'); 1029if(panier!=null&&panier!=""){ 1030let panierArray=JSON.parse(panier); 1031if(Array.isArray(panierArray)&&panierArray!=null){ 1032this.each(function(){ 1033if(panierArray.length>0&&panierArray.indexOf($(this).data('idoeuvre'))!=-1){ 1034$(this).attr('disabled','disabled'); 1035} 1036}); 1037} 1038} 1039} 1040$.fn.updateButtonVoirPanier=function(){ 1041let panier=localStorage.getItem('panier-oeuvres'); 1042if(panier!=null&&panier!=""){ 1043let panierArray=JSON.parse(localStorage.getItem('panier-oeuvres')); 1044if(!Array.isArray(panierArray)||panierArray==null){ 1045$(this).attr('disabled','disabled'); 1046}else{ 1047let nbOeuvres=panierArray.length; 1048if(nbOeuvres>=1){ 1049$(this).attr('disabled',false); 1050if(nbOeuvres>1) 1051$(this).html('<i class="icon-pictures"></i> voir votre panier ('+nbOeuvres+' oeuvres)'); 1052else 1053$(this).html('<i class="icon-pictures"></i> voir votre panier ('+nbOeuvres+' oeuvre)'); 1054}else{ 1055$(this).attr('disabled','disabled'); 1056} 1057} 1058}else{ 1059$(this).attr('disabled','disabled'); 1060} 1061} 1062$.fn.updatePanierNbOeuvres=function(){ 1063let panier=localStorage.getItem('panier-oeuvres'); 1064if(panier!=null&&panier!=""){ 1065let panierArray=JSON.parse(localStorage.getItem('panier-oeuvres')); 1066if(!Array.isArray(panierArray)||panierArray==null){ 1067$(this).html('Aucune oeuvre dans vore panier'); 1068}else{ 1069let nbOeuvres=panierArray.length; 1070if(nbOeuvres>=1){ 1071if(nbOeuvres>1) 1072$(this).html(nbOeuvres+' oeuvres dans votre panier'); 1073else 1074$(this).html(nbOeuvres+' oeuvre dans votre panier'); 1075}else{ 1076$(this).html('Aucune oeuvre dans vore panier'); 1077} 1078} 1079}else{ 1080$(this).html('Aucune oeuvre dans vore panier'); 1081} 1082} 1083$.fn.setModeleSyntaxePanier=function(){ 1084let panier=localStorage.getItem('panier-oeuvres'); 1085let panierArray=new Array(0); 1086if(panier!=null&&panier!="") 1087panierArray=JSON.parse(panier); 1088let panierPourModele=''; 1089panierArray.forEach((element)=>{ 1090if(panierPourModele!='') 1091panierPourModele+=','; 1092panierPourModele+=element; 1093}) 1094$(this).empty(); 1095$(document.createTextNode("<"+$(this).data("modele")+"|ids="+panierPourModele+">")).appendTo($(this)); 1096} 1097if($('.ajouter-au-panier').length>0){ 1098$('.ajouter-au-panier').updateButtonAjouterPanier(); 1099} 1100if($('.voir-panier').length>0){ 1101$('.voir-panier').updateButtonVoirPanier(); 1102} 1103if($('.panier-nb-oeuvres').length>0){ 1104$('.panier-nb-oeuvres').updatePanierNbOeuvres(); 1105} 1106$(document).on('click','.ajouter-au-panier',function(event){ 1107event.preventDefault(); 1108let panier=localStorage.getItem('panier-oeuvres'); 1109let panierArray=new Array(0); 1110if(panier!=null&&panier!="") 1111panierArray=JSON.parse(panier); 1112if(panierArray.indexOf($(this).data('idoeuvre'))==-1){ 1113panierArray.push($(this).data('idoeuvre')); 1114localStorage.setItem('panier-oeuvres',JSON.stringify(panierArray)); 1115} 1116$(this).updateButtonAjouterPanier(); 1117$('.voir-panier').updateButtonVoirPanier(); 1118}); 1119if($('.panier-liste').length>0){ 1120let panier=localStorage.getItem('panier-oeuvres'); 1121let panierArray=new Array(0); 1122if(panier!=null&&panier!="") 1123panierArray=JSON.parse(panier); 1124$.post("spip.php?page=ajax-oeuvres-panier",{'panier[]':panierArray},function(data){ 1125$(".panier-liste").html(data); 1126}); 1127if($('.admin-selection-notices').length>0){ 1128$('.admin-selection-notices').each(function(i){ 1129$(this).setModeleSyntaxePanier(); 1130}); 1131} 1132} 1133$(".admin-selection-notices, .admin-selection-notice").focus(function(){ 1134var $this=$(this); 1135$this.select(); 1136$this.mouseup(function(){ 1137$this.unbind("mouseup"); 1138return false;
1139}); 1140}); 1141$('.nav-tabs.nav-tabs-musees > li > a.a-afficher').tab('show'); 1142$('.nav-tabs.nav-tabs-musees > li > a').hover(function(){ 1143$(this).tab('show'); 1144}); 1145$('.nav-tabs.nav-tabs-musees > li > a').click(function(event){ 1146event.preventDefault(); 1147var url=$(this).data('link'); 1148window.location.href=url; 1149}); 1150}); 1151$(document).scroll(function(){ 1152if($(this).scrollTop()>128){ 1153$('.header-simple.sticky').addClass('header-blanc'); 1154}else{ 1155$('.header-simple.sticky').removeClass('header-blanc'); 1156} 1157}); 1158$(document).ajaxComplete(function(event,xhr,settings){ 1159if(!settings.url.includes("oeuvres_champs")) 1160initBindsAjaxable(event,xhr,settings); 1161}); 1162})(jQuery); 1163(function(jQuery) 1164{ 1165var oldAjaxbloc=jQuery.fn.ajaxbloc; 1166jQuery.fn.ajaxbloc=function() 1167{ 1168var ret=oldAjaxbloc.apply(this,arguments); 1169var blocfrag=jQuery(this); 1170var ajax_env=blocfrag.attr('data-ajax-env'); 1171if(!ajax_env||ajax_env==undefined)return; 1172jQuery('form.form_am_ajax.ajax',this).not('.noajax,.bind-ajax').each(function(){ 1173var leform=this; 1174var url=jQuery(this).attr('action').split('#'); 1175jQuery(this) 1176.prepend("<input type='hidden' name='var_ajax' value='1'><input type='hidden' name='var_ajax_env' value='"+(ajax_env)+"'>"+(url[1]?"<input type='hidden' name='var_ajax_ancre' value='"+url[1]+"'>":"")) 1177.ajaxForm({ 1178beforeSubmit:function(){ 1179jQuery(blocfrag).animateLoading(); 1180$('html,body').animate({ 1181scrollTop:jQuery(blocfrag).offset().top-150 1182},200); 1183}, 1184onAjaxLoad:false, 1185success:function(c){ 1186var re=/ action="([^"]*)"/; 1187var m; 1188if((m=re.exec(c))!==null){ 1189if(m.index===re.lastIndex){ 1190re.lastIndex++; 1191} 1192jQuery.spip.on_ajax_loaded(blocfrag,c,m[1].replace('amp;',''),true); 1193}else{ 1194jQuery.spip.on_ajax_loaded(blocfrag,c); 1195} 1196jQuery.spip.preloaded_urls={}; 1197}, 1198iframe:jQuery.browser.msie 1199}) 1200.addClass('bind-ajax') 1201; 1202}); 1203return ret; 1204}; 1205})(jQuery); 1206var $=jQuery.noConflict(); 1207tarteaucitron.services.matomotagmanager={"key":"matomotagmanager", 1208"type":"analytic", 1209"name":"Matomo Tag Manager", 1210"uri":"https://fr.matomo.org/privacy/ ", 1211"readmoreLink":"https://fr.matomo.org/faq/general/faq_146/","needConsent":false, 1212"cookies":['_pk_ref','_pk_cvar','_pk_id','_pk_ses','_pk_hsr', 1213'piwik_ignore','_pk_uid','stg_last_interaction','stg_returning_visitor','stg_traffic_source_priority'], 1214"js":function(){ 1215"use strict"; 1216if(tarteaucitron.user.matomoTagManagerId===undefined){return;} 1217if(tarteaucitron.user.domainHost===undefined){ 1218return; 1219} 1220var _mtm=_mtm||[]; 1221tarteaucitron.addScript( 1222'https://'+tarteaucitron.user.domainHost+'/js/container_'+tarteaucitron.user.matomoTagManagerId+'.js', 1223'', 1224function(){ 1225var _mtm=_mtm||[]; 1226_mtm.push({'mtm.startTime':(new Date().getTime()),'event':'mtm.Start'}); 1227var d=document,g=d.createElement('script'),s=d.getElementsByTagName('script')[0]; 1228g.type='text/javascript';g.async=true;g.defer=true;g.src='https://'+tarteaucitron.user.domainHost+'/js/container_'+tarteaucitron.user.matomoTagManagerId+'.js';s.parentNode.insertBefore(g,s); 1229} 1230); 1231var interval=setInterval(function(){ 1232if(typeof Piwik==='undefined')return; 1233clearInterval(interval) 1234Piwik.getTracker(); 1235var theCookies=document.cookie.split(';'); 1236for(var i=1;i<=theCookies.length;i++){ 1237var cookie=theCookies[i-1].split('='); 1238var cookieName=cookie[0].trim(); 1239if(cookieName.indexOf('_pk_')===0){ 1240tarteaucitron.services.matomotagmanager.cookies.push(cookieName); 1241} 1242if(cookieName.indexOf('stg_')===0){ 1243tarteaucitron.services.matomotagmanager.cookies.push(cookieName); 1244} 1245} 1246},100) 1247}, 1248"fallback":function(){ 1249"use strict"; 1250} 1251};
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.