Skip to content

Commit

Permalink
made tips accept font size in URL query string via ?size=
Browse files Browse the repository at this point in the history
  • Loading branch information
EliahKagan committed May 15, 2021
1 parent 96a43e7 commit bef89ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions doc/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
// colored vertical bar running along it, to the left of the body. Links in
// tips.html use this to open the help with the relevant part highlighted.
function applyHighlighting() {
const params = new URLSearchParams(location.search);
const idToMark = params.get('highlight');
const idToMark = new URLSearchParams(location.search).get('highlight');
if (idToMark === null) return;

document.getElementById(idToMark).classList.add('highlighted');
Expand Down
4 changes: 4 additions & 0 deletions doc/tips.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;700&family=IBM+Plex+Mono:wght@700&display=swap">
<link rel="stylesheet" href="shared.css">
<link rel="stylesheet" href="tips.css">
<script src="https://unpkg.com/@ungap/[email protected]/min.js"
integrity="sha384-cduzXFJp9BFmTpHsZ9dKgXokrdxGJ5Ix5rWJdBihjdTpqdmtvn48NpDmTLwB79Bf"
crossorigin="anonymous"
defer></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/classlist/1.2.20180112/classList.min.js"
integrity="sha512-ISyiBXwG69Utm2wNP5ex+4P5+JmPaXmBMV82Uq/Yuck54FnOC4ZIJ9vDIT9TzHzZZC/xdYgivc2wmKuJkAZHmQ=="
crossorigin="anonymous"
Expand Down
6 changes: 6 additions & 0 deletions doc/tips.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
(function () {
'use strict';

// Set a body font size, if requested in the URL query string.
const size = new URLSearchParams(location.search).get('size');
if (size !== null) {
document.body.style.fontSize = size;
}

// Whole-row items should navigate when clicked anywhere, not just in a
// cell. We'll find the first link inside each and make clicking go there.
const wholeRowItems = document.querySelectorAll('tr.item');
Expand Down

0 comments on commit bef89ad

Please sign in to comment.