x0/modules/copy.js

10 lines
401 B
JavaScript
Raw Normal View History

2023-12-24 00:32:43 +01:00
// [x-copy-query="<query selector>"]
// [x-inner-text] - will use innerText
document.querySelectorAll("[x-copy-query]")
.forEach(e => {
if (e.hasAttribute("x-inner-text")) {
e.innerText = document.querySelector(e.getAttribute("x-copy-query")).innerHTML
} else {
e.innerHTML = document.querySelector(e.getAttribute("x-copy-query")).innerHTML
}
})