Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zzossig/hugo-theme-zdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzossig <zzossig@gmail.com>2020-02-13 05:31:30 +0300
committerzzossig <zzossig@gmail.com>2020-02-13 05:31:30 +0300
commit50c6b667cd18fce831a9877649c4532782111e95 (patch)
treee318af4d5211dcde12ff2d10fd319ebbe68aa7b0
parent2d2d6171207efec754c313e4c4cd5dba8026c756 (diff)
toc level option added, menu highlight, some ui change
-rw-r--r--assets/sass/layout/_navbar.scss2
-rw-r--r--assets/sass/pages/_single.scss7
-rw-r--r--layouts/partials/head/scripts.html13
-rw-r--r--layouts/partials/main/sections/list-main.html3
-rw-r--r--layouts/partials/main/sections/single-menu.html4
5 files changed, 21 insertions, 8 deletions
diff --git a/assets/sass/layout/_navbar.scss b/assets/sass/layout/_navbar.scss
index 25c6843..4deb097 100644
--- a/assets/sass/layout/_navbar.scss
+++ b/assets/sass/layout/_navbar.scss
@@ -80,7 +80,7 @@
& > a {
width: 100%;
font-size: 18px;
- padding: 0.5rem;
+ padding: 0.5rem 1rem;
@include themify($themes) {
color: themed('body-color');
diff --git a/assets/sass/pages/_single.scss b/assets/sass/pages/_single.scss
index 3540a42..f340e65 100644
--- a/assets/sass/pages/_single.scss
+++ b/assets/sass/pages/_single.scss
@@ -23,8 +23,7 @@
font-family: $title-font;
line-height: 3rem;
overflow-wrap: break-word;
- padding: 1rem;
- margin: 1rem 0;
+ margin: 1.5rem 1rem 0.5rem;
@include themify($themes) {
color: themed("single-header-title-color");
@@ -34,6 +33,7 @@
&__meta {
font-size: 0.8rem;
margin-bottom: 1.5rem;
+ padding:0 1rem;
@include flexbox();
@include align-items(center);
@@ -393,7 +393,7 @@ pre:not(.chroma) {
}
.highlight > .chroma {
- margin: 1em 0;
+ margin-bottom: 1.5rem;
z-index: z('content');
overflow-x: auto;
@@ -504,6 +504,7 @@ li .highlight > .chroma {
}
table:not(.lntable) {
+ margin: 0 1rem;
td {
code {
padding: 2px 7px !important;
diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html
index c63b17a..957a1a9 100644
--- a/layouts/partials/head/scripts.html
+++ b/layouts/partials/head/scripts.html
@@ -147,11 +147,20 @@
var tableOfContentsElem = tocElem ? tocElem.querySelector('#TableOfContents') : null;
var singleContentsElem = document.querySelector('.single__contents');
+ {{ $tocLevels := ($.Param "tocLevels") }}
+ var tocLevels = JSON.parse({{ $tocLevels | jsonify }});
+
+ if (tocLevels) {
+ tocLevels = tocLevels.toString();
+ } else {
+ tocLevels = "h1, h2, h3, h4, h5, h6";
+ }
+
window.onscroll = function () {
var st = window.pageYOffset || document.documentElement.scrollTop;
if (st > lastScrollTop) { // scroll down
singleContentsElem ?
- singleContentsElem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function(elem) {
+ singleContentsElem.querySelectorAll(tocLevels.toString()).forEach(function(elem) {
if (document.documentElement.scrollTop >= elem.offsetTop) {
if (tableOfContentsElem) {
var id = elem.getAttribute('id');
@@ -165,7 +174,7 @@
}) : null;
} else { // scroll up
singleContentsElem ?
- singleContentsElem.querySelectorAll("h1, h2, h3, h4, h5, h6").forEach(function(elem) {
+ singleContentsElem.querySelectorAll(tocLevels.toString()).forEach(function(elem) {
if (document.documentElement.scrollTop >= elem.offsetTop) {
if (tableOfContentsElem) {
var id = elem.getAttribute('id');
diff --git a/layouts/partials/main/sections/list-main.html b/layouts/partials/main/sections/list-main.html
index 90b3c9b..7e3e90b 100644
--- a/layouts/partials/main/sections/list-main.html
+++ b/layouts/partials/main/sections/list-main.html
@@ -1,5 +1,8 @@
<div class="single" data-display="block">
{{ if eq .Type "blog" }}
+ <div class="single__title">
+ {{ .Title }}
+ </div>
<div class="single__meta">
{{ partial "main/component/article-meta.html" . }}
</div>
diff --git a/layouts/partials/main/sections/single-menu.html b/layouts/partials/main/sections/single-menu.html
index 32a706e..58ef6a0 100644
--- a/layouts/partials/main/sections/single-menu.html
+++ b/layouts/partials/main/sections/single-menu.html
@@ -30,8 +30,8 @@
{{ else }}
{{ $lastUrlElement1 := index (last 1 (split (delimit (split .Permalink "/") "," "") ",")) 0 }}
{{ $lastUrlElement2 := index (last 1 (split (delimit (split $currentURL "/") "," "") ",")) 0 }}
- <li class="{{ if and (in $lastUrlElement1 $lastUrlElement2) (eq $sectionName1 $sectionName2) }}active{{ end }}">
- <a href="{{ .Permalink }}" class="menu__title {{ if and (in $lastUrlElement1 $lastUrlElement2) (eq $sectionName1 $sectionName2) }}active{{ end }}">{{ .Title }}</a>
+ <li>
+ <a href="{{ .Permalink }}" class="menu__title {{ if in $lastUrlElement1 $lastUrlElement2 }}active{{ end }}">{{ .Title }}</a>
</li>
{{ end }}
{{ end }}