Fix copy link function (#133)
This commit is contained in:
parent
2cf5a58adf
commit
8484a34195
1 changed files with 3 additions and 5 deletions
|
@ -8,12 +8,10 @@
|
||||||
|
|
||||||
function copyLink(url) {
|
function copyLink(url) {
|
||||||
if (!url || 0 === url.length) {
|
if (!url || 0 === url.length) {
|
||||||
return;
|
url = window.location.href;
|
||||||
}
|
}
|
||||||
|
|
||||||
url = window.location.href;
|
|
||||||
var $temp = $("<input>");
|
var $temp = $("<input>");
|
||||||
|
|
||||||
$("body").append($temp);
|
$("body").append($temp);
|
||||||
$temp.val(url).select();
|
$temp.val(url).select();
|
||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
|
@ -21,4 +19,4 @@ function copyLink(url) {
|
||||||
|
|
||||||
alert("Link copied successfully!");
|
alert("Link copied successfully!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue