state.plugins.add({ format: 1, version: "1.0.3", namespace: "Unbloated", id: "TimeAgo", entrypoint: "\nasync () => {\n console.log(\"[TimeAgo] by Unbloated v1.1 - Precise relative timestamps\");\n\n // Precise time ago function\n const timeAgo = (dateString) => {\n const now = Date.now();\n let date;\n \n // Parse \"Today at 12:12 AM\" / \"Yesterday at 3:45 PM\"\n if (dateString.includes(\"Today\") || dateString.includes(\"Yesterday\")) {\n const timeMatch = dateString.match(/(\\d{1,2}):(\\d{2} (?:AM|PM)?)/i);\n if (timeMatch) {\n const [, hours, minutes] = timeMatch;\n const today = new Date();\n let h = parseInt(hours);\n \n // Convert 12h to 24h format\n if (minutes.includes('PM') && h !== 12) h += 12;\n if (minutes.includes('AM') && h === 12) h = 0;\n \n today.setHours(h, parseInt(minutes.replace(/[AP]M/i, '')), 0, 0);\n if (dateString.includes(\"Yesterday\")) today.setDate(today.getDate() - 1);\n date = today;\n }\n }\n \n if (!date || isNaN(date.getTime())) return dateString;\n \n const diff = Math.floor((now - date.getTime()) / 1000);\n\n // Precise seconds (5s → 99s)\n if (diff < 60) return `${diff}s ago`;\n \n // Minutes (1m → 59m)\n const minutes = Math.floor(diff / 60);\n if (minutes < 60) return `${minutes}m ago`;\n \n // Hours (1h → 23h)\n const hours = Math.floor(minutes / 60);\n if (hours < 24) return `${hours}h ago`;\n \n // Days (1d → 29d)\n const days = Math.floor(hours / 24);\n if (days < 30) return `${days}d ago`;\n \n // Months (1mo → 11mo)\n const months = Math.floor(days / 30);\n if (months < 12) return `${months}mo ago`;\n \n // Years\n const years = Math.floor(days / 365);\n return `${years}y ago`;\n };\n\n // Update message timestamps\n const updateMessageTimes = () => {\n document.querySelectorAll(\".MessageBase__DetailBase-sc-1s9ehlg-3 time\").forEach(timeEl => {\n if (timeEl.dataset.timeAgoUpdated === \"true\") {\n // Live update existing ones\n const originalText = timeEl.getAttribute(\"data-original-text\") || timeEl.textContent;\n const relative = timeAgo(originalText);\n timeEl.textContent = relative;\n return;\n }\n\n const originalText = timeEl.textContent.trim();\n const relative = timeAgo(originalText);\n \n if (relative !== originalText) {\n timeEl.setAttribute(\"data-original-text\", originalText);\n timeEl.textContent = relative;\n timeEl.dataset.timeAgoUpdated = \"true\";\n timeEl.title = originalText;\n }\n });\n };\n\n const refreshTimes = () => {\n updateMessageTimes();\n };\n\n // Observer for new messages\n const observer = new MutationObserver(() => {\n clearTimeout(window.timeAgoTimeout);\n window.timeAgoTimeout = setTimeout(refreshTimes, 100);\n });\n\n observer.observe(document.body, {\n childList: true,\n subtree: true\n });\n\n // Initial + **faster live updates** (every 10s)\n refreshTimes();\n setInterval(refreshTimes, 100);\n\n console.log(\"[TimeAgo] Ready!\");\n}\n" });