MCPcopy Create free account
hub / github.com/garrytan/gstack / showStatusPill

Function showStatusPill

extension/content.js:16–45  ·  view source on GitHub ↗
(connected, refs)

Source from the content-addressed store, hash-verified

14// ─── Connection Status Pill ──────────────────────────────────
15
16function showStatusPill(connected, refs) {
17 refCount = refs || 0;
18
19 if (!statusPill) {
20 statusPill = document.createElement('div');
21 statusPill.id = 'gstack-status-pill';
22 statusPill.style.cursor = 'pointer';
23 statusPill.addEventListener('click', () => {
24 // Ask background to open the side panel
25 chrome.runtime.sendMessage({ type: 'openSidePanel' });
26 });
27 document.body.appendChild(statusPill);
28 }
29
30 if (!connected) {
31 statusPill.style.display = 'none';
32 return;
33 }
34
35 const refText = refCount > 0 ? ` · ${refCount} refs` : '';
36 statusPill.innerHTML = `<span class="gstack-pill-dot"></span> gstack${refText}`;
37 statusPill.style.display = 'flex';
38 statusPill.style.opacity = '1';
39
40 // Fade to subtle after 3s
41 clearTimeout(pillFadeTimer);
42 pillFadeTimer = setTimeout(() => {
43 statusPill.style.opacity = '0.3';
44 }, 3000);
45}
46
47function hideStatusPill() {
48 if (statusPill) {

Callers 1

content.jsFile · 0.85

Calls 1

addEventListenerMethod · 0.80

Tested by

no test coverage detected