Enhanced JS function.

This commit is contained in:
Cotes Chung 2020-02-18 03:04:52 +08:00
parent 9935f76530
commit 4c631f6839
2 changed files with 4 additions and 3 deletions

View File

@ -6,8 +6,9 @@
* MIT License
*/
function copyLink() {
var url = window.location.href;
function copyLink(url) {
if (!url || 0 === url.length)
url = window.location.href;
var $temp = $("<input>");
$("body").append($temp);

View File

@ -1 +1 @@
function copyLink(){var a=window.location.href;var b=$("<input>");$("body").append(b);b.val(a).select();document.execCommand("copy");b.remove();alert("Link copied successfully!")};
function copyLink(a){if(!a||0===a.length){a=window.location.href}var b=$("<input>");$("body").append(b);b.val(a).select();document.execCommand("copy");b.remove();alert("Link copied successfully!")};