From b9e4f627cc0291c9dff84583f9a4888757a4c659 Mon Sep 17 00:00:00 2001 From: Wonderfall Date: Thu, 28 Jul 2022 03:17:31 +0200 Subject: [PATCH] open toc on wide displays --- assets/js/papermod.js | 9 +++++++++ layouts/partials/toc.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/assets/js/papermod.js b/assets/js/papermod.js index a1c990e2..bb2ad2a7 100644 --- a/assets/js/papermod.js +++ b/assets/js/papermod.js @@ -104,7 +104,16 @@ function showCodeCopyButtons() { }); } +function openToc() { + var toc = document.getElementById("toc"); + + if (toc && window.screen.width > 1500 && window.screen.height > 800) { + toc.open = true; + } +} + initializeMenu(); +openToc() if (params.scrollToTop) scrollToTop(); if (params.themeToggle) themeToggle(); if (params.showCodeCopyButtons) showCodeCopyButtons(); \ No newline at end of file diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 5965bf8b..1b74034b 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -2,7 +2,7 @@ {{- $has_headers := ge (len $headers) 1 -}} {{- if $has_headers -}}
-
+
{{- i18n "toc" | default "Table of Contents" }}