replace style.js with a CSS trick

This commit is contained in:
mivinci 2023-03-14 18:00:05 +08:00
parent 0d89810486
commit f935dbc74f
4 changed files with 3 additions and 13 deletions

View file

@ -69,10 +69,10 @@ $heading: (h1, 2.25, 800), (h2, 2, 700), (h3, 1.75, 600), (h4, 1.5, 600),
.md ul input[type="checkbox"] {
margin: 0;
margin-right: 7px;
margin-right: 5px;
}
.md .ul-checkbox {
.md ul:has(input) {
list-style: none;
padding-inline-start: 8px;
}

View file

@ -1,8 +1,6 @@
import { setup_theme_switch } from "./theme"
import { fix_checkbox_list_style } from "./style"
import { setup_selectable } from './selectable'
setup_theme_switch('theme-switch')
setup_selectable()
fix_checkbox_list_style('.md ul')

View file

@ -1,8 +0,0 @@
/** @param {string} selectors */
export function fix_checkbox_list_style(selectors) {
document.querySelectorAll(selectors).forEach(v => {
if (/<li><input .+>.+<\/li>/.test(v.innerHTML)) {
v.classList.add('ul-checkbox');
}
});
}