Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and enhancements. [13] #1898

Merged
merged 57 commits into from
Sep 30, 2017
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
742d1ca
Merge pull request #22 from iissnan/master
ivan-nginx Sep 12, 2017
028fe60
MOD: move `getContentHeight` to variable.
ivan-nginx Sep 12, 2017
43dd4b4
FIX: jumping affix if sidebar taller then content.
ivan-nginx Sep 12, 2017
61086aa
MOD: rename `getContentHeight` function.
ivan-nginx Sep 12, 2017
619c49e
ADD: scrolling to active TOC if TOC > viewport.
ivan-nginx Sep 23, 2017
9ce276f
FIX: sidebar with `motion` on Mist & Muse schemes.
ivan-nginx Sep 23, 2017
e75a2a1
ADD: sidebar scrollable in all schemes [1].
ivan-nginx Sep 23, 2017
334e50e
ADD: sidebar scrollable in all schemes [2].
ivan-nginx Sep 23, 2017
59209cf
ADD: sidebar scrollable in all schemes [3].
ivan-nginx Sep 23, 2017
a8344d8
FIX: sidebar scrollable in all schemes [4].
ivan-nginx Sep 23, 2017
af067cd
ADD: sidebar scrollable in all schemes [5].
ivan-nginx Sep 23, 2017
65cb162
ADD: sidebar scrollable in all schemes [6].
ivan-nginx Sep 23, 2017
d23c0e0
ADD: sidebar scrollable in all schemes [7].
ivan-nginx Sep 23, 2017
0f27b0c
ADD: sidebar scrollable in all schemes [8].
ivan-nginx Sep 23, 2017
fd91285
ADD: sidebar scrollable in all schemes [9].
ivan-nginx Sep 23, 2017
e3d06b2
ADD: sidebar scrollable in all schemes [10].
ivan-nginx Sep 23, 2017
ef7905d
Merge branch 'master' into master
ivan-nginx Sep 23, 2017
cd92796
MOD: sidebar scrollable in all schemes [11].
ivan-nginx Sep 23, 2017
77b5a30
FIX: sidebar scrollable in all schemes [12].
ivan-nginx Sep 23, 2017
dca0ff4
FIX: sidebar scrollable in all schemes [13].
ivan-nginx Sep 23, 2017
920bd39
ADD: sidebar scrollable in all schemes [14].
ivan-nginx Sep 23, 2017
a0914e8
FIX: sidebar scrollable in all schemes [15].
ivan-nginx Sep 23, 2017
267109c
FIX: sidebar scrollable in all schemes [16].
ivan-nginx Sep 23, 2017
2f2e816
MOD: Enhancements to Gemini scheme [1].
ivan-nginx Sep 24, 2017
3a1b4c0
ADD: Enhancements to Gemini scheme [2].
ivan-nginx Sep 24, 2017
beb52f8
FIX: tabbed code block padding style [1].
ivan-nginx Sep 24, 2017
d433afd
FIX: tabbed code block padding style [2].
ivan-nginx Sep 24, 2017
41ff452
MOD: post more link margin-top refactor.
ivan-nginx Sep 24, 2017
b9243d9
FIX: site state items padding for Pisces & Gemini.
ivan-nginx Sep 24, 2017
7226ad4
MOD: Enhancements to Gemini scheme [3].
ivan-nginx Sep 24, 2017
87fa64e
MOD: Enhancements to Gemini scheme [4].
ivan-nginx Sep 24, 2017
cc2deca
Update readme. [skip ci]
ivan-nginx Sep 25, 2017
45d6254
Update readme [2]. [skip ci]
ivan-nginx Sep 25, 2017
74c34c9
FIX: sidebar scrollable in all schemes [17].
ivan-nginx Sep 28, 2017
42777af
FIX: sidebar scrollable in all schemes [18].
ivan-nginx Sep 28, 2017
7083a9d
FIX: sidebar scrollable in all schemes [19].
ivan-nginx Sep 28, 2017
1a6e24c
FIX: sidebar scrollable in all schemes [20].
ivan-nginx Sep 28, 2017
22569da
FIX: sidebar scrollable in all schemes [21].
ivan-nginx Sep 28, 2017
1280837
FIX: sidebar scrollable in all schemes [22].
ivan-nginx Sep 28, 2017
fa871de
FIX: sidebar scrollable in all schemes [23].
ivan-nginx Sep 28, 2017
11c5d1c
FIX: sidebar scrollable in all schemes [24].
ivan-nginx Sep 28, 2017
867fdbd
FIX: sidebar scrollable in all schemes [25].
ivan-nginx Sep 28, 2017
c2c2834
FIX: sidebar scrollable in all schemes [26].
ivan-nginx Sep 28, 2017
d8543f8
FIX: comments block only show if comments present.
ivan-nginx Sep 28, 2017
abb1424
FIX: comments block show if comments present [2].
ivan-nginx Sep 28, 2017
031244b
ADD: responsive favicons options [1].
ivan-nginx Sep 28, 2017
685b0ee
FIX: responsive favicons options [2].
ivan-nginx Sep 28, 2017
f406902
ADD: responsive favicons options [3].
ivan-nginx Sep 28, 2017
2ca6c06
ADD: responsive favicons options [4].
ivan-nginx Sep 28, 2017
0ed5ec9
FIX: Enhancements to Gemini scheme [5].
ivan-nginx Sep 29, 2017
00f7b64
ADD: Enhancements to Gemini scheme [6].
ivan-nginx Sep 29, 2017
36a3e31
MOD: Enhancements to Gemini scheme [7].
ivan-nginx Sep 29, 2017
7b41c6a
MOD: Enhancements to Gemini scheme [8].
ivan-nginx Sep 29, 2017
a558d60
ADD: Post custom copyright feature.
ivan-nginx Sep 30, 2017
9c33832
Update version to 5.1.3 [1].
ivan-nginx Sep 30, 2017
3a2f34d
Update version to 5.1.3 [2].
ivan-nginx Sep 30, 2017
88c3904
Update version to 5.1.3 [3].
ivan-nginx Sep 30, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ toc:
#creative_commons:

sidebar:
# Sidebar Position, available value: left | right
# Sidebar Position, available value: left | right (only for Pisces | Gemini).
position: left
#position: right

# Sidebar Display, available value:
# Sidebar Display, available value (only for Muse | Mist):
# - post expand on posts automatically. Default.
# - always expand for all pages automatically
# - hide expand only when click on the sidebar toggle icon.
Expand All @@ -152,17 +152,16 @@ sidebar:
#display: hide
#display: remove

# Sidebar offset from top menubar in pixels.
# Sidebar offset from top menubar in pixels (only for Pisces | Gemini).
offset: 12
offset_float: 12

# Back to top in sidebar
# Back to top in sidebar (only for Pisces | Gemini).
b2t: false

# Scroll percent label in b2t button
# Scroll percent label in b2t button.
scrollpercent: false

# Enable sidebar on narrow view
# Enable sidebar on narrow view (only for Muse | Mist).
onmobile: false


Expand Down
197 changes: 99 additions & 98 deletions layout/_macro/sidebar.swig
Original file line number Diff line number Diff line change
Expand Up @@ -17,125 +17,126 @@

{% if display_toc and toc(page.content).length > 1 %}
<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
<li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
{{ __('sidebar.toc') }}
</li>
<li class="sidebar-nav-overview" data-target="site-overview">
<li class="sidebar-nav-overview" data-target="site-overview-wrap">
{{ __('sidebar.overview') }}
</li>
</ul>
{% endif %}

<section class="site-overview sidebar-panel{% if not display_toc or toc(page.content).length <= 1 %} sidebar-panel-active{% endif %}">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
{% if theme.avatar %}
<img class="site-author-image" itemprop="image"
src="{{ url_for( theme.avatar | default(theme.images + '/avatar.gif') ) }}"
alt="{{ theme.author }}" />
{% endif %}
<p class="site-author-name" itemprop="name">{{ theme.author }}</p>
<p class="site-description motion-element" itemprop="description">{#
#}{% if theme.seo %}{#
#}{{ theme.signature }}{#
#}{% else %}{#
#}{{ theme.description }}{#
#}{% endif %}{#
#}</p>
</div>
<section class="site-overview-wrap sidebar-panel{% if not display_toc or toc(page.content).length <= 1 %} sidebar-panel-active{% endif %}">
<div class="site-overview">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
{% if theme.avatar %}
<img class="site-author-image" itemprop="image"
src="{{ url_for( theme.avatar | default(theme.images + '/avatar.gif') ) }}"
alt="{{ theme.author }}" />
{% endif %}
<p class="site-author-name" itemprop="name">{{ theme.author }}</p>
<p class="site-description motion-element" itemprop="description">{#
#}{% if theme.seo %}{#
#}{{ theme.signature }}{#
#}{% else %}{#
#}{{ theme.description }}{#
#}{% endif %}{#
#}</p>
</div>

<nav class="site-state motion-element">
<nav class="site-state motion-element">

{% if config.archive_dir != '/' and site.posts.length > 0 %}
<div class="site-state-item site-state-posts">
{% if theme.menu.archives %}
<a href="{{ url_for(theme.menu.archives).split('||')[0] | trim }}">
{% else %}
<a href="{{ url_for(config.archive_dir) }}">
{% endif %}
<span class="site-state-item-count">{{ site.posts.length }}</span>
<span class="site-state-item-name">{{ __('state.posts') }}</span>
</a>
</div>
{% endif %}

{% if config.archive_dir != '/' and site.posts.length > 0 %}
<div class="site-state-item site-state-posts">
{% if theme.menu.archives %}
<a href="{{ url_for(theme.menu.archives).split('||')[0] | trim }}">
{% else %}
<a href="{{ url_for(config.archive_dir) }}">
{% if site.categories.length > 0 %}
{% set categoriesPageQuery = site.pages.find({type: 'categories'}, {lean: true}) %}
{% set hasCategoriesPage = categoriesPageQuery.length > 0 %}
<div class="site-state-item site-state-categories">
{% if hasCategoriesPage %}<a href="{{ url_for(categoriesPageQuery[0].path) }}">{% endif %}
<span class="site-state-item-count">{{ site.categories.length }}</span>
<span class="site-state-item-name">{{ __('state.categories') }}</span>
{% if hasCategoriesPage %}</a>{% endif %}
</div>
{% endif %}

{% if site.tags.length > 0 %}
{% set tagsPageQuery = site.pages.find({type: 'tags'}, {lean: true}) %}
{% set hasTagsPage = tagsPageQuery.length > 0 %}
<div class="site-state-item site-state-tags">
{% if hasTagsPage %}<a href="{{ url_for(tagsPageQuery[0].path) }}">{% endif %}
<span class="site-state-item-count">{{ site.tags.length }}</span>
<span class="site-state-item-name">{{ __('state.tags') }}</span>
{% if hasTagsPage %}</a>{% endif %}
</div>
{% endif %}
<span class="site-state-item-count">{{ site.posts.length }}</span>
<span class="site-state-item-name">{{ __('state.posts') }}</span>

</nav>

{% if theme.rss %}
<div class="feed-link motion-element">
<a href="{{ url_for(theme.rss) }}" rel="alternate">
<i class="fa fa-rss"></i>
RSS
</a>
</div>
{% endif %}

{% if site.categories.length > 0 %}
{% set categoriesPageQuery = site.pages.find({type: 'categories'}, {lean: true}) %}
{% set hasCategoriesPage = categoriesPageQuery.length > 0 %}
<div class="site-state-item site-state-categories">
{% if hasCategoriesPage %}<a href="{{ url_for(categoriesPageQuery[0].path) }}">{% endif %}
<span class="site-state-item-count">{{ site.categories.length }}</span>
<span class="site-state-item-name">{{ __('state.categories') }}</span>
{% if hasCategoriesPage %}</a>{% endif %}
<div class="links-of-author motion-element">
{% if theme.social %}
{% for name, link in theme.social %}
<span class="links-of-author-item">
<a href="{{ link.split('||')[0] | trim }}" target="_blank" title="{{ name }}">
{% if theme.social_icons.enable %}
<i class="fa fa-fw fa-{{ link.split('||')[1] | trim | default('globe') }}"></i>{#
#}{% endif %}{#
#}{% if not theme.social_icons.icons_only %}{#
#}{{ name }}{#
#}{% endif %}{#
#}</a>
</span>
{% endfor %}
{% endif %}
</div>

{% set cc = {'by': 1, 'by-nc': 1, 'by-nc-nd': 1, 'by-nc-sa': 1, 'by-nd': 1, 'by-sa': 1, 'zero': 1} %}
{% if theme.creative_commons in cc %}
<div class="cc-license motion-element" itemprop="license">
<a href="https://creativecommons.org/{% if theme.creative_commons === 'zero' %}publicdomain/zero/1.0{% else %}licenses/{{ theme.creative_commons }}/4.0{% endif %}/" class="cc-opacity" target="_blank">
<img src="{{ url_for(theme.images) }}/cc-{{ theme.creative_commons }}.svg" alt="Creative Commons" />
</a>
</div>
{% endif %}

{% if site.tags.length > 0 %}
{% set tagsPageQuery = site.pages.find({type: 'tags'}, {lean: true}) %}
{% set hasTagsPage = tagsPageQuery.length > 0 %}
<div class="site-state-item site-state-tags">
{% if hasTagsPage %}<a href="{{ url_for(tagsPageQuery[0].path) }}">{% endif %}
<span class="site-state-item-count">{{ site.tags.length }}</span>
<span class="site-state-item-name">{{ __('state.tags') }}</span>
{% if hasTagsPage %}</a>{% endif %}
{# Blogroll #}
{% if theme.links %}
<div class="links-of-blogroll motion-element {{ "links-of-blogroll-" + theme.links_layout | default('inline') }}">
<div class="links-of-blogroll-title">
<i class="fa fa-fw fa-{{ theme.links_icon | default('globe') | lower }}"></i>
{{ theme.links_title }}
</div>
<ul class="links-of-blogroll-list">
{% for name, link in theme.links %}
<li class="links-of-blogroll-item">
<a href="{{ link }}" title="{{ name }}" target="_blank">{{ name }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}

</nav>

{% if theme.rss %}
<div class="feed-link motion-element">
<a href="{{ url_for(theme.rss) }}" rel="alternate">
<i class="fa fa-rss"></i>
RSS
</a>
</div>
{% endif %}

<div class="links-of-author motion-element">
{% if theme.social %}
{% for name, link in theme.social %}
<span class="links-of-author-item">
<a href="{{ link.split('||')[0] | trim }}" target="_blank" title="{{ name }}">
{% if theme.social_icons.enable %}
<i class="fa fa-fw fa-{{ link.split('||')[1] | trim | default('globe') }}"></i>{#
#}{% endif %}{#
#}{% if not theme.social_icons.icons_only %}{#
#}{{ name }}{#
#}{% endif %}{#
#}</a>
</span>
{% endfor %}
{% endif %}
{% include '../_custom/sidebar.swig' %}
</div>

{% set cc = {'by': 1, 'by-nc': 1, 'by-nc-nd': 1, 'by-nc-sa': 1, 'by-nd': 1, 'by-sa': 1, 'zero': 1} %}
{% if theme.creative_commons in cc %}
<div class="cc-license motion-element" itemprop="license">
<a href="https://creativecommons.org/{% if theme.creative_commons === 'zero' %}publicdomain/zero/1.0{% else %}licenses/{{ theme.creative_commons }}/4.0{% endif %}/" class="cc-opacity" target="_blank">
<img src="{{ url_for(theme.images) }}/cc-{{ theme.creative_commons }}.svg" alt="Creative Commons" />
</a>
</div>
{% endif %}

{# Blogroll #}
{% if theme.links %}
<div class="links-of-blogroll motion-element {{ "links-of-blogroll-" + theme.links_layout | default('inline') }}">
<div class="links-of-blogroll-title">
<i class="fa fa-fw fa-{{ theme.links_icon | default('globe') | lower }}"></i>
{{ theme.links_title }}
</div>
<ul class="links-of-blogroll-list">
{% for name, link in theme.links %}
<li class="links-of-blogroll-item">
<a href="{{ link }}" title="{{ name }}" target="_blank">{{ name }}</a>
</li>
{% endfor %}
</ul>
</div>
{% endif %}

{% include '../_custom/sidebar.swig' %}

</section>

{% if display_toc and toc(page.content).length > 1 %}
Expand Down
2 changes: 1 addition & 1 deletion source/css/_common/components/back-to-top-sidebar.styl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.back-to-top {
display: none;
margin: 15px -10px -20px;
margin: 20px -10px -20px;
background: $body-bg-color;
font-size: $b2t-font-size;
opacity: $b2t-opacity;
Expand Down
9 changes: 9 additions & 0 deletions source/css/_common/components/sidebar/sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@
text-align: center;
}

.site-overview-wrap {
overflow: hidden;
}

.site-overview {
overflow-y: auto;
overflow-x: hidden;
}

@import "sidebar-toggle";
@import "sidebar-author";
@import "site-state";
Expand Down
8 changes: 7 additions & 1 deletion source/css/_schemes/Pisces/_sidebar.styl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


.sidebar-inner {
//padding: 20px 10px 0;
box-sizing: border-box;
width: 240px;
color: $text-color;
Expand All @@ -21,8 +22,13 @@

&.affix {
position: fixed;
top: $sidebar-offset-float;
top: $sidebar-offset;
}

&.affix-bottom {
position: absolute;
}

}

.site-overview {
Expand Down
2 changes: 1 addition & 1 deletion source/css/_variables/Pisces.styl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ $subtitle-color = $gray-lighter

// Sidebar
// --------------------------------------------------
$sidebar-offset-float = unit(hexo-config('sidebar.offset_float'), px) if hexo-config('sidebar.offset_float') is a 'unit'
$sidebar-offset = unit(hexo-config('sidebar.offset'), px) if hexo-config('sidebar.offset') is a 'unit'

$sidebar-nav-hover-color = $orange
$sidebar-highlight = $orange
Expand Down
7 changes: 4 additions & 3 deletions source/js/src/motion.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,12 @@ $(document).ready(function () {
this.sidebarEl.removeClass('sidebar-active');
this.sidebarEl.trigger('sidebar.isHiding');

//在 post 页面下按下隐藏 sidebar 时如果当前选中的是“站点概览”,将 toc 去除 motion 效果
//防止再次打开时会出现在“站点概览”下的 bug
// Prevent adding TOC to Overview if Overview was selected when close & open sidebar.
if (!!$('.post-toc-wrap')) {
if ($('.site-overview').css('display') === 'block') {
if ($('.site-overview-wrap').css('display') === 'block') {
$('.post-toc-wrap').removeClass('motion-element');
} else {
$('.post-toc-wrap').addClass('motion-element');
}
}
}
Expand Down
Loading