css darklight
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ale 2024-10-06 17:20:32 +02:00
parent 7a5ebb1fd5
commit 21af17c99e
4 changed files with 7 additions and 8 deletions

View File

@ -11,7 +11,8 @@
<meta property="og:title" content="Fediblock Instance Φ"> <meta property="og:title" content="Fediblock Instance Φ">
<meta property="og:type" content="service"> <meta property="og:type" content="service">
<meta property="og:image" content="favicon.ico"> <meta property="og:image" content="favicon.ico">
<link rel='stylesheet' type='text/css' media='screen' id="css" href='dark.module.css'> <link rel='stylesheet' type='text/css' media='screen' id="lightcss" href='light.css'>
<link rel='stylesheet' type='text/css' media='screen' id="darkcss" href='dark.css'>
<link rel='stylesheet' type='text/css' media='screen' href='loaders.css'> <link rel='stylesheet' type='text/css' media='screen' href='loaders.css'>
<script src='random-text.js'></script> <script src='random-text.js'></script>
<script src='../node_modules/html2canvas/dist/html2canvas.min.js'></script> <script src='../node_modules/html2canvas/dist/html2canvas.min.js'></script>

View File

@ -1,8 +1,6 @@
import * as light from './light.module.css';
import * as dark from './dark.module.css';
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
loading() loading()
var hold, external, timeout, ac, last var hold, external, timeout, ac, last, darklight = document.getElementById('darkcss').getAttribute('href')
document.getElementById('instance').addEventListener('keydown', function (event) { document.getElementById('instance').addEventListener('keydown', function (event) {
if (event.key && !event.ctrlKey && !event.altKey && !event.shiftKey) { if (event.key && !event.ctrlKey && !event.altKey && !event.shiftKey) {
if ((event.key.length === 1 && /[a-z0-9.\-*:]/i.test(event.key)) || (event.key === 'Backspace' && event.target.value !== '')) { if ((event.key.length === 1 && /[a-z0-9.\-*:]/i.test(event.key)) || (event.key === 'Backspace' && event.target.value !== '')) {
@ -132,10 +130,10 @@ document.addEventListener('DOMContentLoaded', function () {
}) })
document.getElementById('darklight').addEventListener('click', function (event) { document.getElementById('darklight').addEventListener('click', function (event) {
if (event.target.innerText === '☼') { if (event.target.innerText === '☼') {
document.getElementById('css').setAttribute('href', light.meta.url) document.getElementById('darkcss').setAttribute('href', '')
event.target.innerText = '☽' event.target.innerText = '☽'
} else { } else {
document.getElementById('css').setAttribute('href', dark.meta.url) document.getElementById('darkcss').setAttribute('href', darklight)
event.target.innerText = '☼' event.target.innerText = '☼'
} }
}) })