Skip to content
Open
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
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@
A small snippet to add your own copy method, in case the original one has been tampered with.

```
document.onkeyup = function(e) {
var frames = document.getElementsByTagName("iframe");
let copyFunction = function(e) {
if (e.ctrlKey && e.which == 67) {
var text = window.getSelection().toString()
var text = this.window.getSelection().toString()
navigator.clipboard.writeText(text)
}
}
document.onkeyup = copyFunction
for (let i = 0; i < frames.length; ++i) {
if (frames[i].id == 'mcas-presence-frame-do-not-remove') {
frames[i].parentNode.removeChild(frames[i])
} else {
frames[i].contentWindow.onkeyup = copyFunction
}
}
```

1. Copy the above snippet.
Expand Down
13 changes: 11 additions & 2 deletions copy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
document.onkeyup = function(e) {
var frames = document.getElementsByTagName("iframe");
let copyFunction = function(e) {
if (e.ctrlKey && e.which == 67) {
var text = window.getSelection().toString()
var text = this.window.getSelection().toString()
navigator.clipboard.writeText(text)
}
}
document.onkeyup = copyFunction
for (let i = 0; i < frames.length; ++i) {
if (frames[i].id == 'mcas-presence-frame-do-not-remove') {
frames[i].parentNode.removeChild(frames[i])
} else {
frames[i].contentWindow.onkeyup = copyFunction
}
}