mirror of
https://github.com/andwati/pwnforfunandprofit.xyz.git
synced 2026-11-23 17:48:46 +00:00
feat: Add client-side search, reading time estimates, and a reading progress bar, plus a clipboard copy fallback.
This commit is contained in:
+18
-2
@@ -28,8 +28,24 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
const text = code.innerText;
|
||||
|
||||
try {
|
||||
// Wait for the clipboard API
|
||||
await navigator.clipboard.writeText(text);
|
||||
if (navigator.clipboard && window.isSecureContext) {
|
||||
// Modern Async Clipboard API
|
||||
await navigator.clipboard.writeText(text);
|
||||
} else {
|
||||
// Fallback for insecure contexts (like local network IPs via HTTP)
|
||||
const textArea = document.createElement('textarea');
|
||||
textArea.value = text;
|
||||
|
||||
// Move outside the screen to make it invisible
|
||||
textArea.style.position = 'absolute';
|
||||
textArea.style.left = '-999999px';
|
||||
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
|
||||
document.execCommand('copy');
|
||||
textArea.remove();
|
||||
}
|
||||
|
||||
// Add visual feedback
|
||||
button.innerHTML = checkIcon;
|
||||
|
||||
Reference in New Issue
Block a user