summaryrefslogtreecommitdiff
path: root/_posts
diff options
context:
space:
mode:
Diffstat (limited to '_posts')
-rw-r--r--_posts/2026-10-17-regex.html25
1 files changed, 3 insertions, 22 deletions
diff --git a/_posts/2026-10-17-regex.html b/_posts/2026-10-17-regex.html
index addb3de..b7e3855 100644
--- a/_posts/2026-10-17-regex.html
+++ b/_posts/2026-10-17-regex.html
@@ -10,34 +10,15 @@ layout: post
<script>
const body = document.body;
const checkbox = document.getElementById("fullscreen");
- const properties = ["margin", "max-width", "padding"];
-
- // Save each property's original inline value and priority.
- const originalStyles = Object.fromEntries(
- properties.map(property => [
- property,
- {
- value: body.style.getPropertyValue(property),
- priority: body.style.getPropertyPriority(property)
- }
- ])
- );
-
checkbox.addEventListener("change", () => {
if (checkbox.checked) {
body.style.setProperty("margin", "0");
body.style.setProperty("max-width", "none");
body.style.setProperty("padding", "0");
} else {
- for (const property of properties) {
- const { value, priority } = originalStyles[property];
-
- if (value) {
- body.style.setProperty(property, value, priority);
- } else {
- body.style.removeProperty(property);
- }
- }
+ body.style.removeProperty("margin");
+ body.style.removeProperty("max-width");
+ body.style.removeProperty("padding");
}
});
</script>