Skip to content

Commit 1bf8b59

Browse files
committed
fixed template
1 parent 7bc0436 commit 1bf8b59

File tree

1 file changed

+94
-95
lines changed

1 file changed

+94
-95
lines changed

manual/tool/template/mdbook.html

Lines changed: 94 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
<meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" />
1717
$endif$
1818
<title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>
19-
<script src="tool/template/svg-inject.js" type="text/javascript" charset="utf-8"></script>
20-
<script src="tool/template/svg-color.js" type="text/javascript" charset="utf-8"></script>
19+
<script src="template/svg-inject.js" type="text/javascript" charset="utf-8"></script>
20+
<script src="template/svg-color.js" type="text/javascript" charset="utf-8"></script>
2121

22-
<link rel="shortcut icon" href="tool/template/favicon.ico">
23-
<link rel="stylesheet" href="tool/template/screen.css" />
24-
<link rel="stylesheet" href="tool/template/print.css" media="print">
22+
<link rel="shortcut icon" href="template/favicon.ico">
23+
<link rel="stylesheet" href="template/screen.css" />
24+
<link rel="stylesheet" href="template/print.css" media="print">
2525
<style>
2626
code {
2727
white-space: pre-wrap;
@@ -57,7 +57,7 @@
5757
$endfor$
5858

5959
<!-- Fonts -->
60-
<link rel="stylesheet" href="tool/template/fontawesome/css/all.min.css">
60+
<link rel="stylesheet" href="template/fontawesome/css/all.min.css">
6161
<link
6262
href="https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800"
6363
rel="stylesheet" type="text/css">
@@ -156,109 +156,108 @@ <h1 class="menu-title">$title$</h1>
156156

157157
<!-- ACCENT -->
158158
<a id="colorPickerAccentButton">
159-
<i class="fas fa-palette" style="color: var(--accent);"></i>
159+
<i class="fas fa-palette" style="color: var(--accent);"></i>
160160
</a>
161161
<input type="color" id="colorPickerAccent" value="#97fa98" style="display:none;">
162-
</div>
162+
</div>
163163

164164

165-
<div id="content" class="content">
166-
<main>
167-
$body$
168-
</main>
165+
<div id="content" class="content">
166+
<main>
167+
$body$
168+
</main>
169169

170-
<nav class="nav-wrapper" aria-label="Page navigation">
171-
<!-- Mobile navigation buttons -->
170+
<nav class="nav-wrapper" aria-label="Page navigation">
171+
<!-- Mobile navigation buttons -->
172172

173173

174174

175175

176-
<div style="clear: both"></div>
177-
</nav>
176+
<div style="clear: both"></div>
177+
</nav>
178+
</div>
178179
</div>
179-
</div>
180180

181-
<nav class="nav-wide-wrapper" aria-label="Page navigation">
181+
<nav class="nav-wide-wrapper" aria-label="Page navigation">
182182

183-
</nav>
183+
</nav>
184184

185-
</div>
185+
</div>
186186

187-
<script src="tool/template/book.js" type="text/javascript" charset="utf-8"></script>
188-
$for(include-after)$
189-
$include-after$
190-
$endfor$
191-
192-
<script>
193-
input.addEventListener("input", function () {
194-
const newColor = input.value;
195-
button.querySelector("i").style.color = newColor;
196-
197-
// Only target paths for the current picker (main or accent)
198-
document.querySelectorAll('svg[color]').forEach(svg => {
199-
const svgColor = svg.getAttribute('color');
200-
if (svgColor !== type) return;
201-
202-
// TYPE 1: Paths inside any <g id^="fill">
203-
const groupPaths = svg.querySelectorAll('g[id^="fill"] path');
204-
205-
// TYPE 2: Any <path> with matching color attribute
206-
const coloredPaths = svg.querySelectorAll(`path[color="${type}"]`);
207-
208-
// Combine into a Set to avoid duplicates if any path matches both
209-
const allPaths = new Set([...groupPaths, ...coloredPaths]);
210-
211-
allPaths.forEach(path => {
212-
path.removeAttribute('class'); // Remove class like .st0
213-
path.style.fill = newColor; // Apply inline fill
214-
});
215-
});
216-
});
217-
218-
</script>
219-
220-
221-
222-
<script>
223-
SVGInject.setOptions({
224-
useCache: false, // no caching
225-
copyAttributes: true, // do not copy attributes from `<img>` to `<svg>`
226-
makeIdsUnique: false, // do not make ids used within the SVG unique
227-
afterInject: function(img, svg) {
228-
const targetFill = 'fill:#97fa98';
229-
svg.querySelectorAll('path[style]').forEach(path => {
230-
const style = path.getAttribute('style');
231-
if (style.includes(targetFill)) {
232-
// Remove the fill from style string
233-
const newStyle = style
234-
.split(';')
235-
.filter(part => !part.trim().startsWith('fill:#97fa98'))
236-
.join(';')
237-
.trim();
238-
239-
if (newStyle) {
240-
path.setAttribute('style', newStyle);
241-
} else {
242-
path.removeAttribute('style');
243-
}
244-
245-
// Add color="accent"
246-
path.setAttribute('color', 'accent');
247-
}
248-
});
249-
},
250-
251-
252-
beforeLoad: function(img) {
253-
var path = "https://raw.githubusercontent.com/PrintersForAnts/MicronManual/refs/heads/main/manual/"
254-
const rawSrc = img.getAttribute('src') || '';
255-
console.log(rawSrc);
256-
console.log(path);
257-
return path + rawSrc;
258-
}
259-
});
260-
</script>
187+
<script src="template/book.js" type="text/javascript" charset="utf-8"></script>
188+
$for(include-after)$
189+
$include-after$
190+
$endfor$
191+
192+
<script>
193+
input.addEventListener("input", function () {
194+
const newColor = input.value;
195+
button.querySelector("i").style.color = newColor;
196+
197+
// Only target paths for the current picker (main or accent)
198+
document.querySelectorAll('svg[color]').forEach(svg => {
199+
const svgColor = svg.getAttribute('color');
200+
if (svgColor !== type) return;
201+
202+
// TYPE 1: Paths inside any <g id^="fill">
203+
const groupPaths = svg.querySelectorAll('g[id^="fill"] path');
204+
205+
// TYPE 2: Any <path> with matching color attribute
206+
const coloredPaths = svg.querySelectorAll(`path[color="${type}"]`);
207+
208+
// Combine into a Set to avoid duplicates if any path matches both
209+
const allPaths = new Set([...groupPaths, ...coloredPaths]);
210+
211+
allPaths.forEach(path => {
212+
path.removeAttribute('class'); // Remove class like .st0
213+
path.style.fill = newColor; // Apply inline fill
214+
});
215+
});
216+
});
217+
218+
</script>
219+
220+
221+
222+
<script>
223+
SVGInject.setOptions({
224+
useCache: false, // no caching
225+
copyAttributes: true, // do not copy attributes from `<img>` to `<svg>`
226+
makeIdsUnique: false, // do not make ids used within the SVG unique
227+
afterInject: function (img, svg) {
228+
const targetFill = 'fill:#97fa98';
229+
svg.querySelectorAll('path[style]').forEach(path => {
230+
const style = path.getAttribute('style');
231+
if (style.includes(targetFill)) {
232+
// Remove the fill from style string
233+
const newStyle = style
234+
.split(';')
235+
.filter(part => !part.trim().startsWith('fill:#97fa98'))
236+
.join(';')
237+
.trim();
238+
239+
if (newStyle) {
240+
path.setAttribute('style', newStyle);
241+
} else {
242+
path.removeAttribute('style');
243+
}
244+
245+
// Add color="accent"
246+
path.setAttribute('color', 'accent');
247+
}
248+
});
249+
},
250+
251+
252+
beforeLoad: function (img) {
253+
var path = "https://raw.githubusercontent.com/PrintersForAnts/MicronManual/refs/heads/main/manual/"
254+
const rawSrc = img.getAttribute('src') || '';
255+
console.log(rawSrc);
256+
console.log(path);
257+
return path + rawSrc;
258+
}
259+
});
260+
</script>
261261
</body>
262262

263-
264263
</html>

0 commit comments

Comments
 (0)