From 38483bfa2532e1e3fdeac82f1214f797d9501d88 Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 24 Aug 2019 11:36:16 +0800 Subject: [PATCH 1/7] Update --- .../components/highlight/copy-code.styl | 6 ----- .../components/highlight/highlight.styl | 2 +- source/css/_common/scaffolding/mobile.styl | 26 ++++--------------- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/source/css/_common/components/highlight/copy-code.styl b/source/css/_common/components/highlight/copy-code.styl index 6ac99e5991..91e3c727b5 100644 --- a/source/css/_common/components/highlight/copy-code.styl +++ b/source/css/_common/components/highlight/copy-code.styl @@ -48,7 +48,6 @@ if (hexo-config('codeblock.copy_button.style') == 'mac') { background: #21252b; border-radius: 5px; box-shadow: 0 10px 30px 0 rgba(0, 0, 0, .4); - margin-bottom: 1.6em; padding-top: 30px; &::before { @@ -63,9 +62,4 @@ if (hexo-config('codeblock.copy_button.style') == 'mac') { width: 12px; } } - - .highlight { - // border-radius: 0 0 5px 5px; - margin: 0 !important; - } } diff --git a/source/css/_common/components/highlight/highlight.styl b/source/css/_common/components/highlight/highlight.styl index c071c6a9f3..2999b201b7 100644 --- a/source/css/_common/components/highlight/highlight.styl +++ b/source/css/_common/components/highlight/highlight.styl @@ -11,7 +11,7 @@ $code-block { background: $highlight-background; color: $highlight-foreground; line-height: $line-height-code-block; - margin: 20px 0; + margin: 0 auto 20px; } pre, code { diff --git a/source/css/_common/scaffolding/mobile.styl b/source/css/_common/scaffolding/mobile.styl index ebfe300446..a365f10718 100644 --- a/source/css/_common/scaffolding/mobile.styl +++ b/source/css/_common/scaffolding/mobile.styl @@ -1,24 +1,10 @@ /* -// > 1600px -+desktop-large() { - -} - -// > 992px -+desktop() { - -} - -// > 768px & < 991px -+tablet() { - -} - // < 767px +mobile() { } */ + +mobile-small() { // For Pisces & Gemini schemes only wider width (remove main blocks in Gemini). .content-wrap { @@ -59,9 +45,12 @@ } } + > * { + margin-bottom: 10px !important; + } + // For paragraphs narrow width. > p { - margin: 0 0 10px 0; padding: 0 18px; } @@ -90,12 +79,7 @@ padding: 0 5px; } - iframe, img, video { - margin-bottom: 10px !important; - } - .note { - margin-bottom: 10px !important; padding: 10px !important; if (hexo-config('note.icons')) { From 159c48ed9670aa646d0c72a8f3c44f057efbe43e Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 24 Aug 2019 12:37:48 +0800 Subject: [PATCH 2/7] Update --- source/js/algolia-search.js | 3 +-- source/js/local-search.js | 3 +-- source/js/schemes/muse.js | 2 +- source/js/schemes/pisces.js | 2 +- source/js/utils.js | 18 +++--------------- 5 files changed, 7 insertions(+), 21 deletions(-) diff --git a/source/js/algolia-search.js b/source/js/algolia-search.js index 18c25ea5f0..07966d8236 100644 --- a/source/js/algolia-search.js +++ b/source/js/algolia-search.js @@ -102,8 +102,7 @@ window.addEventListener('DOMContentLoaded', () => { document.querySelector('.popup-btn-close').addEventListener('click', onPopupClose); window.addEventListener('pjax:success', onPopupClose); window.addEventListener('keyup', event => { - let shouldDismissSearchPopup = event.which === 27 && document.querySelector('.popup').isVisible(); - if (shouldDismissSearchPopup) { + if (event.which === 27) { onPopupClose(); } }); diff --git a/source/js/local-search.js b/source/js/local-search.js index 505d461c9b..4ae5e40ed9 100644 --- a/source/js/local-search.js +++ b/source/js/local-search.js @@ -316,8 +316,7 @@ window.addEventListener('DOMContentLoaded', () => { document.querySelector('.popup-btn-close').addEventListener('click', onPopupClose); window.addEventListener('pjax:success', onPopupClose); window.addEventListener('keyup', event => { - let shouldDismissSearchPopup = event.which === 27 && document.querySelector('.popup').isVisible(); - if (shouldDismissSearchPopup) { + if (event.which === 27) { onPopupClose(); } }); diff --git a/source/js/schemes/muse.js b/source/js/schemes/muse.js index 8a3bdef49b..729bb99c6d 100644 --- a/source/js/schemes/muse.js +++ b/source/js/schemes/muse.js @@ -205,7 +205,7 @@ window.addEventListener('DOMContentLoaded', () => { sidebarToggleMotion.init(); function updateFooterPosition() { - var containerHeight = document.querySelector('.container').height(); + var containerHeight = document.querySelector('.container').offsetHeight; var footer = document.getElementById('footer'); if (footer.getAttribute('position')) containerHeight += footer.outerHeight(true); if (containerHeight < window.innerHeight) { diff --git a/source/js/schemes/pisces.js b/source/js/schemes/pisces.js index 695ef06e6f..a9207b388f 100644 --- a/source/js/schemes/pisces.js +++ b/source/js/schemes/pisces.js @@ -94,7 +94,7 @@ window.addEventListener('DOMContentLoaded', () => { const sidebarOffset = CONFIG.sidebar.offset || 12; const sidebarInner = document.querySelector('.sidebar-inner'); - const getHeaderOffset = () => document.querySelector('.header-inner').height() + sidebarOffset; + const getHeaderOffset = () => document.querySelector('.header-inner').offsetHeight + sidebarOffset; const getFooterOffset = () => { let footer = document.querySelector('#footer'); diff --git a/source/js/utils.js b/source/js/utils.js index 1cf72275d8..37009ecbbc 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -1,17 +1,5 @@ /* global NexT, CONFIG */ -HTMLElement.prototype.isVisible = function() { - return window.getComputedStyle(this).display !== 'none'; -}; - -HTMLElement.prototype.width = function() { - return parseFloat(window.getComputedStyle(this).width); -}; - -HTMLElement.prototype.height = function() { - return parseFloat(window.getComputedStyle(this).height); -}; - HTMLElement.prototype.outerHeight = function(flag) { var height = this.offsetHeight; if (!flag) return height; @@ -136,7 +124,7 @@ NexT.utils = { $(window).on('load scroll', () => { var scrollPercent; if (backToTop || readingProgressBar) { - var docHeight = document.querySelector('.container').height(); + var docHeight = document.querySelector('.container').offsetHeight; var winHeight = window.innerHeight; var contentVisibilityHeight = docHeight > winHeight ? docHeight - winHeight : document.body.scrollHeight - winHeight; var scrollPercentRounded = Math.round(100 * window.scrollY / contentVisibilityHeight); @@ -312,12 +300,12 @@ NexT.utils = { var sidebarPadding = sidebarInner.innerWidth() - sidebarInner.width(); var sidebarNavHeight = $('.sidebar-nav').css('display') === 'block' ? $('.sidebar-nav').outerHeight(true) : 0; var sidebarOffset = CONFIG.sidebar.offset || 12; - var sidebarb2tHeight = CONFIG.back2top.enable && CONFIG.back2top.sidebar ? document.querySelector('.back-to-top').height() : sidebarOffset; + var sidebarb2tHeight = CONFIG.back2top.enable && CONFIG.back2top.sidebar ? document.querySelector('.back-to-top').offsetHeight : sidebarOffset; var sidebarSchemePadding = NexT.utils.isPisces() || NexT.utils.isGemini() ? (sidebarPadding * 2) + sidebarNavHeight + sidebarOffset + sidebarb2tHeight : (sidebarPadding * 2) + (sidebarNavHeight / 2); // Initialize Sidebar & TOC Height. - var sidebarWrapperHeight = document.body.clientHeight - sidebarSchemePadding; + var sidebarWrapperHeight = document.body.offsetHeight - sidebarSchemePadding; $('.site-overview-wrap, .post-toc-wrap').css('max-height', sidebarWrapperHeight); }, From e36fe19ee7a4c2cb77cdc4459507cd974ddc46aa Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 24 Aug 2019 13:06:59 +0800 Subject: [PATCH 3/7] Update --- scripts/tags/caniuse.js | 2 +- source/js/schemes/pisces.js | 19 ++++++++----------- source/js/utils.js | 2 +- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/scripts/tags/caniuse.js b/scripts/tags/caniuse.js index f34febfc51..1f5fc303cb 100644 --- a/scripts/tags/caniuse.js +++ b/scripts/tags/caniuse.js @@ -16,7 +16,7 @@ function caniUse(args) { return ''; } - return ``; + return ``; } hexo.extend.tag.register('caniuse', caniUse, {async: true}); diff --git a/source/js/schemes/pisces.js b/source/js/schemes/pisces.js index a9207b388f..d11c1ebb47 100644 --- a/source/js/schemes/pisces.js +++ b/source/js/schemes/pisces.js @@ -119,17 +119,14 @@ window.addEventListener('DOMContentLoaded', () => { }); }; - const resizeListener = () => { - window.matchMedia('(min-width: 992px)').addListener(event => { - if (event.matches) { - $(window).off('.affix'); - $('.sidebar-inner').removeData('bs.affix'); - sidebarInner.classList.remove('affix', 'affix-top', 'affix-bottom'); - initAffix(); - } - }); - }; + window.matchMedia('(min-width: 992px)').addListener(event => { + if (event.matches) { + $(window).off('.affix'); + $('.sidebar-inner').removeData('bs.affix'); + sidebarInner.classList.remove('affix', 'affix-top', 'affix-bottom'); + initAffix(); + } + }); initAffix(); - resizeListener(); }); diff --git a/source/js/utils.js b/source/js/utils.js index 37009ecbbc..703838817b 100644 --- a/source/js/utils.js +++ b/source/js/utils.js @@ -183,7 +183,7 @@ NexT.utils = { if ((typeof data === 'string') && (data.indexOf('ciu_embed') > -1)) { var featureID = data.split(':')[1]; var height = data.split(':')[2]; - document.querySelector(`iframe[data-feature=${featureID}]`).style.height = parseInt(height, 10) + 30 + 'px'; + document.querySelector(`iframe[data-feature=${featureID}]`).style.height = parseInt(height, 10) + 'px'; } }, false); }, From 469cc410754037270cb694d9656a9929464e98a8 Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 24 Aug 2019 14:07:23 +0800 Subject: [PATCH 4/7] Update --- source/js/next-boot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/js/next-boot.js b/source/js/next-boot.js index 3fc7da5ace..e11548a83e 100644 --- a/source/js/next-boot.js +++ b/source/js/next-boot.js @@ -73,7 +73,7 @@ NexT.boot.refresh = function() { NexT.utils.registerActiveMenuItem(); NexT.utils.registerSidebarTOC(); - $('table').not('.gist table').wrap('
'); + $(':not(.gist) table').wrap('
'); }; NexT.boot.motion = function() { From 57da0392cb9fffb3ddd071cb8e378631e251074f Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 24 Aug 2019 15:39:59 +0800 Subject: [PATCH 5/7] Update --- layout/_layout.swig | 2 +- layout/_macro/post.swig | 7 +----- layout/archive.swig | 2 -- layout/category.swig | 2 -- layout/index.swig | 4 ---- layout/page.swig | 2 -- layout/post.swig | 2 -- layout/tag.swig | 2 -- .../_common/components/post/post-expand.styl | 6 ++--- .../components/tags/group-pictures.styl | 21 +----------------- source/css/_common/scaffolding/mobile.styl | 10 +++++---- source/css/_common/scaffolding/tables.styl | 6 +---- ...posts-expanded.styl => _posts-expand.styl} | 22 ++++++++----------- source/css/_schemes/Mist/index.styl | 18 +-------------- 14 files changed, 22 insertions(+), 84 deletions(-) rename source/css/_schemes/Mist/{_posts-expanded.styl => _posts-expand.styl} (92%) diff --git a/layout/_layout.swig b/layout/_layout.swig index 5a8c65b700..3d0a99d075 100644 --- a/layout/_layout.swig +++ b/layout/_layout.swig @@ -38,7 +38,7 @@ {%- if theme.scheme === 'Pisces' || theme.scheme === 'Gemini' %} {% include '_partials/header/sub-menu.swig' %} {%- endif %} -
+
{% block content %}{% endblock %}
{% include '_partials/comments.swig' %} diff --git a/layout/_macro/post.swig b/layout/_macro/post.swig index e0bc414276..450e59655e 100644 --- a/layout/_macro/post.swig +++ b/layout/_macro/post.swig @@ -1,9 +1,4 @@ - {%- set post_class = 'post' %} - {%- if post.sticky > 0 %} - {%- set post_class = post_class + ' post-sticky' %} - {%- endif %} - -
+
{##################} {### POST BLOCK ###} {##################} diff --git a/layout/archive.swig b/layout/archive.swig index d2b4a1b6ef..ed49747ea8 100644 --- a/layout/archive.swig +++ b/layout/archive.swig @@ -4,8 +4,6 @@ {% block title %}{{ __('title.archive') }} | {{ title }}{% endblock %} -{% block page_class %}page-archive{% endblock %} - {% block content %} {#####################} diff --git a/layout/category.swig b/layout/category.swig index 6a718f4eba..3bf95ec1e1 100644 --- a/layout/category.swig +++ b/layout/category.swig @@ -10,7 +10,6 @@ {### CATEGORY BLOCK ###} {######################}
-
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="collection-header">{# @@ -21,7 +20,6 @@ {{ post_template.render(page.posts) }}
-
{##########################} {### END CATEGORY BLOCK ###} diff --git a/layout/index.swig b/layout/index.swig index 4fbfe62871..39c6f538e3 100644 --- a/layout/index.swig +++ b/layout/index.swig @@ -3,10 +3,6 @@ {% block title %}{{ title }}{%- if theme.index_with_subtitle and subtitle %} - {{ subtitle }}{%- endif %}{% endblock %} -{% block page_class %} - {%- if is_home() %}page-home{% endif -%} -{% endblock %} - {% block content %}
{%- for post in page.posts %} diff --git a/layout/page.swig b/layout/page.swig index 4bc30b3ab6..4698f0d6f7 100644 --- a/layout/page.swig +++ b/layout/page.swig @@ -15,8 +15,6 @@ #}{%- endif %}{# #}{% endblock %} -{% block page_class %}page-post-detail{% endblock %} - {% block content %}
diff --git a/layout/post.swig b/layout/post.swig index ba5132dea2..4a3a406983 100644 --- a/layout/post.swig +++ b/layout/post.swig @@ -3,8 +3,6 @@ {% block title %}{{ page.title }} | {{ title }}{% endblock %} -{% block page_class %}page-post-detail{% endblock %} - {% block content %}
diff --git a/layout/tag.swig b/layout/tag.swig index bcc902bacb..302a27b36c 100644 --- a/layout/tag.swig +++ b/layout/tag.swig @@ -10,7 +10,6 @@ {### TAG BLOCK ###} {#################}
-
<{%- if theme.seo %}h2{% else %}h1{%- endif %} class="collection-header">{# @@ -21,7 +20,6 @@ {{ post_template.render(page.posts) }}
-
{#####################} {### END TAG BLOCK ###} diff --git a/source/css/_common/components/post/post-expand.styl b/source/css/_common/components/post/post-expand.styl index cdac6a3b64..3f47768f0c 100644 --- a/source/css/_common/components/post/post-expand.styl +++ b/source/css/_common/components/post/post-expand.styl @@ -1,14 +1,12 @@ .posts-expand { padding-top: 40px; -} -+mobile() { - .posts-expand { + +mobile() { margin: 0 20px; } } -.posts-expand .post-body { +.post-body { +desktop() { text-align: unquote(hexo-config('text_align.desktop')); } diff --git a/source/css/_common/components/tags/group-pictures.styl b/source/css/_common/components/tags/group-pictures.styl index a19aba65ed..71caca067b 100644 --- a/source/css/_common/components/tags/group-pictures.styl +++ b/source/css/_common/components/tags/group-pictures.styl @@ -1,4 +1,4 @@ -.post .post-body .group-picture { +.post-body .group-picture { img { border: 0; box-sizing: border-box; @@ -16,22 +16,3 @@ float: left; margin-bottom: 10px; } - -.page-archive { - .group-picture-container { - overflow: hidden; - } - - .group-picture-row { - float: left; - - &:first-child { - margin-top: 6px; - } - } - - .group-picture-column { - max-height: 150px; - max-width: 150px; - } -} diff --git a/source/css/_common/scaffolding/mobile.styl b/source/css/_common/scaffolding/mobile.styl index a365f10718..1b77babdc4 100644 --- a/source/css/_common/scaffolding/mobile.styl +++ b/source/css/_common/scaffolding/mobile.styl @@ -45,12 +45,9 @@ } } - > * { - margin-bottom: 10px !important; - } - // For paragraphs narrow width. > p { + margin: 0 0 10px 0; padding: 0 18px; } @@ -79,7 +76,12 @@ padding: 0 5px; } + img, video { + margin-bottom: 10px !important; + } + .note { + margin-bottom: 10px !important; padding: 10px !important; if (hexo-config('note.icons')) { diff --git a/source/css/_common/scaffolding/tables.styl b/source/css/_common/scaffolding/tables.styl index 1900563e05..6cfb8729ba 100644 --- a/source/css/_common/scaffolding/tables.styl +++ b/source/css/_common/scaffolding/tables.styl @@ -1,17 +1,13 @@ .table-container { -webkit-overflow-scrolling: touch; - margin: 20px 0; overflow: auto; } -.highlight .table-container { - margin: 0; -} - table { border-collapse: collapse; border-spacing: 0; font-size: $table-font-size; + margin: 0 0 20px 0; width: $table-width; } diff --git a/source/css/_schemes/Mist/_posts-expanded.styl b/source/css/_schemes/Mist/_posts-expand.styl similarity index 92% rename from source/css/_schemes/Mist/_posts-expanded.styl rename to source/css/_schemes/Mist/_posts-expand.styl index 94206b6e41..2b6a0b8a1b 100644 --- a/source/css/_schemes/Mist/_posts-expanded.styl +++ b/source/css/_schemes/Mist/_posts-expand.styl @@ -1,16 +1,8 @@ -// Post Expanded +// Post Expand // -------------------------------------------------- .posts-expand { padding-top: 0; - .post-title, .post-meta { - text-align: $site-meta-text-align; - - +mobile() { - text-align: center; - } - } - .post-eof { display: none; } @@ -23,15 +15,19 @@ margin-top: 0; } + .post-title, .post-meta { + text-align: $site-meta-text-align; + + +mobile() { + text-align: center; + } + } + .post-meta { margin-bottom: 20px; margin-top: 5px; } - .post-title:hover::before { - background: $black-deep; - } - .post-body img { margin-left: 0; } diff --git a/source/css/_schemes/Mist/index.styl b/source/css/_schemes/Mist/index.styl index 57d50c2afc..045d9ac552 100644 --- a/source/css/_schemes/Mist/index.styl +++ b/source/css/_schemes/Mist/index.styl @@ -5,7 +5,7 @@ @import '_header'; @import '_logo'; @import '_menu'; -@import '_posts-expanded'; +@import '_posts-expand'; @import '../Muse/_sidebar'; // Components @@ -30,22 +30,6 @@ } } -// Page - Post details -// -------------------------------------------------- -.page-post-detail { - .post-title, .post-meta { - text-align: center; - } - - .post-title::before { - display: none; - } - - .post-meta { - margin-bottom: 60px; - } -} - // Pagination // -------------------------------------------------- .pagination { From 16b85996ffc78968e5c65519b694c9981498753d Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 24 Aug 2019 16:51:35 +0800 Subject: [PATCH 6/7] class --- layout/_macro/post-collapse.swig | 2 +- layout/_macro/post.swig | 4 +-- layout/_macro/sidebar.swig | 8 +++--- layout/_partials/sidebar/site-overview.swig | 2 +- layout/index.swig | 4 +-- .../components/post/post-collapse.styl | 2 +- source/css/_schemes/Mist/_posts-expand.styl | 25 +++++++++++-------- source/css/_schemes/Muse/_sidebar.styl | 8 ++++++ source/css/_schemes/Pisces/_sidebar.styl | 5 ---- source/js/next-boot.js | 18 +++++++------ source/js/schemes/muse.js | 21 ++++++++-------- 11 files changed, 53 insertions(+), 46 deletions(-) diff --git a/layout/_macro/post-collapse.swig b/layout/_macro/post-collapse.swig index 4404d5a58c..7a028cce67 100644 --- a/layout/_macro/post-collapse.swig +++ b/layout/_macro/post-collapse.swig @@ -11,7 +11,7 @@
{%- endif %} -
+
<{%- if theme.seo %}h3{% else %}h2{%- endif %} class="post-title"> diff --git a/layout/_macro/post.swig b/layout/_macro/post.swig index 450e59655e..651ac0b0d5 100644 --- a/layout/_macro/post.swig +++ b/layout/_macro/post.swig @@ -1,8 +1,8 @@ -
+
{##################} {### POST BLOCK ###} {##################} -
+
{%- if theme.site_state %} diff --git a/layout/index.swig b/layout/index.swig index 39c6f538e3..6af038c4cd 100644 --- a/layout/index.swig +++ b/layout/index.swig @@ -4,11 +4,11 @@ {% block title %}{{ title }}{%- if theme.index_with_subtitle and subtitle %} - {{ subtitle }}{%- endif %}{% endblock %} {% block content %} -
+
{%- for post in page.posts %} {{ partial('_macro/post.swig', {is_index: true}) }} {%- endfor %} -
+
{% include '_partials/pagination.swig' %} {% endblock %} diff --git a/source/css/_common/components/post/post-collapse.styl b/source/css/_common/components/post/post-collapse.styl index 30caac9774..df946feee0 100644 --- a/source/css/_common/components/post/post-collapse.styl +++ b/source/css/_common/components/post/post-collapse.styl @@ -53,7 +53,7 @@ } } - .post { + article { margin: 30px 0; } diff --git a/source/css/_schemes/Mist/_posts-expand.styl b/source/css/_schemes/Mist/_posts-expand.styl index 2b6a0b8a1b..2922878c15 100644 --- a/source/css/_schemes/Mist/_posts-expand.styl +++ b/source/css/_schemes/Mist/_posts-expand.styl @@ -1,5 +1,19 @@ // Post Expand // -------------------------------------------------- +.posts-expand .home { + .post-title, .post-meta { + text-align: $site-meta-text-align; + + +mobile() { + text-align: center; + } + } + + .post-meta { + margin: 0 0 20px 0; + } +} + .posts-expand { padding-top: 0; @@ -16,16 +30,7 @@ } .post-title, .post-meta { - text-align: $site-meta-text-align; - - +mobile() { - text-align: center; - } - } - - .post-meta { - margin-bottom: 20px; - margin-top: 5px; + text-align: center; } .post-body img { diff --git a/source/css/_schemes/Muse/_sidebar.styl b/source/css/_schemes/Muse/_sidebar.styl index 3d180b357f..7822a87f09 100644 --- a/source/css/_schemes/Muse/_sidebar.styl +++ b/source/css/_schemes/Muse/_sidebar.styl @@ -17,3 +17,11 @@ if (hexo-config('sidebar.position') == 'right') { left: $b2t-position-right; } } + +.sidebar { + display: none; + + &.sidebar-active { + display: block; + } +} diff --git a/source/css/_schemes/Pisces/_sidebar.styl b/source/css/_schemes/Pisces/_sidebar.styl index 230e3e1fe9..00d35aba2d 100644 --- a/source/css/_schemes/Pisces/_sidebar.styl +++ b/source/css/_schemes/Pisces/_sidebar.styl @@ -39,11 +39,6 @@ } } -.site-overview { - // margin: 0 2px; - text-align: left; -} - .site-author { clearfix(); } diff --git a/source/js/next-boot.js b/source/js/next-boot.js index e11548a83e..72089eb0ba 100644 --- a/source/js/next-boot.js +++ b/source/js/next-boot.js @@ -25,20 +25,22 @@ NexT.boot.registerEvents = function() { var item = $(event.currentTarget); var activeTabClassName = 'sidebar-nav-active'; var activePanelClassName = 'sidebar-panel-active'; - if (item.hasClass(activeTabClassName)) return; var target = $('.' + item.data('target')); + if (item.hasClass(activeTabClassName)) { + target.find('.motion-element').css({ opacity: 1 }); + return; + } var currentTarget = target.siblings('.sidebar-panel'); currentTarget.animate({ opacity: 0 }, TAB_ANIMATE_DURATION, () => { - currentTarget.hide(); + // Prevent adding TOC to Overview if Overview was selected when close & open sidebar. + currentTarget.removeClass(activePanelClassName); target .stop() - .css({ 'opacity': 0, 'display': 'block' }) - .animate({ opacity: 1 }, TAB_ANIMATE_DURATION, () => { - // Prevent adding TOC to Overview if Overview was selected when close & open sidebar. - currentTarget.removeClass(activePanelClassName, 'motion-element'); - target.addClass(activePanelClassName, 'motion-element'); - }); + .css({ opacity: 0 }) + .addClass(activePanelClassName) + .animate({ opacity: 1 }, TAB_ANIMATE_DURATION) + .find('.motion-element').css({ opacity: 1 }); }); item.siblings().removeClass(activeTabClassName); diff --git a/source/js/schemes/muse.js b/source/js/schemes/muse.js index 729bb99c6d..2b0019ae65 100644 --- a/source/js/schemes/muse.js +++ b/source/js/schemes/muse.js @@ -158,10 +158,9 @@ window.addEventListener('DOMContentLoaded', () => { var self = this; if (typeof $.Velocity === 'function') { - this.sidebarEl.stop().velocity({ + this.sidebarEl.addClass('sidebar-active').stop().velocity({ width: SIDEBAR_WIDTH }, { - display : 'block', duration: SIDEBAR_DISPLAY_DURATION, begin : function() { $.Velocity(document.querySelectorAll('.sidebar .motion-element:not(.site-state)'), isRight ? 'transition.slideRightIn' : 'transition.slideLeftIn', { @@ -175,17 +174,14 @@ window.addEventListener('DOMContentLoaded', () => { }); }, complete: function() { - self.sidebarEl.addClass('sidebar-active'); NexT.utils.initSidebarDimension(); } }); } else { - $('.sidebar .motion-element').show(); - this.sidebarEl.stop().animate({ - width : SIDEBAR_WIDTH, - display: 'block' + this.sidebarEl.addClass('sidebar-active').stop().animate({ + width: SIDEBAR_WIDTH }, SIDEBAR_DISPLAY_DURATION, () => { - self.sidebarEl.addClass('sidebar-active'); + self.sidebarEl.find('.motion-element').css({opacity: 1}); NexT.utils.initSidebarDimension(); }); } @@ -194,12 +190,15 @@ window.addEventListener('DOMContentLoaded', () => { NexT.utils.isDesktop() && $('body').stop().animate(isRight ? {'padding-right': SIDEBAR_WIDTH} : {'padding-left': SIDEBAR_WIDTH}, SIDEBAR_DISPLAY_DURATION); }, hideSidebar: function() { + var self = this; this.isSidebarVisible = false; - this.sidebarEl.find('.motion-element').hide(); - this.sidebarEl.stop().animate({width: 0, display: 'none'}).removeClass('sidebar-active'); + this.sidebarEl.find('.motion-element').css({opacity: 0}); + this.sidebarEl.stop().animate({width: 0}, SIDEBAR_DISPLAY_DURATION, () => { + self.sidebarEl.removeClass('sidebar-active'); + }); sidebarToggleLines.init(); - NexT.utils.isDesktop() && $('body').stop().animate(isRight ? {'padding-right': 0} : {'padding-left': 0}); + NexT.utils.isDesktop() && $('body').stop().animate(isRight ? {'padding-right': 0} : {'padding-left': 0}, SIDEBAR_DISPLAY_DURATION); } }; sidebarToggleMotion.init(); From 292b5d047f616b4dc51437e75111d65c967d86dd Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 24 Aug 2019 18:24:49 +0800 Subject: [PATCH 7/7] Update --- layout/_layout.swig | 4 ++-- layout/_partials/footer.swig | 6 ++++++ layout/_partials/widgets.swig | 5 ----- source/css/_common/components/header/github-banner.styl | 6 +++--- source/css/_common/components/sidebar/sidebar-toggle.styl | 2 +- source/js/next-boot.js | 3 +-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/layout/_layout.swig b/layout/_layout.swig index 3d0a99d075..3f2bd80b51 100644 --- a/layout/_layout.swig +++ b/layout/_layout.swig @@ -32,6 +32,8 @@
{% include '_partials/header/index.swig' %}
+ {{ partial('_partials/widgets.swig', {}, {cache: theme.cache.enable}) }} +
@@ -56,8 +58,6 @@ {% block footer %}{% endblock %}
- - {{ partial('_partials/widgets.swig', {}, {cache: theme.cache.enable}) }}
{{ partial('_scripts/index.swig', {}, {cache: theme.cache.enable}) }} diff --git a/layout/_partials/footer.swig b/layout/_partials/footer.swig index 375ddd04c6..6865f9f8a3 100644 --- a/layout/_partials/footer.swig +++ b/layout/_partials/footer.swig @@ -59,4 +59,10 @@ #}
{%- endif %} +{%- if theme.add_this_id %} +
+ +
+{%- endif %} + {{- next_inject('footer') }} diff --git a/layout/_partials/widgets.swig b/layout/_partials/widgets.swig index fcd9aaf5d2..9d7c9a8d43 100644 --- a/layout/_partials/widgets.swig +++ b/layout/_partials/widgets.swig @@ -18,8 +18,3 @@ {{ next_url(github_URL, github_image, {class: 'github-corner', title: github_title, "aria-label": github_title}) }} {%- endif %} -{%- if theme.add_this_id %} -
- -
-{%- endif %} diff --git a/source/css/_common/components/header/github-banner.styl b/source/css/_common/components/header/github-banner.styl index 34f217cc68..97f57b21f4 100644 --- a/source/css/_common/components/header/github-banner.styl +++ b/source/css/_common/components/header/github-banner.styl @@ -21,7 +21,7 @@ animation: octocat-wave 560ms ease-in-out; } - > svg { + svg { border: 0; color: white; fill: $bg-color; @@ -31,7 +31,7 @@ } +tablet-mobile() { - > svg { + svg { if (($scheme == 'Pisces') || ($scheme == 'Gemini')) { color: $bg-color; fill: white; @@ -48,7 +48,7 @@ } +mobile() { - > svg { + svg { if ($scheme == 'Mist') { top: inherit; diff --git a/source/css/_common/components/sidebar/sidebar-toggle.styl b/source/css/_common/components/sidebar/sidebar-toggle.styl index ab96942824..d600debe66 100644 --- a/source/css/_common/components/sidebar/sidebar-toggle.styl +++ b/source/css/_common/components/sidebar/sidebar-toggle.styl @@ -11,8 +11,8 @@ z-index: $zindex-5; +tablet-mobile() { + left: $b2t-position-right-mobile; opacity: $b2t-opacity-hover; - right: $b2t-position-right-mobile; if (!hexo-config('sidebar.onmobile')) { display: none; diff --git a/source/js/next-boot.js b/source/js/next-boot.js index 72089eb0ba..ecde70777f 100644 --- a/source/js/next-boot.js +++ b/source/js/next-boot.js @@ -39,8 +39,7 @@ NexT.boot.registerEvents = function() { .stop() .css({ opacity: 0 }) .addClass(activePanelClassName) - .animate({ opacity: 1 }, TAB_ANIMATE_DURATION) - .find('.motion-element').css({ opacity: 1 }); + .animate({ opacity: 1 }, TAB_ANIMATE_DURATION); }); item.siblings().removeClass(activeTabClassName);