window.addEventListener('load' ,() => {
    pathim();
    imagePath(); 
})

window.addEventListener('touch' ,() => {
    clos4();
})
function clos4(){
    document.querySelectorAll('.fancybox-content ').forEach(fancy  => {
        var zr=fancy.innerHTML;
       var path= zr.substring(zr.indexOf('sci/'),zr.length);
     var path1=path.slice(0,-2).replace('sci/','');
    //   console.log('path' + path.slice(0,-2).replace('sci/',''));
     //  console.log(zr.length+"długośc znaków dla fanc7yh    ");
     
       if(!fancy.innerHTML.includes('span')){
      fancy.innerHTML=fancy.innerHTML+'<span class="pathos">'+path1+'</span>';
       }





});
}
function pathim(){
   
                  
        document.querySelector('body').addEventListener('mouseover', () => {
               document.querySelectorAll('.fancybox-content ').forEach(fancy  => {
                var zr=fancy.innerHTML;
               var path= zr.substring(zr.indexOf('sci/'),zr.length);
             var path1=path.slice(0,-2).replace('sci/','');
              
               if(!fancy.innerHTML.includes('span')){
              fancy.innerHTML=fancy.innerHTML+'<span class="pathos">'+path1+'</span>';
               }
        })
   
    


       });

      
        setInterval(clos4,1000);    
      //  console.log('kliknięto na guwno1');
        document.querySelectorAll('.fancybox-content ').forEach(fancy  => {
            var zr=fancy.innerHTML;
           var path= zr.substring(zr.indexOf('sci/'),zr.length);
         var path1=path.slice(0,-2).replace('sci/','');
        //   console.log('path' + path.slice(0,-2).replace('sci/',''));
       //    console.log(zr.length+"długośc znaków dla fanc7yh    ");
           if(!fancy.innerHTML.includes('span')){
          fancy.innerHTML=fancy.innerHTML+'<span class="pathos">'+path1+'</span>';
           }
  




   });
     
    
}

function imagePath(){
  console.log('Działa funkcja');
    document.querySelector('ul.sigFreeClassic li.sigFreeThumb').addEventListener('click', () =>{
     //   console.log('Guwno');
    })



    document.querySelectorAll('ul.sigFreeClassic li.sigFreeThumb').forEach(lo => {
        lo.addEventListener('click', () => {
       //     console.log('Działa funkcja1');
                var src= document.querySelector('.fancybox-image').getAttribute('src');
                document.querySelector('.fancybox-caption__body').innerHTML=src;
          //      console.log('działa'+src);
               
    
        })
    })
    
}