Improve JS code style.
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
/*
|
||||
* Copy current page url to clipboard.
|
||||
* v2.1
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2020 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
* Copy current page url to clipboard.
|
||||
* v2.1
|
||||
* https://github.com/cotes2020/jekyll-theme-chirpy
|
||||
* © 2020 Cotes Chung
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
function copyLink(url) {
|
||||
if (!url || 0 === url.length)
|
||||
if (!url || 0 === url.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
url = window.location.href;
|
||||
var $temp = $("<input>");
|
||||
|
||||
@@ -17,4 +20,5 @@ function copyLink(url) {
|
||||
$temp.remove();
|
||||
|
||||
alert("Link copied successfully!");
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user