Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ <h2>🏆 Your Doom Badges</h2>
<h2 id="receipt-heading" class="sr-only">Session Receipt</h2>
<pre id="receipt-body" class="receipt-body"></pre>
<div class="receipt-actions">
<button id="receiptShareBtn" class="btn-primary">📤 Share Receipt</button>
<button id="receiptCopyBtn" class="btn-secondary">📋 Copy Text</button>
<button id="receiptShareBtn" class="btn-primary">📤 Share</button>
<button id="receiptCopyBtn" class="btn-secondary">📋 Copy Receipt</button>
<button id="receiptCloseBtn" class="btn-ghost">✕ Close</button>
</div>
</div>
Expand Down
21 changes: 10 additions & 11 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,14 @@
}

function openSharePopup(text) {
if (navigator.share) {
navigator.share({ text, url: SITE_URL }).catch(() => {
// User cancelled or share failed — fall back to Twitter
const twitterUrl = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(text);
window.open(twitterUrl, '_blank', 'noopener,noreferrer,width=560,height=420');
});
return;
}
const url = 'https://twitter.com/intent/tweet?text=' + encodeURIComponent(text);
window.open(url, '_blank', 'noopener,noreferrer,width=560,height=420');
}
Expand Down Expand Up @@ -1077,10 +1085,10 @@
const text = bodyEl ? bodyEl.textContent : generateReceiptText();
navigator.clipboard.writeText(text).then(() => {
copyBtn.textContent = '✅ Copied!';
setTimeout(() => { copyBtn.textContent = '📋 Copy Text'; }, 2000);
setTimeout(() => { copyBtn.textContent = '📋 Copy Receipt'; }, 2000);
}).catch(() => {
copyBtn.textContent = '❌ Failed';
setTimeout(() => { copyBtn.textContent = '📋 Copy Text'; }, 2000);
setTimeout(() => { copyBtn.textContent = '📋 Copy Receipt'; }, 2000);
});
});
}
Expand All @@ -1093,15 +1101,6 @@
});
}

// Offer receipt on beforeunload if session was meaningful
window.addEventListener('beforeunload', (e) => {
const elapsed = Math.floor((Date.now() - pageLoadTime) / 1000);
if (elapsed >= 15 && !receiptShown) {
showReceiptModal();
e.preventDefault();
e.returnValue = '';
}
});
}

// ---- Personal Footprint Calculator --------------------------
Expand Down
3 changes: 3 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@
/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Enforce [hidden] even when a class sets an explicit display value */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
Expand Down
Loading