mirror of
https://github.com/Ku6epXBOCTuK/easy-png-tools.git
synced 2026-09-14 13:36:36 +00:00
docs: update refs html extract script
This commit is contained in:
@@ -2232,5 +2232,19 @@ h1 {
|
|||||||
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
||||||
</template>
|
</template>
|
||||||
<!--/$-->
|
<!--/$-->
|
||||||
</body>
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var btn = document.querySelector('button[aria-label="Toggle theme"]');
|
||||||
|
var shell = document.querySelector('.app-shell');
|
||||||
|
if (!btn || window.__themeToggleInjected) return;
|
||||||
|
window.__themeToggleInjected = true;
|
||||||
|
btn.addEventListener('click', function () {
|
||||||
|
document.documentElement.classList.toggle('dark-mode');
|
||||||
|
if (shell) shell.classList.toggle('dark-mode');
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+15
-1
@@ -2590,5 +2590,19 @@ h1 {
|
|||||||
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
||||||
</template>
|
</template>
|
||||||
<!--/$-->
|
<!--/$-->
|
||||||
</body>
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var btn = document.querySelector('button[aria-label="Toggle theme"]');
|
||||||
|
var shell = document.querySelector('.app-shell');
|
||||||
|
if (!btn || window.__themeToggleInjected) return;
|
||||||
|
window.__themeToggleInjected = true;
|
||||||
|
btn.addEventListener('click', function () {
|
||||||
|
document.documentElement.classList.toggle('dark-mode');
|
||||||
|
if (shell) shell.classList.toggle('dark-mode');
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+15
-1
@@ -2227,5 +2227,19 @@ opacity: 1;</pre>
|
|||||||
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
||||||
</template>
|
</template>
|
||||||
<!--/$-->
|
<!--/$-->
|
||||||
</body>
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var btn = document.querySelector('button[aria-label="Toggle theme"]');
|
||||||
|
var shell = document.querySelector('.app-shell');
|
||||||
|
if (!btn || window.__themeToggleInjected) return;
|
||||||
|
window.__themeToggleInjected = true;
|
||||||
|
btn.addEventListener('click', function () {
|
||||||
|
document.documentElement.classList.toggle('dark-mode');
|
||||||
|
if (shell) shell.classList.toggle('dark-mode');
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+15
-1
@@ -2590,5 +2590,19 @@ h1 {
|
|||||||
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
||||||
</template>
|
</template>
|
||||||
<!--/$-->
|
<!--/$-->
|
||||||
</body>
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var btn = document.querySelector('button[aria-label="Toggle theme"]');
|
||||||
|
var shell = document.querySelector('.app-shell');
|
||||||
|
if (!btn || window.__themeToggleInjected) return;
|
||||||
|
window.__themeToggleInjected = true;
|
||||||
|
btn.addEventListener('click', function () {
|
||||||
|
document.documentElement.classList.toggle('dark-mode');
|
||||||
|
if (shell) shell.classList.toggle('dark-mode');
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -2954,5 +2954,19 @@ h1 {
|
|||||||
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
<template data-dgst="BAILOUT_TO_CLIENT_SIDE_RENDERING">
|
||||||
</template>
|
</template>
|
||||||
<!--/$-->
|
<!--/$-->
|
||||||
</body>
|
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var btn = document.querySelector('button[aria-label="Toggle theme"]');
|
||||||
|
var shell = document.querySelector('.app-shell');
|
||||||
|
if (!btn || window.__themeToggleInjected) return;
|
||||||
|
window.__themeToggleInjected = true;
|
||||||
|
btn.addEventListener('click', function () {
|
||||||
|
document.documentElement.classList.toggle('dark-mode');
|
||||||
|
if (shell) shell.classList.toggle('dark-mode');
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -7,6 +7,31 @@ import { join, dirname, basename } from 'node:path';
|
|||||||
const root = process.argv[2];
|
const root = process.argv[2];
|
||||||
const dest = process.argv[3];
|
const dest = process.argv[3];
|
||||||
|
|
||||||
|
// --- inject a minimal theme toggle (extraction strips all <script> tags, so the
|
||||||
|
// ref pages would otherwise have no working dark-mode switch) ---
|
||||||
|
const THEME_TOGGLE = `
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var btn = document.querySelector('button[aria-label="Toggle theme"]');
|
||||||
|
var shell = document.querySelector('.app-shell');
|
||||||
|
if (!btn || window.__themeToggleInjected) return;
|
||||||
|
window.__themeToggleInjected = true;
|
||||||
|
btn.addEventListener('click', function () {
|
||||||
|
document.documentElement.classList.toggle('dark-mode');
|
||||||
|
if (shell) shell.classList.toggle('dark-mode');
|
||||||
|
});
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
`;
|
||||||
|
|
||||||
|
function injectThemeToggle(html) {
|
||||||
|
if (html.includes('__themeToggleInjected')) return html;
|
||||||
|
const tag = '</body>';
|
||||||
|
if (html.includes(tag)) return html.replace(tag, THEME_TOGGLE + '\n' + tag);
|
||||||
|
if (html.includes('</html>')) return html.replace('</html>', THEME_TOGGLE + '\n</html>');
|
||||||
|
return html + '\n' + THEME_TOGGLE;
|
||||||
|
}
|
||||||
|
|
||||||
// --- CSS: find the compiled chunk and pretty-print it ---
|
// --- CSS: find the compiled chunk and pretty-print it ---
|
||||||
const cssChunks = join(root, '..', '..', 'static', 'chunks');
|
const cssChunks = join(root, '..', '..', 'static', 'chunks');
|
||||||
const cssFile = readdirSync(cssChunks)
|
const cssFile = readdirSync(cssChunks)
|
||||||
@@ -110,6 +135,7 @@ for (const [src, out] of pages) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
html = fmtHtml(html);
|
html = fmtHtml(html);
|
||||||
|
html = injectThemeToggle(html);
|
||||||
|
|
||||||
const file = join(dest, out);
|
const file = join(dest, out);
|
||||||
mkdirSync(dirname(file), { recursive: true });
|
mkdirSync(dirname(file), { recursive: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user