Skip to content

Commit

Permalink
Try to decode string on dblclick
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed May 19, 2024
1 parent 2a88e57 commit 6652241
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,21 @@ function func(rand, opts, op, msg) {
return unescape(str)
}
}
document.addEventListener("dblclick", function(e) {
var txt, target = e.target.nodeType === 3 ? e.target.parentNode : e.target
if (target.matches("." + STR)) {
try {
txt = JSON.parse(target.textContent)
e.preventDefault()
JSON.parse(txt)
draw(txt, target)
} catch(e) {
try {
target.textContent = fns.atob(txt)
} catch(e) {}
}
}
})

document.addEventListener("keydown", keydown)
document.addEventListener("keyup", function(e) {
Expand Down

0 comments on commit 6652241

Please sign in to comment.