From f935dbc74fb25984fdd35d6e40b6a277528b2a07 Mon Sep 17 00:00:00 2001 From: mivinci Date: Tue, 14 Mar 2023 18:00:05 +0800 Subject: [PATCH] replace style.js with a CSS trick --- assets/css/md.scss | 4 ++-- assets/js/main.js | 2 -- assets/js/style.js | 8 -------- layouts/partials/header.html | 2 +- 4 files changed, 3 insertions(+), 13 deletions(-) delete mode 100644 assets/js/style.js diff --git a/assets/css/md.scss b/assets/css/md.scss index 4861e28..bedd955 100644 --- a/assets/css/md.scss +++ b/assets/css/md.scss @@ -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; } diff --git a/assets/js/main.js b/assets/js/main.js index c1e94f0..347b862 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -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') \ No newline at end of file diff --git a/assets/js/style.js b/assets/js/style.js deleted file mode 100644 index 4f63afe..0000000 --- a/assets/js/style.js +++ /dev/null @@ -1,8 +0,0 @@ -/** @param {string} selectors */ -export function fix_checkbox_list_style(selectors) { - document.querySelectorAll(selectors).forEach(v => { - if (/
  • .+<\/li>/.test(v.innerHTML)) { - v.classList.add('ul-checkbox'); - } - }); -} \ No newline at end of file diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 70e8df0..9cb8540 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -10,7 +10,7 @@