gallery fixes, new params

gallery folder check logic added
fix #326
fix #317
appbarSearchIcon = true
appbarLangIcon = true
This commit is contained in:
zzossig 2020-10-16 12:04:47 +09:00
parent 0decc1bce4
commit 11e7081662
14 changed files with 99 additions and 46 deletions

View File

@ -254,6 +254,10 @@ enableUiAnimation = true
hideSingleContentsWhenJSDisabled = false hideSingleContentsWhenJSDisabled = false
minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud
# appbar
enableAppbarSearchIcon = false
enableAppbarLangIcon = false
# header # header
homeHeaderType = "text" # text, img, slide, typewriter homeHeaderType = "text" # text, img, slide, typewriter
hideHomeHeaderWhenMobile = false hideHomeHeaderWhenMobile = false

View File

@ -266,6 +266,10 @@ enableUiAnimation = true
hideSingleContentsWhenJSDisabled = false hideSingleContentsWhenJSDisabled = false
minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud
# appbar
enableAppbarSearchIcon = false
enableAppbarLangIcon = false
# header # header
homeHeaderType = "text" # text, img, slide, typewriter homeHeaderType = "text" # text, img, slide, typewriter
hideHomeHeaderWhenMobile = false hideHomeHeaderWhenMobile = false

View File

@ -55,7 +55,7 @@
&[data-ani="true"] { &[data-ani="true"] {
@media only screen and (min-width: 769px) { @media only screen and (min-width: 769px) {
@for $i from 1 through 8 { @for $i from 1 through 10 {
&:nth-child(#{$i}) { &:nth-child(#{$i}) {
@include animation('slide-in-down .25s #{$i * .1}s 1 ease both'); @include animation('slide-in-down .25s #{$i * .1}s 1 ease both');
} }
@ -356,7 +356,6 @@
color: themed('burger-menu-color'); color: themed('burger-menu-color');
@include on-event { @include on-event {
color: themed('navbar-title-hover-color'); color: themed('navbar-title-hover-color');
background-color: themed('navbar-background-color');
} }
} }

View File

@ -70,6 +70,7 @@
@include flexbox(); @include flexbox();
@include justify-content(center); @include justify-content(center);
@include align-items(flex-start);
&__desc { &__desc {
position: absolute; position: absolute;

View File

@ -19,6 +19,10 @@ hideSingleContentsWhenJSDisabled = false
enablePinnedPosts = true enablePinnedPosts = true
minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud minItemsToShowInTagCloud = 1 # Minimum items to show in tag cloud
# appbar
enableAppbarSearchIcon = false
enableAppbarLangIcon = false
# header # header
homeHeaderType = "text" # text, img, slide, typewriter homeHeaderType = "text" # text, img, slide, typewriter
hideHomeHeaderWhenMobile = false hideHomeHeaderWhenMobile = false

View File

@ -6,26 +6,22 @@
</div> </div>
</header> </header>
{{ $root := . }}
{{ if in (lower .Params.Mode) "one" }} {{ if in (lower .Params.Mode) "one" }}
<main class="gallery main"> <main class="gallery main">
<div class="grid gallery__container"> <div class="grid gallery__container">
<div class="grid-sizer"></div> <div class="grid-sizer"></div>
{{ if .File.Dir }} {{ $basename := (replace .File.Dir "\\" "/") }}
{{ $basename := (replace .File.Dir "\\" "/") }} {{ range .Params.Images }}
{{ range .Params.Images }} <div class="grid-item">
<div class="grid-item"> <img src="{{ $basename | relURL }}{{ .image }}" alt="{{ print .caption }}" />
<img src="{{ $basename | relURL }}{{ .image }}" alt="{{ print .caption }}" /> <div class="grid-item__desc hide">
<div class="grid-item__desc hide"> <span class="grid-item__desc--text">
<span class="grid-item__desc--text"> {{ .caption }}
{{ .caption }} </span>
</span>
</div>
</div> </div>
{{ end }} </div>
{{ end }} {{ end }}
</div> </div>
{{ partial "pagination/pagination-single" . }}
</main> </main>
{{ else if eq (lower .Params.mode) "remote" }} {{ else if eq (lower .Params.mode) "remote" }}
@ -43,28 +39,31 @@
</div> </div>
{{ end }} {{ end }}
</div> </div>
{{ partial "pagination/pagination-single" . }}
</main> </main>
{{ else }} {{ else }}
<main class="gallery main"> <main class="gallery main">
<div class="grid gallery__container"> <div class="grid gallery__container">
<div class="grid-sizer"></div> <div class="grid-sizer"></div>
{{ if .File.Dir }} {{ $basename := (replace .File.Dir "\\" "/") }}
{{ $basename := (replace .File.Dir "\\" "/") }} {{ $galleryFolderPath := (print "./static/" $basename) }}
{{ range (readDir (print "./static/" $basename)) }} {{ if (fileExists $galleryFolderPath) }}
<div class="grid-item"> {{ range readDir $galleryFolderPath }}
<img src="{{ $basename | relURL }}{{ .Name }}" alt="{{ index (split .Name ".") 0 }}"/> <div class="grid-item">
<div class="grid-item__desc hide"> <img src="{{ $basename | relURL }}{{ .Name }}" alt="{{ index (split .Name ".") 0 }}" />
<span class="grid-item__desc--text"> <div class="grid-item__desc hide">
{{ index (split .Name ".") 0 }} <span class="grid-item__desc--text">
</span> {{ index (split .Name ".") 0 }}
</span>
</div>
</div> </div>
</div>
{{ end }} {{ end }}
{{ else }}
<div class="basicflex">
Make a gallery folder first.
</div>
{{ end }} {{ end }}
</div> </div>
{{ partial "pagination/pagination-single" . }}
</main> </main>
{{ end }} {{ end }}

View File

@ -1,6 +1,6 @@
{{ if $.Param "enableLangChange" }} {{ if $.Param "enableLangChange" }}
<div class="dropdown"> <div class="dropdown">
<button class="dropdown-trigger" aria-label="Select Theme Button"> <button class="dropdown-trigger" aria-label="Select Language Button">
{{ partial "svgs/etc/translate.svg" (dict "width" 24 "height" 24) }} {{ partial "svgs/etc/translate.svg" (dict "width" 24 "height" 24) }}
</button> </button>
<div class="dropdown-content"> <div class="dropdown-content">

View File

@ -1099,7 +1099,7 @@
// ====================== mobile search ======================= // ====================== mobile search =======================
var mobileSearchInputElem = document.querySelector('#search-mobile'); var mobileSearchInputElem = document.querySelector('#search-mobile');
var mobileSearchClassElem = document.querySelector('.mobile-search'); var mobileSearchClassElem = document.querySelector('.mobile-search');
var mobileSearchBtnElem = document.querySelector('#mobileSearchBtn'); var mobileSearchBtnElems = document.querySelectorAll('.navbar-search');
var mobileSearchCloseBtnElem = document.querySelector('#search-mobile-close'); var mobileSearchCloseBtnElem = document.querySelector('#search-mobile-close');
var mobileSearchContainer = document.querySelector('#search-mobile-container'); var mobileSearchContainer = document.querySelector('#search-mobile-container');
var mobileSearchResultsElem = document.querySelector('#search-mobile-results'); var mobileSearchResultsElem = document.querySelector('#search-mobile-results');
@ -1109,19 +1109,21 @@
mobileSearchClassElem.style.display = 'none'; mobileSearchClassElem.style.display = 'none';
} }
mobileSearchBtnElem ? mobileSearchBtnElems ?
mobileSearchBtnElem.addEventListener('click', function () { mobileSearchBtnElems.forEach(function (elem, idx) {
if (mobileSearchContainer) { elem.addEventListener('click', function () {
mobileSearchContainer.style.display = 'block'; if (mobileSearchContainer) {
} mobileSearchContainer.style.display = 'block';
}
if (mobileSearchInputElem) { if (mobileSearchInputElem) {
mobileSearchInputElem.focus(); mobileSearchInputElem.focus();
} }
if (htmlElem) { if (htmlElem) {
htmlElem.style.overflowY = 'hidden'; htmlElem.style.overflowY = 'hidden';
} }
});
}) : null; }) : null;
mobileSearchCloseBtnElem ? mobileSearchCloseBtnElem ?

View File

@ -0,0 +1,28 @@
<div class="theme">
<div class="dropdown">
<button class="dropdown-trigger navbar__slide-down" aria-label="Select Language Button" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}">
{{ partial "svgs/etc/translate.svg" (dict "width" 22 "height" 22) }}
</button>
<div class="dropdown-content select-theme">
{{ $siteLanguages := .Site.Languages }}
{{ $pageLang := .Page.Lang }}
{{ range .Page.AllTranslations }}
{{ $translation := . }}
{{ range $siteLanguages }}
{{ if eq $translation.Lang .Lang }}
{{ $selected := false }}
{{ if eq $pageLang .Lang }}
{{ if .LanguageName }}
<a href="{{ $translation.Permalink }}" data-lang="{{ .Lang }}" class="dropdown-item select-theme__item is-active">{{ .LanguageName }}</a>
{{ end }}
{{ else }}
{{ if .LanguageName }}
<a href="{{ $translation.Permalink }}" data-lang="{{ .Lang }}" class="dropdown-item ">{{ .LanguageName }}</a>
{{ end }}
{{ end }}
{{ end }}
{{ end }}
{{ end }}
</div>
</div>
</div>

View File

@ -1,4 +1,10 @@
<div class="navbar__menu"> <div class="navbar__menu">
{{ if $.Site.Params.enableAppbarSearchIcon }}
{{ partial "navbar/search-icon" . }}
{{ end }}
{{ if $.Site.Params.enableAppbarLangIcon }}
{{ partial "navbar/language-icon" . }}
{{ end }}
{{ partial "navbar/select-theme" . }} {{ partial "navbar/select-theme" . }}
{{ $current := . }} {{ $current := . }}
{{ range .Site.Menus.main }} {{ range .Site.Menus.main }}

View File

@ -0,0 +1,9 @@
<div class="theme">
<div class="dropdown">
<button class="dropdown-trigger navbar__slide-down navbar-search" aria-label="Search Button" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}">
{{ partial "svgs/etc/search.svg" (dict "width" 22 "height" 22) }}
</button>
<div class="dropdown-content select-theme">
</div>
</div>
</div>

View File

@ -20,11 +20,8 @@
<ul class="pagination"> <ul class="pagination">
{{ range $pag.Pagers }} {{ range $pag.Pagers }}
{{ $cur := .PageNumber }} {{ $cur := .PageNumber }}
<script>
</script>
{{ if in ($.Scratch.Get "show") $cur }} {{ if in ($.Scratch.Get "show") $cur }}
<li <li {{ if eq . $pag }}class="active"{{ end }}><a href="{{ .URL }}">{{ .PageNumber }}</a></li>
{{ if eq . $pag }}class="active"{{ end }}><a href="{{ .URL }}">{{ .PageNumber }}</a></li>
{{ else if in (slice 2 (sub $total 1)) $cur }} {{ else if in (slice 2 (sub $total 1)) $cur }}
<li class="disabled"><a name="">&hellip;</a></li> <li class="disabled"><a name="">&hellip;</a></li>
{{ end }} {{ end }}

View File

@ -1,5 +1,5 @@
{{ if $.Param "enableSearch" }} {{ if $.Param "enableSearch" }}
<div id="mobileSearchBtn" class="mobile-search__btn" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}"> <div class="mobile-search__btn navbar-search" data-ani="{{ $.Site.Params.enableUiAnimation | default "true" }}">
{{ partial "svgs/etc/search.svg" (dict "width" 22 "height" 22) }} {{ partial "svgs/etc/search.svg" (dict "width" 22 "height" 22) }}
</div> </div>