hugo-book

This commit is contained in:
JamesFlare1212
2023-04-26 22:19:59 +08:00
parent 0d2ffd0447
commit c6ca9d6524
215 changed files with 7267 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
(function () {
function select(element) {
const selection = window.getSelection();
const range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
}
document.querySelectorAll("pre code").forEach(code => {
code.addEventListener("click", function (event) {
if (window.getSelection().toString()) {
return;
}
select(code.parentElement);
if (navigator.clipboard) {
navigator.clipboard.writeText(code.parentElement.textContent);
}
});
});
})();