function smToggleMenu(btn){
btn.classList.toggle('open');
document.querySelector('#sm-header .sm-nav-links').classList.toggle('open');
}
document.querySelectorAll('#sm-header .sm-nav-links a').forEach(function(link){
link.addEventListener('click',function(){
var nl=document.querySelector('#sm-header .sm-nav-links');
var tg=document.querySelector('#sm-header .sm-nav-toggle');
if(nl.classList.contains('open')){nl.classList.remove('open');tg.classList.remove('open');}
});
});
document.addEventListener('DOMContentLoaded', function () {
var origNav = document.querySelector('.sm-nav');
if (origNav) {
var bar = document.createElement('div');
bar.className = 'sm-nav-fixed';
bar.innerHTML = origNav.innerHTML;
bar.style.cssText = 'position:fixed;top:88px;left:0;right:0;z-index:300;display:none;justify-content:center;flex-wrap:wrap;gap:4px;padding:6px 4%;background:#fff;border-bottom:1px solid #ececec;box-shadow:0 2px 10px rgba(0,0,0,.06);';
document.body.appendChild(bar);
var links = bar.querySelectorAll('a[href^="#g"]');
var targets = [];
links.forEach(function (a) {
a.style.cssText = 'padding:6px 14px;font-size:14px;font-weight:600;color:#5a5a58;text-decoration:none;border-bottom:2px solid transparent;border-radius:4px;white-space:nowrap;transition:.15s;';
a.addEventListener('mouseenter', function(){ if(!a.classList.contains('on')) a.style.color='#d62828'; });
a.addEventListener('mouseleave', function(){ if(!a.classList.contains('on')) a.style.color='#5a5a58'; });
var el = document.querySelector(a.getAttribute('href'));
if (el) targets.push({ link: a, el: el });
});
links.forEach(function (a) {
a.addEventListener('click', function (e) {
var el = document.querySelector(a.getAttribute('href'));
if (el) { e.preventDefault(); window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - 150, behavior: 'smooth' }); }
});
});
var firstSection = targets.length ? targets[0].el : null;
function onScroll() {
if (firstSection) {
var show = firstSection.getBoundingClientRect().top < 120; bar.style.display = show ? 'flex' : 'none'; } var pos = window.scrollY + 170, cur = null; targets.forEach(function (t) { if (t.el.offsetTop <= pos) cur = t.link; }); links.forEach(function (a) { a.classList.remove('on'); a.style.color = '#5a5a58'; a.style.borderBottomColor = 'transparent'; }); if (cur) { cur.classList.add('on'); cur.style.color = '#d62828'; cur.style.borderBottomColor = '#d62828'; } } window.addEventListener('scroll', onScroll, { passive: true }); onScroll(); } var wa = document.createElement('a'); wa.href = 'https://wa.me/8613854105019?text=Hello%20Sismar%20Laser%2C%20I%20am%20interested%20in%20your%20laser%20machines.'; wa.target = '_blank'; wa.rel = 'noopener'; wa.setAttribute('aria-label', 'Chat on WhatsApp'); wa.style.cssText = 'position:fixed;left:20px;bottom:20px;z-index:9998;width:54px;height:54px;border-radius:50%;background:#25d366;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 14px rgba(0,0,0,.25);transition:transform .15s;'; wa.onmouseenter = function(){ wa.style.transform='scale(1.08)'; }; wa.onmouseleave = function(){ wa.style.transform='scale(1)'; }; wa.innerHTML = '';
document.body.appendChild(wa);
});
function ytThumb(id){return "https://img.youtube.com/vi/"+id+"/hqdefault.jpg";}
const VIDEOS=[
/* ---- Sandblasting & Frosting (10) ---- */
{sub:"sandblasting", tag:"dépolissage", title:"machine de dépolissage laser Miroir 2000×3000mm", machine:"Dépolissage de miroirs grand format", yt:"kpleNkrVf-8"},
{sub:"sandblasting", tag:"Dépolissage", title:"machine de dépolissage laser 1300×2400mm Grand miroir", machine:"Dépolissage de grands panneaux de miroir", yt:"Ca9CB82qAKk"},
{sub:"sandblasting", tag:"dépolissage", title:"machine de dépolissage laser Miroir 1200×800mm Démo", machine:"Démonstration de dépolissage compact de miroirs", yt:"hDmy96cNmsw"},
{sub:"sandblasting", tag:"Tout-en-un", title:"machine laser miroir tout-en-un — dépolissage, Décapage de peinture, perçage & rainurage", machine:"Traitement multifonction du miroir", yt:"5_Ka2Cp8oaI"},
{sub:"sandblasting", tag:"motif", title:"Dépolissage laser miroir Décor motif gravure", machine:"Modèles décoratifs sur verre miroir", yt:"m_NTatR6Yu8"},
{sub:"sandblasting", tag:"miroir intelligent", title:"Dépolissage laser miroir intelligent " Traitement", machine:"Traitement des zones tactiles de miroirs intelligents", yt:"N06i-cLAk3A"},
{sub:"sandblasting", tag:"Inox", title:"Dépolissage laser Miroir en acier inoxydable", machine:"Miroir en acier inoxydable", yt:"85megMJRUHs"},
{sub:"sandblasting", tag:"Inox", title:"Dépolissage laser Miroir en acier inoxydable Démo de production", machine:"Démo en ligne de production inox", yt:"GJCsMSJw0CA"},
{sub:"sandblasting", tag:"Miroir argenté", title:"machine de dépolissage laser Miroir argenté", machine:"Dépolissage de miroirs argentés", yt:"i9LQ94oslx8"},
{sub:"sandblasting", tag:"Sans cuivre", title:"machine de dépolissage laser 120W Miroir sans cuivre", machine:"Traitement des miroirs sans cuivre 120W", yt:"KjsQrEkqmDw"},
/* ---- Paint Removal (2) ---- */
{sub:"paint", tag:"3-en-1", title:"machine laser miroir 3-en-1 — Décapage de peinture en verre & démonstration de perçage", machine:"Décapage de peinture, peinture & forage", yt:"A4CyIC33HqY"},
{sub:"paint", tag:"Décapage de peinture", title:"Décapage de peinture laser miroir", machine:"revêtement & peinture décapage sur miroir", yt:"ahYPr6YmJYk"},
/* ---- Drilling & Cutting (7) ---- */
{sub:"drilling", tag:"rainurage", title:"rainurage laser du verre miroir", machine:"rainurage du verre miroir", yt:"It_QZ3LLQU4"},
{sub:"drilling", tag:"Perçage", title:"machine de perçage laser verre", machine:"Perçage de précision du verre", yt:"bEjsCUBfbyM"},
{sub:"drilling", tag:"Perçage", title:"machine de perçage laser verre Ligne de production", machine:"Perçage du verre en ligne de production", yt:"AIDRjhn3890"},
{sub:"drilling", tag:"Découpe", title:"Découpe de coeur laser sur verre", machine:"Coupe de forme en verre plat", yt:"T1xCvosB48E"},
{sub:"drilling", tag:"Extra-clair", title:"Perçage laser 120W & 200W pour verre Extra-clair 8mm", machine:"perçage du verre extra-clair 8mm", yt:"FUh1fm_P4Hk"},
{sub:"drilling", tag:"Perçage", title:"machine de perçage laser Plaque en verre", machine:"Perçage de plaques de verre plat", yt:"99cV1AOjEUU"},
{sub:"drilling", tag:"Bouteille", title:"machine de perçage laser Bouteille de verre", machine:"Perçage de bouteilles en verre", yt:"15SJzkbGn48"},
];
VIDEOS.forEach(v=>{ if(!v.thumb) v.thumb=ytThumb(v.yt); });
const grid=document.getElementById('grid'),empty=document.getElementById('empty'),
chips=document.getElementById('chips'),
modal=document.getElementById('modal'),player=document.getElementById('player'),
mTitle=document.getElementById('m-title'),mSub=document.getElementById('m-sub');
let filter='all';
function card(v,i){return `
`;}
function render(){
const list=VIDEOS.map((v,i)=>({v,i})).filter(({v})=>filter==='all'||v.sub===filter);
grid.innerHTML=list.map(({v,i})=>card(v,i)).join('');
empty.style.display=list.length?'none':'block';
}
function counts(){
const c=chips.querySelectorAll('.c');
c[0].textContent=VIDEOS.length;
c[1].textContent=VIDEOS.filter(v=>v.sub==='sandblasting').length;
c[2].textContent=VIDEOS.filter(v=>v.sub==='paint').length;
c[3].textContent=VIDEOS.filter(v=>v.sub==='drilling').length;
}
chips.addEventListener('click',e=>{const b=e.target.closest('.chip');if(!b)return;chips.querySelectorAll('.chip').forEach(t=>t.classList.remove('active'));b.classList.add('active');filter=b.dataset.f;render();});
grid.addEventListener('click',e=>{
const c=e.target.closest('.vid');if(!c)return;
const v=VIDEOS[+c.dataset.i];
mTitle.textContent=v.title;mSub.textContent=v.machine;
const ask=`Hi Sismar Laser, I'm interested in the ${v.title} (${v.tag}). Please send a price and more details.`;
document.getElementById('m-ask').textContent=`Ask us about the ${v.title}.`;
document.getElementById('wa-btn').href=`https://wa.me/8613854105019?text=${encodeURIComponent(ask)}`;
document.getElementById('email-btn').href=`mailto:sales@sismarlaser.com?subject=${encodeURIComponent('Inquiry: '+v.title)}&body=${encodeURIComponent(ask)}`;
document.getElementById('yt-link').href=`https://youtu.be/${v.yt}`;
const origin=encodeURIComponent(location.origin);
player.innerHTML = ``;
modal.classList.add('open');document.body.style.overflow='hidden';
});
function close(){modal.classList.remove('open');player.innerHTML='';document.body.style.overflow='';}
document.getElementById('close').addEventListener('click',close);
modal.addEventListener('click',e=>{if(e.target===modal)close();});
document.addEventListener('keydown',e=>{if(e.key==='Escape')close();});
counts();render();
Paramètres des cookies et de la confidentialité
function smToggleMenu(btn){
btn.classList.toggle('open');
document.querySelector('#sm-header .sm-nav-links').classList.toggle('open');
}
document.querySelectorAll('#sm-header .sm-nav-links a').forEach(function(link){
link.addEventListener('click',function(){
var nl=document.querySelector('#sm-header .sm-nav-links');
var tg=document.querySelector('#sm-header .sm-nav-toggle');
if(nl.classList.contains('open')){nl.classList.remove('open');tg.classList.remove('open');}
});
});
document.addEventListener('DOMContentLoaded', function () {
var nav = document.querySelector('#sm-header .sm-nav');
if (!nav) return;
var navTop = nav.getBoundingClientRect().top + window.pageYOffset;
var navHeight = nav.offsetHeight;
var placeholder = null;
function onScroll() {
var adminBar = document.getElementById('wpadminbar');
var offset = adminBar ? adminBar.offsetHeight : 0;
if (window.pageYOffset > navTop - offset) {
if (!nav.classList.contains('sm-nav-stuck')) {
placeholder = document.createElement('div');
placeholder.style.height = navHeight + 'px';
nav.parentNode.insertBefore(placeholder, nav.nextSibling);
nav.classList.add('sm-nav-stuck');
nav.style.cssText += ';position:fixed!important;top:' + offset + 'px!important;left:0!important;right:0!important;width:100%!important;z-index:99999!important;box-shadow:0 2px 12px rgba(14,37,65,0.12)!important;';
} else {
nav.style.top = offset + 'px';
}
} else {
if (nav.classList.contains('sm-nav-stuck')) {
nav.classList.remove('sm-nav-stuck');
nav.style.position = '';
nav.style.top = '';
nav.style.boxShadow = '';
if (placeholder) { placeholder.remove(); placeholder = null; }
}
}
}
window.addEventListener('scroll', onScroll, { passive: true });
onScroll();
});
