mirror of
https://github.com/frainfreeze/the-monospace-web-pandoc
synced 2025-12-29 18:49:50 -08:00
add debug button
This commit is contained in:
2
Makefile
2
Makefile
@@ -5,6 +5,6 @@ clean:
|
|||||||
rm -f index.html
|
rm -f index.html
|
||||||
|
|
||||||
index.html: index.md template.html Makefile
|
index.html: index.md template.html Makefile
|
||||||
pandoc -s --css reset.css --css index.css -i $< -o $@ --template=template.html
|
pandoc --toc -s --css reset.css --css index.css -i $< -o $@ --template=template.html
|
||||||
|
|
||||||
.PHONY: all clean
|
.PHONY: all clean
|
||||||
|
|||||||
13
index.css
13
index.css
@@ -268,7 +268,7 @@ li {
|
|||||||
|
|
||||||
/* DEBUG UTILITIES */
|
/* DEBUG UTILITIES */
|
||||||
|
|
||||||
.grid {
|
.debug .grid {
|
||||||
--color: color-mix(in srgb, var(--text-color) 10%, var(--background-color) 90%);
|
--color: color-mix(in srgb, var(--text-color) 10%, var(--background-color) 90%);
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
@@ -281,10 +281,15 @@ li {
|
|||||||
repeating-linear-gradient(90deg, var(--color) 0 1px, transparent 1px 100%);
|
repeating-linear-gradient(90deg, var(--color) 0 1px, transparent 1px 100%);
|
||||||
background-size: 1ch var(--line-height);
|
background-size: 1ch var(--line-height);
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
/*display: none;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.off-grid {
|
.debug .off-grid {
|
||||||
background: rgba(255, 0, 0, 0.1);
|
background: rgba(255, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.debug-toggle {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
margin: var(--line-height) 2ch;
|
||||||
|
}
|
||||||
|
|||||||
7
index.js
7
index.js
@@ -52,7 +52,7 @@ function checkOffsets() {
|
|||||||
const config = { childList: true, subtree: true };
|
const config = { childList: true, subtree: true };
|
||||||
|
|
||||||
const callback = () => {
|
const callback = () => {
|
||||||
const elements = document.querySelectorAll("body *");
|
const elements = document.querySelectorAll("body :not(.grid)");
|
||||||
for (const element of elements) {
|
for (const element of elements) {
|
||||||
const offset = element.offsetTop % 10;
|
const offset = element.offsetTop % 10;
|
||||||
if(element.offsetParent == document.body && offset > 0) {
|
if(element.offsetParent == document.body && offset > 0) {
|
||||||
@@ -71,3 +71,8 @@ function checkOffsets() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("load", checkOffsets);
|
window.addEventListener("load", checkOffsets);
|
||||||
|
|
||||||
|
const debugButton = document.querySelector(".debug-toggle");
|
||||||
|
debugButton.addEventListener("click", () => {
|
||||||
|
document.body.classList.toggle("debug");
|
||||||
|
});
|
||||||
|
|||||||
1
index.md
1
index.md
@@ -3,6 +3,7 @@ title: The Monospace Web
|
|||||||
author: Oskar Wickström
|
author: Oskar Wickström
|
||||||
date: August 2024
|
date: August 2024
|
||||||
lang: en
|
lang: en
|
||||||
|
toc-title: Contents
|
||||||
---
|
---
|
||||||
|
|
||||||
## Introduction
|
## Introduction
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ $for(include-after)$
|
|||||||
$include-after$
|
$include-after$
|
||||||
$endfor$
|
$endfor$
|
||||||
<div class="grid"></div>
|
<div class="grid"></div>
|
||||||
|
<button class="debug-toggle">Debug</button>
|
||||||
<script src="index.js"></script>
|
<script src="index.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user