searxng/searx/static/themes/simple/js/preferences.min.js
2025-08-18 16:38:32 +02:00

2 lines
No EOL
1.1 KiB
JavaScript

import{d as e,e as t,g as n}from"./searxng.core.min.js";let r;const i=async()=>{if(!r){try{let t=await e(`GET`,`engine_descriptions.json`);r=await t.json()}catch(e){console.error(`Error fetching engineDescriptions:`,e)}if(r)for(let[e,[t,i]]of Object.entries(r)){let r=document.querySelectorAll(`[data-engine-name="${e}"] .engine-description`),a=` (<i>${n.translations?.Source}:&nbsp;${i}</i>)`;for(let e of r)e.innerHTML=t+a}}},a=(e,t)=>{for(let n of t)n.offsetParent&&(n.checked=!e)},o=document.querySelectorAll(`[data-engine-name]`);for(let e of o)t(`mouseenter`,e,i);const s=document.querySelectorAll(`tbody input[type=checkbox][class~=checkbox-onoff]`),c=document.querySelectorAll(`.enable-all-engines`);for(let e of c)t(`click`,e,()=>a(!0,s));const l=document.querySelectorAll(`.disable-all-engines`);for(let e of l)t(`click`,e,()=>a(!1,s));const u=document.querySelector(`#copy-hash`);u&&t(`click`,u,async e=>{e.preventDefault();let{copiedText:t,hash:n}=u.dataset;if(t&&n)try{await navigator.clipboard.writeText(n),u.innerText=t}catch(e){console.error(`Failed to copy hash:`,e)}});
//# sourceMappingURL=preferences.min.js.map