www.oisenumerique.fr Open in urlscan Pro
62.106.155.127  Public Scan

Submitted URL: http://www.oisenumerique.fr/public/js/main.js
Effective URL: https://www.oisenumerique.fr/public/js/main.js
Submission: On June 24 via api from US — Scanned from FR

Form analysis 0 forms found in the DOM

Text Content

function loadExternalScript(url, siteId, callback) {
  const script = document.createElement('script');
  script.src = url;
  script.crossOrigin = 'anonymous';
  script.onload = callback;
  document.head.appendChild(script);
}


   
function handleSelectChange(lang) {
    var cheminUrl = window.location.pathname;
    window.location.replace(cheminUrl + '?lang=' + lang);
}



window.addEventListener('load', function(){

  /* Piano Analytics */
  const pianoSiteByDsp = new Map([
    ["https://www.tarnfibre.fr/", 0],
    ["https://test-tarn.xpfibre.net/", 642710],
    ["http://localhost:8085/", 642710]
]);

let siteId = 0;
for (const [key, value] of pianoSiteByDsp.entries()) {
  if (this.document.baseURI == key) {
    siteId = value;
    break;
  }
}

      // Charger le script externe de Piano Analytics
loadExternalScript('https://tag.aticdn.net/js-sdk/piano-analytics-6.14.0.js', siteId, () => {

  if (typeof pa !== 'undefined') {
          
    pa.setConfigurations({
      site: siteId,
      collectDomain: "https://pzwnfdf.pa-cd.com",
    });

      // Suivi du trafic
      const pageName = document.title;
      console.log("page "+pageName)
      pa.sendEvent('page.display', {
        'page': pageName
      });
  } else {
      console.error('Piano Analytics object "pa" is not defined');
  }
});

  /*End Piano Analytics */


    let documentCookieAccepted = document.cookie.replace(/(?:(?:^|.*;\s*)cookieAccepted\s*\=\s*([^;]*).*$)|^.*$/, "$1") || "";
    let cookieBtnCliked = JSON.parse(localStorage.getItem('cookieBtnCliked'));
    let closePopupBtnCliked = JSON.parse(localStorage.getItem('closePopupBtnCliked'));

    var carrouselHome = document.querySelector('#carrousel_home');
    var carouselInstance = new bootstrap.Carousel(carrouselHome);
    
    carouselInstance.cycle();


    if(documentCookieAccepted !== "true" && !cookieBtnCliked){
      var dialog = document.querySelector('#cookieDialog');
      if(dialog != null)
        dialog.showModal();
    }


    var popupDialog = document.querySelector('#popupDialog');
    var fixedPopupDialog = document.querySelector('#fixedPopupDialog');
    if(popupDialog!=null && !closePopupBtnCliked){
      
      carouselInstance.pause();

      popupDialog.showModal();
    }

    if(fixedPopupDialog!=null && closePopupBtnCliked) {
     
      carouselInstance.pause();
      fixedPopupDialog.showModal(); 
    }
      

   });
   
   function acceptCookies() {
    let cookieBtnCliked = true;
    localStorage.setItem('cookieBtnCliked', JSON.stringify(cookieBtnCliked));
    document.cookie = "cookieAccepted=true; path=/";
    var dialog = document.querySelector('#cookieDialog');
    dialog.close();
   }
   
   function refuseCookies() {
    let cookieBtnCliked = true;
    localStorage.setItem('cookieBtnCliked', JSON.stringify(cookieBtnCliked));
    document.cookie = "cookieAccepted=false; path=/";
    var dialog = document.querySelector('#cookieDialog');
    dialog.close();
   }
   
 
   function closePopupDialog() {
    let closePopupBtnCliked = true;
    localStorage.setItem('closePopupBtnCliked', JSON.stringify(closePopupBtnCliked));
    var dialog = document.querySelector('#popupDialog');
    dialog.close();

    var carrouselHome = document.querySelector('#carrousel_home');
    var carouselInstance = new bootstrap.Carousel(carrouselHome);
    
    carouselInstance.cycle();
    
    
   }

   function closeFixedPopupDialog() {
    var dialog = document.querySelector('#fixedPopupDialog');
    dialog.close();

    var carrouselHome = document.querySelector('#carrousel_home');
    var carouselInstance = new bootstrap.Carousel(carrouselHome);
    
    carouselInstance.cycle();

    
   }
   

 

   function redirectTo(page) {
    var search = window.location.search;
    var cheminUrl = page + search;
    window.location.replace(cheminUrl);
   }