From f8f4dd889ec445cfa1f26ae84acaaef20909d72f Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Thu, 13 Jan 2022 00:23:08 +0800 Subject: [PATCH] Normalized attribute name in HTML Add prefix `data-` for following attributes: - `topbar-visible` - `mode` - `label-text` - `title-succeed` --- _includes/comments/utterances.html | 4 ++-- _includes/mermaid.html | 4 ++-- _includes/mode-toggle.html | 7 ++++--- _includes/refactor-content.html | 4 ++-- _javascript/commons/scroll-helper.js | 2 +- _javascript/utils/clipboard.js | 16 +++++++++------- _layouts/default.html | 4 ++-- _sass/addon/commons.scss | 18 +++++++++--------- _sass/addon/syntax.scss | 14 +++++++------- assets/js/dist/categories.min.js | 2 +- assets/js/dist/commons.min.js | 2 +- assets/js/dist/home.min.js | 2 +- assets/js/dist/page.min.js | 2 +- assets/js/dist/post.min.js | 2 +- 14 files changed, 43 insertions(+), 40 deletions(-) diff --git a/_includes/comments/utterances.html b/_includes/comments/utterances.html index 5fa5760..afd7cd3 100644 --- a/_includes/comments/utterances.html +++ b/_includes/comments/utterances.html @@ -14,8 +14,8 @@ const darkTheme = "github-dark"; let initTheme = lightTheme; - if ($("html[mode=dark]").length > 0 - || ($("html[mode]").length == 0 + if ($("html[data-mode=dark]").length > 0 + || ($("html[data-mode]").length == 0 && window.matchMedia("(prefers-color-scheme: dark)").matches)) { initTheme = darkTheme; } diff --git a/_includes/mermaid.html b/_includes/mermaid.html index b8b6665..e8a0cd4 100644 --- a/_includes/mermaid.html +++ b/_includes/mermaid.html @@ -33,8 +33,8 @@ let initTheme = "default"; - if ($("html[mode=dark]").length > 0 - || ($("html[mode]").length == 0 + if ($("html[data-mode=dark]").length > 0 + || ($("html[data-mode]").length == 0 && window.matchMedia("(prefers-color-scheme: dark)").matches ) ) { initTheme = "dark"; } diff --git a/_includes/mode-toggle.html b/_includes/mode-toggle.html index 372b040..63b2538 100644 --- a/_includes/mode-toggle.html +++ b/_includes/mode-toggle.html @@ -5,6 +5,7 @@