Skip to content

Commit bf55206

Browse files
committed
🎉auto update by Gmeek action
1 parent 6778a90 commit bf55206

File tree

3 files changed

+37
-23
lines changed

3 files changed

+37
-23
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
### :page_facing_up: [23](https://MaxLHy0424.is-a.dev/tag.html)
33
### :speech_balloon: 3
44
### :hibiscus: 62429
5-
### :alarm_clock: 2026-02-10 00:30:28
5+
### :alarm_clock: 2026-02-10 01:06:46
66
### Powered by :heart: [Gmeek](https://github.com/Meekdai/Gmeek)

docs/web/articletoc.js

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@
88
}
99
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
1010
}
11-
1211
function initTheme() {
1312
const currentTheme = getCurrentTheme();
1413
document.documentElement.setAttribute('data-theme', currentTheme);
1514
}
16-
1715
const TOC_STYLE = `
1816
:root {
1917
--toc-bg: rgba(255,255,255,0.8);
@@ -120,26 +118,20 @@
120118
.toc-icon svg { width: 20px; height: 20px; }
121119
}
122120
`;
123-
124121
initTheme();
125122
injectStyle(TOC_STYLE);
126123
createTocIcon();
127124
observeMarkdown();
128-
129-
// ===== 新增:监听主题切换(应对页面内手动改主题的场景) =====
130125
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
131-
// 仅当手动设置为auto时,才跟随系统变化
132126
if (localStorage.getItem("meek_theme") === 'auto') {
133127
initTheme();
134128
}
135129
});
136-
137130
function injectStyle(cssText) {
138131
const style = document.createElement("style");
139132
style.textContent = cssText;
140133
document.head.appendChild(style);
141134
}
142-
143135
function createTocIcon() {
144136
const icon = document.createElement("div");
145137
icon.className = "toc-icon";
@@ -156,25 +148,20 @@
156148
}
157149
});
158150
}
159-
160151
function observeMarkdown() {
161152
const container = document.querySelector(".markdown-body");
162153
if (!container) return;
163-
164154
const observer = new MutationObserver(() => {
165155
const headings = container.querySelectorAll("h1,h2,h3,h4,h5,h6");
166156
if (headings.length > 0) {
167157
renderTOC(container, headings);
168158
observer.disconnect();
169159
}
170160
});
171-
172161
observer.observe(container, { childList: true, subtree: true });
173162
}
174-
175163
function renderTOC(container, headings) {
176164
if (document.querySelector(".toc")) return;
177-
178165
const toc = document.createElement("div");
179166
toc.className = "toc";
180167
headings.forEach((h) => {
@@ -192,7 +179,6 @@
192179
});
193180
container.appendChild(toc);
194181
}
195-
196182
function toggleTOC() {
197183
const toc = document.querySelector(".toc");
198184
const icon = document.querySelector(".toc-icon");

docs/web/lightbox.js

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
(function () {
2+
function getCurrentTheme() {
3+
const savedTheme = localStorage.getItem("meek_theme");
4+
if (savedTheme === 'light' || savedTheme === 'dark') {
5+
return savedTheme;
6+
}
7+
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
8+
}
9+
function initTheme() {
10+
const currentTheme = getCurrentTheme();
11+
document.documentElement.setAttribute('data-theme', currentTheme);
12+
}
13+
initTheme();
214
class Lightbox {
315
constructor(options = {}) {
416
this.options = Object.assign({
@@ -26,13 +38,26 @@
2638
createStyles() {
2739
const style = document.createElement('style');
2840
style.textContent = `
41+
:root {
42+
--lb-overlay-bg: transparent;
43+
--lb-button-bg: rgba(255, 255, 255, 0.8);
44+
--lb-button-color: #333;
45+
--lb-button-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
46+
--lb-image-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
47+
}
48+
:root[data-theme="dark"] {
49+
--lb-button-bg: rgba(45, 51, 59, 0.8);
50+
--lb-button-color: #adbac7;
51+
--lb-button-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
52+
--lb-image-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
53+
}
2954
.lb-lightbox-overlay {
3055
position: fixed;
3156
top: 0;
3257
left: 0;
3358
width: 100%;
3459
height: 100%;
35-
background-color: transparent;
60+
background-color: var(--lb-overlay-bg);
3661
backdrop-filter: blur(5px);
3762
display: flex;
3863
justify-content: center;
@@ -80,18 +105,18 @@
80105
height: auto;
81106
object-fit: contain;
82107
border-radius: 16px;
83-
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
108+
box-shadow: var(--lb-image-shadow);
84109
transition: transform ${this.options.animationDuration}ms cubic-bezier(0.25, 0.1, 0.25, 1), opacity ${this.options.animationDuration}ms ease;
85110
opacity: 0;
86111
}
87112
.lb-lightbox-nav, .lb-lightbox-close {
88113
position: absolute;
89-
background-color: rgba(255, 255, 255, 0.8);
90-
color: #333;
114+
background-color: var(--lb-button-bg);
115+
color: var(--lb-button-color);
91116
border: none;
92117
border-radius: 50%;
93118
cursor: pointer;
94-
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
119+
box-shadow: var(--lb-button-shadow);
95120
width: 50px;
96121
height: 50px;
97122
font-size: 30px;
@@ -311,10 +336,13 @@
311336
this.overlay.removeEventListener('touchend', this.handleTouchEnd.bind(this));
312337
}
313338
}
339+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
340+
if (localStorage.getItem("meek_theme") === 'auto') {
341+
initTheme();
342+
}
343+
});
314344
window.Lightbox = Lightbox;
315345
document.addEventListener('DOMContentLoaded', () => {
316346
new Lightbox();
317347
});
318-
})();
319-
320-
348+
})();

0 commit comments

Comments
 (0)