diff --git a/script.js b/script.js index bc279a2..365c59d 100644 --- a/script.js +++ b/script.js @@ -37,3 +37,16 @@ function findUnfollowed(followers, followings) { const followerSet = new Set(followers.split(',').map(item => item.trim())); return followings.split(',').map(item => item.trim()).filter(item => !followerSet.has(item)); } + +function copyCode() { + const codeSnippet = document.getElementById('code-snippet'); + const range = document.createRange(); + range.selectNode(codeSnippet); + window.getSelection().removeAllRanges(); // Clear any current selection + window.getSelection().addRange(range); // Select the code + document.execCommand('copy'); // Copy the selected text to clipboard + window.getSelection().removeAllRanges(); // Deselect the text + + // Optionally, show a message or change button text to indicate success + alert("Code copied to clipboard!"); +} \ No newline at end of file