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

Fixed b2t to work on all schemes. #552

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ sidebar:

# Sidebar offset from top menubar in pixels (only for Pisces | Gemini).
offset: 12
# Back to top in sidebar (only for Pisces | Gemini).
# Back to top in sidebar.
b2t: false
# Scroll percent label in b2t button.
scrollpercent: false
Expand Down
41 changes: 21 additions & 20 deletions layout/_layout.swig
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,31 @@
{% endif %}
</div>

{% include '_scripts/vendors.swig' %}
{% include '_scripts/commons.swig' %}
{{ partial('_scripts/vendors.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_scripts/commons.swig', {}, {cache: theme.cache.enable}) }}

{% set scheme_script = '_scripts/schemes/' + theme.scheme | lower + '.swig' %}
{% include scheme_script %}
{{ partial(scheme_script, {}, {cache: theme.cache.enable}) }}

{% block script_extra %}{% endblock %}

{% include '_scripts/boostrap.swig' %}

{% include '_third-party/comments/index.swig' %}
{% include '_third-party/search/index.swig' %}
{% include '_third-party/analytics/lean-analytics.swig' %}
{% include '_third-party/analytics/firestore.swig' %}
{% include '_third-party/seo/baidu-push.swig' %}
{% include '_third-party/schedule.swig' %}
{% include '_third-party/math/index.swig' %}
{% include '_third-party/needsharebutton.swig' %}
{% include '_third-party/rating.swig' %}
{% include '_third-party/pangu.swig' %}
{% include '_third-party/scroll-cookie.swig' %}
{% include '_third-party/exturl.swig' %}
{% include '_third-party/bookmark.swig' %}
{% include '_third-party/copy-code.swig' %}
{% include '_third-party/pdf.swig' %}
{{ partial('_scripts/boostrap.swig', {}, {cache: theme.cache.enable}) }}

{{ partial('_third-party/comments/index.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/search/index.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/analytics/lean-analytics.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/analytics/firestore.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/seo/baidu-push.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/schedule.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/math/index.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/needsharebutton.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/rating.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/pangu.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/scroll-cookie.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/exturl.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/bookmark.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/copy-code.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_third-party/pdf.swig', {}, {cache: theme.cache.enable}) }}

</body>
</html>
5 changes: 2 additions & 3 deletions layout/_macro/sidebar.swig → layout/_partials/sidebar.swig
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{% macro render(is_post) %}
<div class="sidebar-toggle">
<div class="sidebar-toggle-line-wrap">
<span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
Expand All @@ -13,7 +12,7 @@
{% endif %}
<div class="sidebar-inner">

{% set display_toc = is_post and theme.toc.enable or is_page and theme.toc.enable %}
{% set display_toc = is_post and theme.toc.enable %}

{% if display_toc and toc(page.content).length > 1 %}
<ul class="sidebar-nav motion-element">
Expand Down Expand Up @@ -84,6 +83,7 @@
{% if hasTagsPage %}</a>{% endif %}
</div>
{% endif %}

</nav>
{% endif %}

Expand Down Expand Up @@ -186,4 +186,3 @@

</div>
</aside>
{% endmacro %}
3 changes: 1 addition & 2 deletions layout/archive.swig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends '_layout.swig' %}
{% import '_macro/post-collapse.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ __('title.archive') }} | {{ title }}{% endblock %}

Expand Down Expand Up @@ -60,5 +59,5 @@
{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(false) }}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{% endblock %}
3 changes: 1 addition & 2 deletions layout/category.swig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends '_layout.swig' %}
{% import '_macro/post-collapse.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ __('title.category') }}: {{ page.category }} | {{ title }}{% endblock %}

Expand Down Expand Up @@ -34,5 +33,5 @@
{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(false) }}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{% endblock %}
3 changes: 1 addition & 2 deletions layout/index.swig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends '_layout.swig' %}
{% import '_macro/post.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ title }}{% if theme.index_with_subtitle and subtitle %} – {{ subtitle }}{% endif %}{% endblock %}

Expand All @@ -19,5 +18,5 @@
{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(false) }}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{% endblock %}
3 changes: 1 addition & 2 deletions layout/page.swig
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{% extends '_layout.swig' %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{#
#}{% set page_title_suffix = ' | ' + title %}{#
Expand Down Expand Up @@ -79,7 +78,7 @@
{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(false) }}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{% endblock %}

{% block script_extra %}
Expand Down
7 changes: 1 addition & 6 deletions layout/post.swig
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
{% extends '_layout.swig' %}
{% import '_macro/post.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}


{% block title %}{{ page.title }} | {{ title }}{% endblock %}

{% block page_class %}page-post-detail{% endblock %}


{% block content %}

<div id="posts" class="posts-expand">
{{ post_template.render(page) }}
</div>

{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(true) }}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{% endblock %}

{% block script_extra %}
Expand Down
3 changes: 1 addition & 2 deletions layout/tag.swig
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{% extends '_layout.swig' %}
{% import '_macro/post-collapse.swig' as post_template %}
{% import '_macro/sidebar.swig' as sidebar_template %}

{% block title %}{{ __('title.tag') }}: {{ page.tag }} | {{ title }}{% endblock %}

Expand Down Expand Up @@ -33,5 +32,5 @@
{% endblock %}

{% block sidebar %}
{{ sidebar_template.render(false) }}
{{ partial('_partials/sidebar.swig', {}, {cache: theme.cache.enable}) }}
{% endblock %}
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,7 +1,7 @@
.back-to-top {
visibility: hidden;
margin: (20px - $sidebar-offset) -10px -20px;
background: $body-bg-color;
background: $b2t-bg-color;
font-size: $b2t-font-size;
opacity: $b2t-opacity;
cursor: pointer;
Expand Down
3 changes: 3 additions & 0 deletions source/css/_variables/Gemini.styl
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ $border-radius-inner = initial
$border-radius = initial
//$border-radius-inner = 0 0 3px 3px;
//$border-radius = 3px;

// Back to top
$b2t-bg-color = $body-bg-color
2 changes: 1 addition & 1 deletion source/css/_variables/Pisces.styl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// --------------------------------------------------
$body-bg-color = #f5f7f9

$sidebar-offset = unit(hexo-config('sidebar.offset'), px) if hexo-config('sidebar.offset') is a 'unit'
$sidebar-width = hexo-config('sidebar.width') is a 'unit' ? hexo-config('sidebar.width') : 240
$sidebar-desktop = unit($sidebar-width, 'px')
$content-wrap = 'calc(100% - %s)' % unit($sidebar-width + $sidebar-offset, 'px')
Expand Down Expand Up @@ -77,3 +76,4 @@ $btn-default-hover-bg = $black-deep
$b2t-opacity = .6
$b2t-position-bottom = -100px
$b2t-position-bottom-on = 30px
$b2t-bg-color = $body-bg-color
1 change: 1 addition & 0 deletions source/css/_variables/base.styl
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ $posts-collapse-left-mobile = 5px
// Sidebar
// Variables for sidebar section elements.
// --------------------------------------------------
$sidebar-offset = unit(hexo-config('sidebar.offset'), px) if hexo-config('sidebar.offset') is a 'unit'
$sidebar-nav-color = $black-light
$sidebar-nav-hover-color = $whitesmoke
$sidebar-highlight = $blue-bright
Expand Down