From f086116ae9372ddf88b873c8eca08bf028296ffc Mon Sep 17 00:00:00 2001 From: HouTeng Chan <ht-chen21@mails.tsinghua.edu.cn> Date: Sat, 28 Sep 2024 11:48:05 +0000 Subject: [PATCH] Update 2 files - /wiki/layout.html - /wiki/pages/attributions.html --- wiki/layout.html | 52 ++++++++++++++++++++++++++++++++++++ wiki/pages/attributions.html | 2 ++ 2 files changed, 54 insertions(+) diff --git a/wiki/layout.html b/wiki/layout.html index a4a38af7..9899e584 100644 --- a/wiki/layout.html +++ b/wiki/layout.html @@ -170,6 +170,29 @@ height: 100%; object-fit: cover; } + .text-size-toggle { + position: fixed; + right: 20px; + bottom: 30px; + width: 30px; + height: 30px; + background-color: #FFC0CB; + border: none; + border-radius: 50%; + color: white; + font-size: 14px; + font-weight: bold; + cursor: pointer; + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; + } + + /* Add a class for larger text */ + .large-text { + font-size: 120%; + } </style> </head> @@ -250,6 +273,35 @@ }); }); }); + // Existing script content + + // Add new script for text size toggle functionality + document.addEventListener('DOMContentLoaded', function() { + var textSizeToggle = document.getElementById('textSizeToggle'); + var body = document.body; + var isLarge = false; + + textSizeToggle.addEventListener('click', function() { + if (isLarge) { + body.classList.remove('large-text'); + textSizeToggle.textContent = 'L'; + } else { + body.classList.add('large-text'); + textSizeToggle.textContent = 'S'; + } + isLarge = !isLarge; + + // Store the current state in localStorage + localStorage.setItem('largeTextEnabled', isLarge); + }); + + // Check localStorage on page load + if (localStorage.getItem('largeTextEnabled') === 'true') { + body.classList.add('large-text'); + textSizeToggle.textContent = 'S'; + isLarge = true; + } + }); </script> </body> </html> diff --git a/wiki/pages/attributions.html b/wiki/pages/attributions.html index 7d48d9c0..db34cd07 100644 --- a/wiki/pages/attributions.html +++ b/wiki/pages/attributions.html @@ -72,6 +72,8 @@ <div class="progress-text">0%</div> </div> + <button id="textSizeToggle" class="text-size-toggle">L</button> + <div class="content"> <div class="row mt-4"> <div class="col-lg-12"> -- GitLab