1
0
mirror of https://github.com/thangisme/notes.git synced 2024-11-14 17:47:18 -05:00

Rm preview js

This commit is contained in:
Patrick Marsceill 2020-04-24 15:41:13 -04:00
parent 59d4802ce3
commit 955ac23149
No known key found for this signature in database
GPG Key ID: 286B93882D828F40

View File

@ -1,25 +0,0 @@
document.addEventListener("DOMContentLoaded", function () {
const toggleDarkMode = document.querySelector(".js-toggle-dark-mode")
const cssFile = document.querySelector('[rel="stylesheet"]')
const originalCssRef = cssFile.getAttribute("href")
const darkModeCssRef = originalCssRef.replace(
"just-the-docs.css",
"dark-mode-preview.css"
)
const buttonCopy = ["Return to the light side", "Preview dark color scheme"]
const updateButtonText = function (toggleDarkMode) {
toggleDarkMode.textContent === buttonCopy[0]
? (toggleDarkMode.textContent = buttonCopy[1])
: (toggleDarkMode.textContent = buttonCopy[0])
}
jtd.addEvent(toggleDarkMode, "click", function () {
if (cssFile.getAttribute("href") === originalCssRef) {
cssFile.setAttribute("href", darkModeCssRef)
updateButtonText(toggleDarkMode)
} else {
cssFile.setAttribute("href", originalCssRef)
updateButtonText(toggleDarkMode)
}
})
})