From 02ac63673bdb36a42ee52b01eb77964ba034fb3c Mon Sep 17 00:00:00 2001 From: Jennifer Mann Date: Tue, 25 Apr 2017 16:20:00 -0400 Subject: [PATCH] Updated sidebar links to include root --- scripts/helpers.js | 4 +++- .../source/css/_partial/mobile_nav.scss | 4 ++++ themes/cypress/source/css/_partial/page.scss | 19 ++++++++++++------- themes/cypress/source/js/toc.js | 4 +++- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/scripts/helpers.js b/scripts/helpers.js index 7e8d9f1704..9f33a80342 100644 --- a/scripts/helpers.js +++ b/scripts/helpers.js @@ -58,7 +58,8 @@ hexo.extend.helper.register('doc_sidebar', function(className){ var itemClass = className + '-link' if (link === path) itemClass += ' current' - result += '' + self.__(prefix + text) + '' + result += ` + ${self.__(prefix + text)}` }) }) @@ -83,6 +84,7 @@ hexo.extend.helper.register('header_menu', function(className){ hexo.extend.helper.register('canonical_url', function(lang){ var path = this.page.canonical_path + if (lang && lang !== 'en') path = lang + '/' + path return this.config.url + '/' + path diff --git a/themes/cypress/source/css/_partial/mobile_nav.scss b/themes/cypress/source/css/_partial/mobile_nav.scss index c40c5ae822..5854a789bc 100644 --- a/themes/cypress/source/css/_partial/mobile_nav.scss +++ b/themes/cypress/source/css/_partial/mobile_nav.scss @@ -26,6 +26,10 @@ padding: 0 $gutter-width; } + #sidebar .inner { + padding-right: 0; + } + #main-nav { display: block; } diff --git a/themes/cypress/source/css/_partial/page.scss b/themes/cypress/source/css/_partial/page.scss index 5eb8642e33..ceac30f560 100644 --- a/themes/cypress/source/css/_partial/page.scss +++ b/themes/cypress/source/css/_partial/page.scss @@ -67,6 +67,7 @@ margin: 1em 0; margin-left: 20px; list-style: disc; + ul { margin-top: 0; margin-bottom: 0; @@ -158,11 +159,12 @@ // display: none; } h1 { - font-size: 1.7em; + font-size: 1.8em; line-height: 1em; font-weight: 900; margin: 2em 0 0 0; padding: 0; + font-family: $font-title; &:first-of-type { margin-top: 0.5em; @@ -171,29 +173,34 @@ h2 { font-size: 1.5em; line-height: 1em; - font-weight: bold; - margin: 2em 0 0 0; + font-weight: 700; + margin: 1em 0 0 0; + font-family: $font-title; } h3 { font-size: 1.3em; line-height: 1em; font-weight: bold; margin: 1em 0; + font-family: $font-title; } h4 { line-height: 1em; font-weight: bold; margin: 1em 0; + font-family: $font-title; } h5 { line-height: 1em; font-weight: bold; margin: 1em 0; + font-family: $font-title; } h6 { line-height: 1em; font-weight: bold; margin: 1em 0; + font-family: $font-title; } a { @@ -236,9 +243,6 @@ video { max-width: 100%; } - - - .note { font-weight: 200; border: 0; @@ -289,8 +293,9 @@ .note-title { margin: 0; display: block; - font-size: 0.9em; + font-size: 1em; font-weight: 500; + font-family: $font-title; } } diff --git a/themes/cypress/source/js/toc.js b/themes/cypress/source/js/toc.js index 9f660c7d65..8b98abb955 100644 --- a/themes/cypress/source/js/toc.js +++ b/themes/cypress/source/js/toc.js @@ -1,7 +1,6 @@ (function(){ 'use strict'; - var header = document.getElementById('header'); var toc = document.getElementById('article-toc'); var tocInner = document.querySelector('.toc'); @@ -10,8 +9,11 @@ if (!toc) return; + // https://github.com/lcdsantos/menuspy + // This highlights the proper toc link while scrolling var ms = new MenuSpy(tocInner) + // This keeps the toc within the view function updateSidebarPosition(){ var scrollTop = document.scrollingElement.scrollTop;