// read text from clipboard async function pasteResult() { try { const text = await navigator.clipboard.readText(); if (!text) { alert("Clipboard is empty"); return; } document.getElementById("logInput").value = text; analyzeLog(); // analyze directly! } catch (err) { alert("No access to clipboard " + err); } } // Analyze the pasted log and extract issues, registry keys, and plugin info function analyzeLog() { const log = document.getElementById("logInput").value; const output = document.getElementById("output"); const lines = log.split("\n"); const issues = lines.filter((line) => line.startsWith("โŒ")); const regKeys = lines.filter((line) => line.includes("HKEY_") || line.includes("โžค")); const plugins = lines.filter((line) => line.match(/Plugin ready: .*\.ps1/i)); output.innerHTML = `

๐Ÿงช Found ${issues.length} issues

${issues.map((i) => `
${i}
`).join("")}

๐Ÿ—‚ Registry Keys

${regKeys.map((k) => `
${k}
`).join("")}

๐Ÿ“ฆ Loaded Plugins

${plugins.map((p) => `
${p}
`).join("")}
`; } // Save screenshot of the output section function captureResult() { html2canvas(document.getElementById("output")).then((canvas) => { const link = document.createElement("a"); link.download = "CrapFixer-results.png"; link.href = canvas.toDataURL(); link.click(); }); } // Native share (for mobile browsers) function shareResult() { const text = document.getElementById("output").innerText; if (navigator.share) { navigator .share({ title: "CrapFixer Analysis Results", text: text, }) .catch((err) => console.log("Share failed:", err)); } else { alert("Sharing is not supported by your browser."); } } // Share the result as an image on Twitter/X function shareOnTwitter() { const outputEl = document.getElementById("output"); if (!outputEl.innerText.trim()) return alert("No results to share yet."); // Create screenshot from result div html2canvas(outputEl).then((canvas) => { const dataUrl = canvas.toDataURL("image/png"); // Convert image to base64 string (can't upload directly to Twitter) // Instead, show preview and user uploads manually via prompt const win = window.open(); win.document.write(`

๐Ÿ“ท Screenshot ready for X / Twitter

`); win.document.write( `

Right-click the image below and save it to upload on Twitter manually.

` ); win.document.write( `` ); win.document.write( `

โžก๏ธ Click here to post on X

` ); }); }