This tool shows you how to remove coffee stains from clothes using many tools you need in your life, and the article below explains more.
Stain Remover Tool – PWA + Dark Mode + AI Smart
Tip: You can connect an external AI (e.g. OpenAI) by setting the endpoint in the code.
`;
const blob = new Blob([html],{type:'text/html'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a'); a.href=url; a.download=`${title}.html`; a.click();
URL.revokeObjectURL(url);
}function shareResult(){
if(navigator.share){
navigator.share({title: resultTitle.textContent, url: location.href});
} else {
navigator.clipboard.writeText(location.href).then(()=>alert('Link copied to clipboard!'));
}
}/* ----------------- Dark Mode & PWA ----------------- */
const darkToggle = document.getElementById('darkToggle');
function applyDark(dark){
if(dark){ document.body.classList.add('dark'); document.getElementById('metaThemeColor').content='#07102a'; }
else { document.body.classList.remove('dark'); document.getElementById('metaThemeColor').content='#667eea'; }
localStorage.setItem('stain_dark', dark?'1':'0');
darkToggle.checked = dark;
}
darkToggle.addEventListener('change', ()=>applyDark(darkToggle.checked));
applyDark(true); // default darklet deferredPrompt;
window.addEventListener('beforeinstallprompt', e=>{ e.preventDefault(); deferredPrompt=e; document.getElementById('installBtn').style.display='inline-block'; });
document.getElementById('installBtn').onclick = async()=>{
if(deferredPrompt){ deferredPrompt.prompt(); }
};/* Dynamic manifest & service worker (same as original) */
(function createManifest(){
const icon = `data:image/svg+xml,
`;
const manifest = {name:"Stain Remover Tool",short_name:"Stains",start_url:"/",display:"standalone",background_color:"#667eea",theme_color:"#667eea",icons:[{src:icon,sizes:"512x512",type:"image/svg+xml"}]};
const blob = new Blob([JSON.stringify(manifest)], {type:'application/json'});
const link = document.createElement('link'); link.rel='manifest'; link.href=URL.createObjectURL(blob);
document.head.appendChild(link);
})();if('serviceWorker' in navigator){
navigator.serviceWorker.register(URL.createObjectURL(new Blob([`
const CACHE='stain-v1';
self.addEventListener('install',e=>e.waitUntil(caches.open(CACHE).then(c=>c.addAll(['/']))));
self.addEventListener('fetch',e=>e.respondWith(caches.match(e.request).then(r=>r||fetch(e.request))));
`],{type:'application/javascript'})));
}/* Utilities */
function escapeHtml(s){ return s?s.replace(/[&<>"']/g,m=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[m])):''; }window.addEventListener('load', ()=>showStainSolution('coffee'));