Files
html/assets/weval-icon-replace.js
2026-04-12 22:57:03 +02:00

42 lines
5.7 KiB
JavaScript

/* WEVAL Icon Pro — Replace emojis with gradient SVG icons */
(function(){
const M={
'✍️':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gc)" stroke-width="2"><defs><linearGradient id="gc" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#22d3ee"/><stop offset="1" stop-color="#a78bfa"/></linearGradient></defs><path d="M12 20h9"/><path d="M16.5 3.5a2.12 2.12 0 013 3L7 19l-4 1 1-4L16.5 3.5z"/></svg>',
'🚀':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#go)" stroke-width="2"><defs><linearGradient id="go" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#fb923c"/><stop offset="1" stop-color="#f472b6"/></linearGradient></defs><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 00-2.91-.09z"/><path d="M12 15l-3-3a22 22 0 012-3.95A12.88 12.88 0 0122 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 01-4 2z"/></svg>',
'⚡':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gy)" stroke-width="2"><defs><linearGradient id="gy" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#fbbf24"/><stop offset="1" stop-color="#f59e0b"/></linearGradient></defs><polygon points="13 2 3 14 12 14 11 22 21 10 12 10 13 2"/></svg>',
'🖥️':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gp)" stroke-width="2"><defs><linearGradient id="gp" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#a78bfa"/><stop offset="1" stop-color="#6366f1"/></linearGradient></defs><rect x="2" y="3" width="20" height="14" rx="2"/><line x1="8" y1="21" x2="16" y2="21"/><line x1="12" y1="17" x2="12" y2="21"/></svg>',
'☁️':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gb)" stroke-width="2"><defs><linearGradient id="gb" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#60a5fa"/><stop offset="1" stop-color="#22d3ee"/></linearGradient></defs><path d="M18 10h-1.26A8 8 0 109 20h9a5 5 0 000-10z"/></svg>',
'🔒':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gr)" stroke-width="2"><defs><linearGradient id="gr" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#f87171"/><stop offset="1" stop-color="#fb923c"/></linearGradient></defs><rect x="3" y="11" width="18" height="11" rx="2"/><path d="M7 11V7a5 5 0 0110 0v4"/></svg>',
'📊':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gt)" stroke-width="2"><defs><linearGradient id="gt" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#34d399"/><stop offset="1" stop-color="#22d3ee"/></linearGradient></defs><line x1="18" y1="20" x2="18" y2="10"/><line x1="12" y1="20" x2="12" y2="4"/><line x1="6" y1="20" x2="6" y2="14"/></svg>',
'⚙️':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gg)" stroke-width="2"><defs><linearGradient id="gg" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#94a3b8"/><stop offset="1" stop-color="#64748b"/></linearGradient></defs><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"/></svg>',
'🧬':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gn)" stroke-width="2"><defs><linearGradient id="gn" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#c084fc"/><stop offset="1" stop-color="#f472b6"/></linearGradient></defs><path d="M12 2a7 7 0 017 7c0 3-2 5-4 6v1H9v-1c-2-1-4-3-4-6a7 7 0 017-7z"/><line x1="9" y1="18" x2="15" y2="18"/><line x1="10" y1="22" x2="14" y2="22"/></svg>',
'📈':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gtr)" stroke-width="2"><defs><linearGradient id="gtr" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#22d3ee"/><stop offset="1" stop-color="#34d399"/></linearGradient></defs><polyline points="22 12 18 8 13 13 9 9 2 16"/><polyline points="22 6 22 12 16 12"/></svg>',
'🏆':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gw)" stroke-width="2"><defs><linearGradient id="gw" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#fbbf24"/><stop offset="1" stop-color="#f59e0b"/></linearGradient></defs><path d="M6 9H4a2 2 0 01-2-2V5a2 2 0 012-2h2"/><path d="M18 9h2a2 2 0 002-2V5a2 2 0 00-2-2h-2"/><path d="M6 3h12v7a6 6 0 01-12 0V3z"/><path d="M9 21h6"/><path d="M12 16v5"/></svg>',
'🧠':'<svg viewBox="0 0 24 24" fill="none" stroke="url(#gbr)" stroke-width="2"><defs><linearGradient id="gbr" x1="0" y1="0" x2="1" y2="1"><stop stop-color="#a78bfa"/><stop offset="1" stop-color="#f472b6"/></linearGradient></defs><path d="M12 2a7 7 0 017 7c0 3-2 5-4 6v1H9v-1c-2-1-4-3-4-6a7 7 0 017-7z"/><line x1="9" y1="18" x2="15" y2="18"/></svg>',
};
const S='width:28px;height:28px;display:inline-block;vertical-align:middle;';
function run(){
document.querySelectorAll('span').forEach(el=>{
const t=el.textContent.trim();
if(M[t]){
el.innerHTML=M[t];
el.style.cssText=S+(el.style.fontSize==='1.5rem'?'width:32px;height:32px;':'');
}
});
// Filter buttons: replace emoji prefix only
document.querySelectorAll('.wia-filter').forEach(el=>{
const html=el.innerHTML;
for(const[e,svg] of Object.entries(M)){
if(html.includes(e)){
el.innerHTML=html.replace(e,'<span style="'+S+'width:16px;height:16px;margin-right:2px">'+svg+'</span>');
break;
}
}
});
}
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',()=>setTimeout(run,500));
else setTimeout(run,500);
// Re-run on route changes (SPA)
new MutationObserver(()=>setTimeout(run,300)).observe(document.body,{childList:true,subtree:true});
})();