2019-11-04 13:09:44 +00:00
{{ define "main" }}
2019-12-08 14:29:02 +00:00
2020-01-21 08:53:58 +00:00
< main class = "single__main {{ if or ($.Param " enableToc " ) ( $ . Param " toc " ) } } { { if $ . Param " hideToc " } } main { { else if eq ( $ . Param " tocPosition " ) " outer " } } main { { else } } main-main { { end } } { { else } } main { { end } } " >
2020-01-31 06:06:30 +00:00
{{ if $.Param "enableBreadcrumb" }}
{{ partial "body/breadcrumb" . }}
2019-11-04 13:09:44 +00:00
{{ end }}
2020-02-27 13:29:54 +00:00
{{ if $.Param "hideSingleContentsWhenJSDisabled" }}
2020-02-10 14:11:01 +00:00
< noscript >
2020-02-27 13:29:54 +00:00
< div class = "single__nojs" >
{{ i18n "nojs-message" }}
< / div >
2020-02-10 14:11:01 +00:00
< / noscript >
2020-02-27 13:29:54 +00:00
{{ end }}
< div class = "single {{ if $.Param " hideSingleContentsWhenJSDisabled " } } hide { { end } } " >
< div class = "single__nojs" > {{ i18n "nojs-message" }}< / div >
< script > document . querySelector ( '.single' ) . classList . remove ( 'hide' ) ; document . querySelector ( '.single__nojs' ) . classList . add ( 'hide' ) ; < / script >
2020-02-16 17:57:14 +00:00
< h2 class = "single__title" data-ani = "{{ $.Site.Params.enableUiAnimation | default " true " } } " > {{ .Title }}< / h2 >
2020-10-20 20:25:30 +00:00
< h3 class = "single__subtitle" > {{ .Params.subtitle }}< / h3 >
2019-11-04 13:09:44 +00:00
< div class = "single__meta" >
2019-12-05 13:57:05 +00:00
{{ partial "body/infos" . }}
2019-11-19 09:25:36 +00:00
{{ partial "body/tags" . }}
2020-02-08 19:36:51 +00:00
< / div >
2020-02-16 17:57:14 +00:00
< article class = "single__contents" data-dir = "{{ if ne ($.Param " languagedir " ) " rtl " } } ltr { { else } } rtl { { end } } " data-ani = "{{ $.Site.Params.enableUiAnimation | default " true " } } " >
2020-01-07 07:30:51 +00:00
{{ partial "body/toc" . }}
2019-11-04 13:09:44 +00:00
{{ .Content }}
< / article >
2020-02-25 16:40:54 +00:00
2020-11-05 04:59:19 +00:00
{{ partial "script/clipboard-script" . }}
2020-02-09 09:10:12 +00:00
{{ partial "script/codeblock-script" . }}
2020-01-23 03:35:20 +00:00
{{ partial "body/share" . }}
2019-12-05 10:04:42 +00:00
{{ partial "body/donation" . }}
2019-11-20 06:55:05 +00:00
{{ partial "body/whoami" . }}
2019-11-04 13:09:44 +00:00
{{ partial "body/related" . }}
{{ partial "pagination/pagination-single" . }}
2019-11-20 06:55:05 +00:00
{{ partial "comments/comments.html" . }}
2019-11-25 04:36:50 +00:00
{{ partial "body/photoswipe" . }}
2019-11-20 17:45:46 +00:00
< div class = "hide" >
2020-01-21 02:07:47 +00:00
{{ partial "search/site-search" . }}
2019-11-20 17:45:46 +00:00
< / div >
2019-11-04 13:09:44 +00:00
< / div >
< / main >
2019-11-12 10:03:15 +00:00
2020-01-21 08:53:58 +00:00
{{ if and (or ($.Param "enableToc") ($.Param "toc")) (ne ($.Param "tocPosition") "outer") }}
2020-01-21 02:07:47 +00:00
< aside class = "single__side {{ if or ($.Param " enableToc " ) ( $ . Param " toc " ) } } main-side { { end } } " >
2019-11-04 13:09:44 +00:00
{{ partial "sidebar/sidebar-single" . }}
< / aside >
{{ end }}
2019-12-08 14:29:02 +00:00
< script >
2020-01-21 02:07:47 +00:00
{{ $enableToc:= $.Param "enableToc" }}
{{ $toc:= $.Param "toc" }}
2020-01-21 08:53:58 +00:00
{{ $tocPosition:= $.Param "tocPosition" }}
2020-01-21 02:07:47 +00:00
var enableToc = JSON.parse({{ $enableToc | jsonify }});
var toc = JSON.parse({{ $toc | jsonify }});
2020-01-21 08:53:58 +00:00
var tocPosition = JSON.parse({{ $tocPosition | jsonify }});
2020-01-21 02:07:47 +00:00
var singleMainElem = document.querySelector('.single__main');
var singleSideElem = document.querySelector('.single__side');
2019-12-08 14:29:02 +00:00
enquire.register("screen and (max-width: 769px)", {
match: function () {
2020-01-21 08:53:58 +00:00
if ((enableToc || toc) & & tocPosition !== "outer") {
if (singleMainElem & & singleSideElem) {
singleMainElem.classList.remove('main-main');
singleMainElem.classList.add('main');
singleSideElem.classList.remove('main-side');
singleSideElem.classList.add('hide');
}
} else if (tocPosition === "outer") {
if (singleMainElem & & !singleMainElem.classList.contains('main-main')) {
singleMainElem.classList.remove('main-main');
singleMainElem.classList.add('main');
}
if (singleSideElem & & !singleSideElem.classList.contains('hide')) {
singleSideElem.classList.add('hide');
}
2019-12-08 14:29:02 +00:00
}
},
unmatch: function () {
2020-01-21 08:53:58 +00:00
if ((enableToc || toc) & & tocPosition !== "outer") {
2020-01-21 02:07:47 +00:00
singleMainElem.classList.remove('main');
singleMainElem.classList.add('main-main');
singleSideElem.classList.remove('hide');
singleSideElem.classList.add('main-side');
2020-01-21 08:53:58 +00:00
} else if (tocPosition === "outer") {
if (singleMainElem & & !singleMainElem.classList.contains('main-main')) {
singleMainElem.classList.remove('main-main');
singleMainElem.classList.add('main');
}
if (singleSideElem & & !singleSideElem.classList.contains('hide')) {
singleSideElem.classList.add('hide');
}
2019-12-08 14:29:02 +00:00
}
2020-01-21 02:07:47 +00:00
2020-02-20 14:08:34 +00:00
var navCollapseBtn = document.querySelector('.navbar__burger');
2020-02-20 10:08:38 +00:00
var navCollapse = document.getElementsByClassName('navbarm__collapse')[0];
if (navCollapse) {
navCollapse.setAttribute('data-open', false);
navCollapse.style.maxHeight = 0;
2020-02-20 14:08:34 +00:00
navCollapseBtn.classList.remove('is-active');
2020-02-20 10:08:38 +00:00
}
2019-12-08 14:29:02 +00:00
document.getElementsByClassName('navbar__menu')[0].classList.remove('is-active');
document.getElementsByClassName('mobile-search')[0].classList.add('hide');
},
setup: function () { },
deferSetup: true,
destroy: function () { },
});
< / script >
2019-11-24 14:31:28 +00:00
{{ partial "script/single-script" . }}
2020-10-19 20:54:04 +00:00
{{ end }}