CI / Build & Test (push) Failing after 28s
Split monolithic dashboard.js (2753 lines) into 18 focused modules
under dashboard/{core,data,ui,pages}/ with refresh.js and events.js
as orchestrators. Extracted ~900-line inline <style> into dashboard.css
and moved dashboard.html to dashboard/dashboard.html.
Split background.js (609 lines) into background/{logs,state,proxy,
native-messaging,tab-lifecycle,message-router}.js with a thin entry
point using importScripts().
Deleted dead files: wrong-domain.js (duplicate of inline script).
Updated manifest.json web_accessible_resources for new paths.
Updated docs/ARCHITECTURE.md to reflect the new file structure.
No functionality changed. No build step introduced.
23 lines
660 B
JavaScript
23 lines
660 B
JavaScript
// Depends on: core/utils.js ($)
|
|
|
|
let toastTimer = null;
|
|
|
|
function showToast(msg, type = 'default') {
|
|
const el = $('toast');
|
|
if (!el) return;
|
|
el.textContent = msg;
|
|
el.className = 'toast show' + (type !== 'default' ? ' ' + type : '');
|
|
clearTimeout(toastTimer);
|
|
toastTimer = setTimeout(() => { el.className = 'toast'; }, 2800);
|
|
}
|
|
|
|
function copyToClipboard(text, btnEl) {
|
|
navigator.clipboard.writeText(text).then(() => {
|
|
if (btnEl) {
|
|
btnEl.classList.add('copied');
|
|
setTimeout(() => btnEl.classList.remove('copied'), 1500);
|
|
}
|
|
showToast('Copied to clipboard', 'success');
|
|
}).catch(() => showToast('Copy failed', 'error'));
|
|
}
|