web/assets/js/_src/_commons/copy-link.js
Cotes Chung 840eab9566 Feature: Added post sharing options.
Also added a license statement at the bottom of the posts.
2020-02-21 04:48:06 +08:00

19 lines
No EOL
368 B
JavaScript

/*
* Copy current page url to clipboard.
* v2.1
* https://github.com/cotes2020/jekyll-theme-chirpy
* © 2020 Cotes Chung
* MIT License
*/
function copyLink() {
var url = window.location.href;
var $temp = $("<input>");
$("body").append($temp);
$temp.val(url).select();
document.execCommand("copy");
$temp.remove();
alert("Link copied successfully!");
}