From 687215c32f10b85ce1c3fffef356e505daccf3f4 Mon Sep 17 00:00:00 2001 From: Sven Dowideit Date: Mon, 13 Oct 2014 16:32:18 +1000 Subject: [PATCH] Turn off editing for auto-generated index pages, and scroll the user to the right section Docker-DCO-1.1-Signed-off-by: Sven Dowideit (github: SvenDowideit) --- docs/theme/mkdocs/autoindex.html | 3 +++ docs/theme/mkdocs/base.html | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/docs/theme/mkdocs/autoindex.html b/docs/theme/mkdocs/autoindex.html index cc4a41ec94..df1cc3eb09 100644 --- a/docs/theme/mkdocs/autoindex.html +++ b/docs/theme/mkdocs/autoindex.html @@ -1,3 +1,6 @@ +no_edit: true +auto_scroll_to_path: true + # Table of Contents {% for nav_item in nav %} diff --git a/docs/theme/mkdocs/base.html b/docs/theme/mkdocs/base.html index a4a10a927d..adafc55df8 100644 --- a/docs/theme/mkdocs/base.html +++ b/docs/theme/mkdocs/base.html @@ -65,8 +65,10 @@ Latest (Version {{ major_minor }}) @@ -139,6 +141,17 @@ piCId = '1482'; $(e).removeClass() }); }); +{% if meta.auto_scroll_to_path %} + // scroll to the right location in the generated index page + m=location.pathname.match(/^\/(.*?)\//) + if (m && m[1]) { + anchor = m[1].toLowerCase().replace(/ /, "-").replace(/\//, "-") + anchor_point = $('#'+anchor) + if (anchor_point && anchor_point[0]) { + $(window).scrollTop(anchor_point.offset().top); + } + } +{% endif %} }) var userName = getCookie('docker_sso_username'); if (userName) {