From 9e1057b9ffeab3431e42f87b8b41a85bacbf082f Mon Sep 17 00:00:00 2001 From: Turistu <128076160+turistu@users.noreply.github.com> Date: Mon, 30 Oct 2023 00:41:26 +0200 Subject: [PATCH] try to improve message when primary selection doesn't work don't care about touchscreen in the compat code for browsers without clipboard API --- form-tweaks.js | 1 - form.html | 6 +++--- form.js | 18 ++++++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/form-tweaks.js b/form-tweaks.js index bbedd49..4667af9 100644 --- a/form-tweaks.js +++ b/form-tweaks.js @@ -23,6 +23,5 @@ if(!navigator.clipboard) getSelection().selectAllChildren(CODE); CODE.title = document.execCommand('copy') ? 'copied!' : emsg; - if(!select_is_ok()) getSelection().removeAllRanges(); }catch(e){ CODE.title = emsg } }; diff --git a/form.html b/form.html index 0265bb6..d354932 100644 --- a/form.html +++ b/form.html @@ -8,7 +8,7 @@ #KEY:invalid { background-color: red; color: pink } #CODE { font: 250% monospace; letter-spacing: .15em; user-select: all } #CODE::after { all: initial; content: ' ' attr(title); color: red; pointer-events: none } -#CODE[title^=copied]::after { color: green } +#CODE[title^="copied!"]::after { color: green } input, button { font: inherit } #USER, #KEY { box-sizing: border-box; width: 100%; max-width: 25em } @@ -24,11 +24,11 @@