/* Store links only. Scientific sources and local browser records are preserved. */ const selectors='.product-card,.featured-card,.shop-item,tr,.peptide-card'; function patch(){ const store=window.PXStore;if(!store)return; for(const a of document.querySelectorAll('a[href]')){ if(a.hasAttribute('data-px-store-direct'))continue; let u;try{u=new URL(a.getAttribute('href'),location.href);}catch{continue;} if(u.hostname!=='peptidx.ru')continue; if(u.pathname.startsWith('/product/')){a.rel='noopener noreferrer';continue;} const box=a.closest(selectors),name=box?.querySelector('.product-name,.fc-name,.shop-name,.peptide-card-title h4,td:first-child')?.textContent||''; const product=store.findFamily(name);if(product)a.href=store.safeURL(product.url); a.rel='noopener noreferrer'; } for(const control of document.querySelectorAll('.peptide-card[onclick],.sidebar-item[onclick]')){ const handler=control.getAttribute('onclick')||''; if(control.matches('.sidebar-item')&&/магазин\s+peptidx/i.test(control.textContent)){ control.onclick=()=>location.assign(store.catalogURL);continue; } if(!/peptidx\.ru/.test(handler))continue; const name=control.querySelector('.peptide-card-title h4')?.textContent?.replace(/→.*$/,'').trim(); const product=store.findFamily(name),url=store.safeURL(product?.url||store.catalogURL); control.onclick=event=>{if(event.target.closest?.('a'))return;event.preventDefault();window.open(url,'_blank','noopener,noreferrer');}; } store.renderCatalog(); } function start(){patch();let queued=false;const observer=new MutationObserver(()=>{if(queued)return;queued=true;queueMicrotask(()=>{queued=false;observer.disconnect();patch();observe();});});function observe(){observer.observe(document.body,{subtree:true,childList:true});}observe();} if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start,{once:true});else start();