5c5e2d59cb
BREAKING CHANGE: We have replaced `gulp` with `webpack` and `npm scripts` to build this theme. If you build it on your own or use build commands during the deployment, you may have to adjust your setup. BREAKING CHANGE: The `GeekblogIcons` font is using the icon name as Unicode now. As a consequence, you have to replace all references to Icons from this font if you have customized the theme. BREAKING CHANGE: We have refactored the search integration to split Hugo templates from JavaScript code. To get it working again, you need to adjust the `outputFormats` and `outputs` in your Hugo configuration file, as [documented](https://geekdocs.de/usage/configuration/#site-configuration).
32 lines
975 B
JavaScript
32 lines
975 B
JavaScript
import { applyTheme } from "./darkmode"
|
|
import { createCopyButton } from "./copycode.js"
|
|
|
|
import Clipboard from "clipboard"
|
|
;(() => {
|
|
applyTheme()
|
|
})()
|
|
|
|
document.addEventListener("DOMContentLoaded", function (event) {
|
|
let clipboard = new Clipboard(".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()
|
|
})
|
|
|
|
document.querySelectorAll(".highlight").forEach((highlightDiv) => createCopyButton(highlightDiv))
|
|
})
|