mirror of
https://github.com/thangisme/notes.git
synced 2025-01-02 18:16:23 -05:00
Fixed script tags
This commit is contained in:
parent
b3f52fedad
commit
f4ee29d0c3
@ -47,16 +47,16 @@ color_scheme: "dark"
|
|||||||
<button class="btn js-toggle-dark-mode">Preview dark color scheme</button>
|
<button class="btn js-toggle-dark-mode">Preview dark color scheme</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const toggleDarkMode = document.querySelector('.js-toggle-dark-mode')
|
const toggleDarkMode = document.querySelector('.js-toggle-dark-mode');
|
||||||
const cssFile = document.querySelector('[rel="stylesheet"]')
|
const cssFile = document.querySelector('[rel="stylesheet"]');
|
||||||
const originalCssRef = cssFile.getAttribute('href')
|
const originalCssRef = cssFile.getAttribute('href');
|
||||||
const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css')
|
const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css');
|
||||||
|
|
||||||
addEvent(toggleDarkMode, 'click', function(){
|
addEvent(toggleDarkMode, 'click', function(){
|
||||||
if (cssFile.getAttribute('href') === originalCssRef) {
|
if (cssFile.getAttribute('href') === originalCssRef) {
|
||||||
cssFile.setAttribute('href', darkModeCssRef)
|
cssFile.setAttribute('href', darkModeCssRef);
|
||||||
} else {
|
} else {
|
||||||
cssFile.setAttribute('href', originalCssRef)
|
cssFile.setAttribute('href', originalCssRef);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
@ -35,16 +35,16 @@ color_scheme: "dark"
|
|||||||
<button class="btn js-toggle-dark-mode">Preview dark color scheme</button>
|
<button class="btn js-toggle-dark-mode">Preview dark color scheme</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const toggleDarkMode = document.querySelector('.js-toggle-dark-mode')
|
const toggleDarkMode = document.querySelector('.js-toggle-dark-mode');
|
||||||
const cssFile = document.querySelector('[rel="stylesheet"]')
|
const cssFile = document.querySelector('[rel="stylesheet"]');
|
||||||
const originalCssRef = cssFile.getAttribute('href')
|
const originalCssRef = cssFile.getAttribute('href');
|
||||||
const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css')
|
const darkModeCssRef = originalCssRef.replace('just-the-docs.css', 'dark-mode-preview.css');
|
||||||
|
|
||||||
addEvent(toggleDarkMode, 'click', function(){
|
addEvent(toggleDarkMode, 'click', function(){
|
||||||
if (cssFile.getAttribute('href') === originalCssRef) {
|
if (cssFile.getAttribute('href') === originalCssRef) {
|
||||||
cssFile.setAttribute('href', darkModeCssRef)
|
cssFile.setAttribute('href', darkModeCssRef);
|
||||||
} else {
|
} else {
|
||||||
cssFile.setAttribute('href', originalCssRef)
|
cssFile.setAttribute('href', originalCssRef);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user