Fix script

This commit is contained in:
Kognise 2019-04-06 16:50:52 -04:00
parent 2b900b7e66
commit a176146843
No known key found for this signature in database
GPG key ID: 19AA40F6884A36D6
3 changed files with 17 additions and 2 deletions

View file

@ -1,8 +1,11 @@
document.getElementById('switch').addEventListener('click', () => {
const stylesheet = document.getElementById('stylesheet')
const ph = document.getElementById('ph')
if (stylesheet.getAttribute('href') === 'dist/dark.css') {
stylesheet.setAttribute('href', 'dist/light.css')
ph.src = ph.src.replace('theme=dark', 'theme=light')
} else {
stylesheet.setAttribute('href', 'dist/dark.css')
ph.src = ph.src.replace('theme=light', 'theme=dark')
}
})