From 8484a3419576c4a86913bb91a7b189a5070c2183 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 17 Sep 2020 19:20:50 +0800 Subject: [PATCH] Fix copy link function (#133) --- assets/js/_commons/copy-link.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/assets/js/_commons/copy-link.js b/assets/js/_commons/copy-link.js index 0f5aab8fd..5a9c1005a 100644 --- a/assets/js/_commons/copy-link.js +++ b/assets/js/_commons/copy-link.js @@ -8,12 +8,10 @@ function copyLink(url) { if (!url || 0 === url.length) { - return; + url = window.location.href; } - - url = window.location.href; + var $temp = $(""); - $("body").append($temp); $temp.val(url).select(); document.execCommand("copy"); @@ -21,4 +19,4 @@ function copyLink(url) { alert("Link copied successfully!"); -} \ No newline at end of file +}