fixed event order issues with swapping
Signed-off-by: ari melody <ari@arimelody.me>
This commit is contained in:
parent
0b401c058a
commit
0d1e694b59
7 changed files with 22 additions and 8 deletions
|
@ -51,7 +51,14 @@ function bind_go_back_btn() {
|
|||
|
||||
function bind_share_btn() {
|
||||
const share_btn = document.getElementById("share");
|
||||
share_btn.onclick = (e) => {
|
||||
if (navigator.clipboard === undefined) {
|
||||
share_btn.onclick = event => {
|
||||
console.error("clipboard is not supported by this browser!");
|
||||
};
|
||||
return;
|
||||
}
|
||||
share_btn.onclick = event => {
|
||||
event.preventDefault();
|
||||
navigator.clipboard.writeText(window.location.href);
|
||||
share_btn.classList.remove('active');
|
||||
void share_btn.offsetWidth;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue