hugo-geekdoc/src/js/clipboard-loader.js

22 lines
733 B
JavaScript
Raw Normal View History

2021-05-21 09:33:17 +00:00
document.addEventListener("DOMContentLoaded", function (event) {
var clipboard = new ClipboardJS(".clip");
clipboard.on("success", function (e) {
const trigger = e.trigger;
if (trigger.hasAttribute("data-copy-feedback")) {
trigger.classList.add("gdoc-post__codecopy--success");
trigger.querySelector(".icon.copy").classList.add("hidden");
trigger.querySelector(".icon.check").classList.remove("hidden");
setTimeout(function () {
trigger.classList.remove("gdoc-post__codecopy--success");
trigger.querySelector(".icon.copy").classList.remove("hidden");
trigger.querySelector(".icon.check").classList.add("hidden");
}, 3000);
}
e.clearSelection();
});
2021-05-21 09:33:17 +00:00
});