From d1d8fb2d44bd9c4ffdd15be2eb9e1f186bea2394 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 27 Sep 2022 09:51:41 +0300 Subject: [PATCH 01/11] fix: Remove superfluous scrollbars --- ietf/templates/doc/document_html.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ietf/templates/doc/document_html.html b/ietf/templates/doc/document_html.html index 60fe37e0505..dc1a986da35 100644 --- a/ietf/templates/doc/document_html.html +++ b/ietf/templates/doc/document_html.html @@ -69,8 +69,8 @@ aria-label="Show document information"> -
-
+
+
@@ -106,7 +106,7 @@ {% endif %}
{# Implementation that uses the current primary email for each author #} {% for author in doc.authors %} - {% person_link author with_email=document_html|yesno:',True' %}{% if not forloop.last %},{% endif %} + {% person_link author %}{% if not forloop.last %},{% endif %} {% endfor %} {% if document_html %}
From b915a79d2e97f74f04b785111a4a375cdf0d3162 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 27 Sep 2022 10:46:41 +0300 Subject: [PATCH 03/11] fix: Only show "email authors" button for latest reversion --- ietf/templates/doc/document_info.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ietf/templates/doc/document_info.html b/ietf/templates/doc/document_info.html index 5197bf0df31..13dabfdf3d4 100644 --- a/ietf/templates/doc/document_info.html +++ b/ietf/templates/doc/document_info.html @@ -105,7 +105,7 @@ {% for author in doc.authors %} {% person_link author %}{% if not forloop.last %},{% endif %} {% endfor %} - {% if document_html %} + {% if document_html and not snapshot or document_html and doc.rev == latest_rev%}
Email authors {% endif %} From a7a4e240d827794ce027dba17316d8c942f4fb76 Mon Sep 17 00:00:00 2001 From: Lars Eggert Date: Tue, 27 Sep 2022 12:02:48 +0300 Subject: [PATCH 04/11] fix: Remove duplicate code, fix nav scrolling --- ietf/static/css/document_html.scss | 4 ++++ ietf/static/js/document_html.js | 16 ---------------- ietf/static/js/ietf.js | 14 -------------- ietf/static/js/nav.js | 16 ++++++++++++++++ ietf/templates/doc/document_html.html | 4 ++-- 5 files changed, 22 insertions(+), 32 deletions(-) diff --git a/ietf/static/css/document_html.scss b/ietf/static/css/document_html.scss index f87c7da6de5..c4397754a96 100644 --- a/ietf/static/css/document_html.scss +++ b/ietf/static/css/document_html.scss @@ -64,6 +64,10 @@ url(data-url:npm:bootstrap-icons/font/fonts/bootstrap-icons.woff) format("woff") overscroll-behavior: none; } +.no-scrollbar { + scrollbar-width: none; +} + .sidebar-toggle[aria-expanded="true"] { display: none; } diff --git a/ietf/static/js/document_html.js b/ietf/static/js/document_html.js index 568f7276a12..b87a135c251 100644 --- a/ietf/static/js/document_html.js +++ b/ietf/static/js/document_html.js @@ -6,27 +6,11 @@ import { Tab as Tab } from "bootstrap"; -import debounce from "lodash/debounce"; import Cookies from "js-cookie"; import { populate_nav } from "./nav.js"; const cookies = Cookies.withAttributes({ sameSite: "strict" }); -// Chrome apparently wants this debounced to something >10ms, -// otherwise the main view doesn't scroll? - -document.addEventListener("scroll", debounce(function () { - const items = document.getElementById("toc-nav") - .querySelectorAll(".active"); - const item = [...items].pop(); - if (item) { - item.scrollIntoView({ - block: "center", - behavior: "smooth" - }); - } -}, 100)); - document.addEventListener("DOMContentLoaded", function (event) { // handle point size slider const cookie = "doc-ptsize-max"; diff --git a/ietf/static/js/ietf.js b/ietf/static/js/ietf.js index 5257ee0cc22..17165bbfbdc 100644 --- a/ietf/static/js/ietf.js +++ b/ietf/static/js/ietf.js @@ -24,8 +24,6 @@ if (!process.env.BUILD_DEPLOY) { import Cookies from "js-cookie"; -import debounce from "lodash/debounce"; - import { populate_nav } from "./nav.js"; // setup CSRF protection using jQuery @@ -205,18 +203,6 @@ $(function () { extraNav.remove(); } - $(document) - // Chrome apparently wants this debounced to something >10ms, - // otherwise the main view doesn't scroll? - .on("scroll", debounce(function () { - const item = $('#righthand-nav') - .find(".active") - .last(); - if (item.length) { - item[0].scrollIntoView({ block: "center", behavior: "smooth" }); - } - }, 100)); - // offset the scrollspy to account for the menu bar const contentOffset = contentElement ? contentElement.offset().top : 0; diff --git a/ietf/static/js/nav.js b/ietf/static/js/nav.js index 17d553e728f..06b82f80d1e 100644 --- a/ietf/static/js/nav.js +++ b/ietf/static/js/nav.js @@ -1,3 +1,5 @@ +import debounce from "lodash/debounce"; + function make_nav() { const nav = document.createElement("nav"); nav.classList.add("nav-pills", "ps-3", "flex-column"); @@ -81,4 +83,18 @@ export function populate_nav(nav, heading_selector, classes) { for (var i = nav_stack.length - 1; i > 0; i--) { nav_stack[i - 1].appendChild(nav_stack[i]); } + + // Chrome apparently wants this debounced to something >10ms, + // otherwise the main view doesn't scroll? + document.addEventListener("scroll", debounce(function () { + const items = nav.querySelectorAll(".active"); + const item = [...items].pop(); + console.log(item); + if (item) { + item.scrollIntoView({ + block: "center", + behavior: "smooth" + }); + } + }, 100)); } diff --git a/ietf/templates/doc/document_html.html b/ietf/templates/doc/document_html.html index dc1a986da35..1c0ea86cf8e 100644 --- a/ietf/templates/doc/document_html.html +++ b/ietf/templates/doc/document_html.html @@ -69,7 +69,7 @@ aria-label="Show document information"> -
+