Site improvements

- Fix highlighting of TOC entries in the Chinese version of the site.
I wasn't doing the right escaping to deal with UTF-8 chars.
This commit is contained in:
mtail 2019-04-25 22:38:05 -07:00
parent 469667b184
commit f124e190de
7 changed files with 12 additions and 12 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -72,7 +72,7 @@ function handleCodeBlocks() {
const text = getToolbarDivText(div);
let downloadas = code.dataset.downloadas;
if (downloadas === undefined || downloadas === null || downloadas === "") {
if (!downloadas || downloadas === "") {
let lang = "";
for (const cl of code.classList) {
if (!cl) {

View File

@ -55,7 +55,7 @@ function handleLinks(): void {
// Create the set of endnotes that expand URLs when printing
function createEndnotes(): void {
const notes = getById("endnotes");
if (notes === null) {
if (!notes) {
return;
}

View File

@ -41,7 +41,7 @@ function handleScroll(): void {
for (let i = 0; i < tocLinks.length; i++) {
const heading = tocHeadings[i];
if (heading === null) {
if (!heading) {
continue;
}
@ -113,7 +113,7 @@ function handleScroll(): void {
tocLinks = toc.getElementsByTagName("a");
for (const link of tocLinks) {
if (link) {
const id = link.hash.substring(1);
const id = decodeURIComponent(link.hash.substring(1));
const hdr = getById(id);
if (hdr) {
tocHeadings.push(hdr);

View File

@ -15,7 +15,7 @@
// Attach the event handlers to support the sidebar
function handleSidebar(): void {
const sidebar = getById("sidebar");
if (sidebar === null) {
if (!sidebar) {
return;
}

View File

@ -47,7 +47,7 @@ function handleTabs(): void {
document.querySelectorAll(".tabset").forEach(tabset => {
const strip = tabset.querySelector<HTMLElement>(".tab-strip");
if (strip === null) {
if (!strip) {
return;
}