Update default.html

This commit is contained in:
Fatih Kadir Akın 2022-12-16 02:51:47 +03:00 committed by GitHub
parent 8ffd80a7e2
commit f0a6ad6b99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -25,6 +25,24 @@
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js" integrity="sha256-lZaRhKri35AyJSypXXs4o6OPFTbTmUoltBbDCbdzegg=" crossorigin="anonymous"></script>
<script>anchors.add();</script>
<script>console.log('test');</script>
<script>
document.querySelectorAll("h2[id^=act] + p + blockquote").forEach((x) => {
x.setAttribute('contentEditable', true);
const button = document.createElement('button');
button.style.border = '1px solid #ccc';
button.style.borderRadius = '3px';
button.style.fontSize = '1.2rem';
button.style.marginRight = '0.5rem';
button.innerHTML = '✂️';
button.addEventListener('click', () => {
if (navigator.clipboard) {
navigator.clipboard.writeText(x.innerText).then(() => alert('Prompt is copied, now paste this into ChatGPT.'));
} else {
alert('Your browser does not support clipboard copy. Please select the prompt and copy.')
}
});
x.previousElementSibling.previousElementSibling.prepend(button);
});
</script>
</body>
</html>