From 6c3d0b87dd5e4e96398b393e6205cb72cd6c3e3e Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 28 Sep 2019 14:10:46 +0800 Subject: [PATCH 1/4] Fix Velocity motion issues --- layout/_partials/sidebar/site-overview.swig | 90 ++++++++++--------- layout/_scripts/vendors.swig | 11 ++- .../components/post/post-collapse.styl | 4 +- source/js/motion.js | 2 + source/js/schemes/muse.js | 7 +- 5 files changed, 56 insertions(+), 58 deletions(-) diff --git a/layout/_partials/sidebar/site-overview.swig b/layout/_partials/sidebar/site-overview.swig index 765a48dc10..f66c6fbb2c 100644 --- a/layout/_partials/sidebar/site-overview.swig +++ b/layout/_partials/sidebar/site-overview.swig @@ -9,54 +9,56 @@ {%- if theme.site_state %} - + {{ site.tags.length }} + {{ __('state.tags') }} + {%- if hasTagsPage %}{%- endif %} + + {%- endif %} + + {%- endif %} {%- if theme.rss %} diff --git a/layout/_scripts/vendors.swig b/layout/_scripts/vendors.swig index e1db8f1834..b5f22d237f 100644 --- a/layout/_scripts/vendors.swig +++ b/layout/_scripts/vendors.swig @@ -2,12 +2,6 @@ {%- set js_defer_vendors = {} %} {%- set js_vendors.anime = 'anime.min.js?v=3.1.0' %} -{# Velocity must be loaded before jQuery #} -{%- if theme.motion.enable %} - {%- set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %} - {%- set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %} -{%- endif %} - {%- if theme.pjax %} {%- set js_vendors.pjax = 'pjax/pjax.min.js?v=0.2.8' %} {%- endif %} @@ -29,6 +23,11 @@ {%- set js_vendors.pangu = '//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js' %} {%- endif %} +{%- if theme.motion.enable %} + {%- set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %} + {%- set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %} +{%- endif %} + {%- if theme.three.enable and not theme.three.delay %} {%- if theme.three.three_waves %} {%- set js_defer_vendors.three = 'three/three.min.js' %} diff --git a/source/css/_common/components/post/post-collapse.styl b/source/css/_common/components/post/post-collapse.styl index f05eb44ed8..76660d2da7 100644 --- a/source/css/_common/components/post/post-collapse.styl +++ b/source/css/_common/components/post/post-collapse.styl @@ -54,9 +54,7 @@ } .post-header { - align-items: center; border-bottom: 1px dashed $grey-light; - display: flex; margin: 30px 0; position: relative; the-transition(); @@ -87,12 +85,14 @@ } .post-meta { + display: inline; font-size: $font-size-smallest; margin-left: 15px; margin-right: 10px; } .post-title { + display: inline; font-size: $font-size-medium; font-weight: normal; line-height: inherit; diff --git a/source/js/motion.js b/source/js/motion.js index 999b9d1a8f..53ae2301e6 100644 --- a/source/js/motion.js +++ b/source/js/motion.js @@ -1,5 +1,7 @@ /* global NexT, CONFIG, Velocity */ +if ($ && $.Velocity) window.Velocity = $.Velocity; + NexT.motion = {}; NexT.motion.integrator = { diff --git a/source/js/schemes/muse.js b/source/js/schemes/muse.js index 8b6056ae9f..8fd769b1ca 100644 --- a/source/js/schemes/muse.js +++ b/source/js/schemes/muse.js @@ -133,15 +133,10 @@ window.addEventListener('DOMContentLoaded', () => { this.isSidebarVisible = true; this.sidebarEl.classList.add('sidebar-active'); if (typeof Velocity === 'function') { - Velocity(document.querySelectorAll('.sidebar .motion-element:not(.site-state)'), isRight ? 'transition.slideRightIn' : 'transition.slideLeftIn', { + Velocity(document.querySelectorAll('.sidebar .motion-element'), isRight ? 'transition.slideRightIn' : 'transition.slideLeftIn', { stagger: 50, drag : true }); - Velocity(document.querySelector('.site-state'), isRight ? 'transition.slideRightIn' : 'transition.slideLeftIn', { - stagger: 50, - drag : true, - display: 'flex' - }); } sidebarToggleLines.close(); From 549927e44ca906f0b67d94193658b0a2107ad5be Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 28 Sep 2019 16:49:17 +0800 Subject: [PATCH 2/4] window --- source/js/motion.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/js/motion.js b/source/js/motion.js index 53ae2301e6..d1e1dd8be0 100644 --- a/source/js/motion.js +++ b/source/js/motion.js @@ -1,6 +1,6 @@ /* global NexT, CONFIG, Velocity */ -if ($ && $.Velocity) window.Velocity = $.Velocity; +if (window.$ && window.$.Velocity) window.Velocity = window.$.Velocity; NexT.motion = {}; From ab97a191928dc89ca36636e82ed148b081039040 Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 28 Sep 2019 16:51:02 +0800 Subject: [PATCH 3/4] Indent --- layout/_partials/sidebar/site-overview.swig | 92 ++++++++++----------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/layout/_partials/sidebar/site-overview.swig b/layout/_partials/sidebar/site-overview.swig index f66c6fbb2c..0a66bd9863 100644 --- a/layout/_partials/sidebar/site-overview.swig +++ b/layout/_partials/sidebar/site-overview.swig @@ -9,56 +9,54 @@ {%- if theme.site_state %} -
- +
{%- endif %} {%- if theme.rss %} From b4a462101dc2619d483c738c7b26e758749a461c Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Sat, 28 Sep 2019 22:30:56 +0800 Subject: [PATCH 4/4] Line break --- layout/_partials/sidebar/site-overview.swig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/layout/_partials/sidebar/site-overview.swig b/layout/_partials/sidebar/site-overview.swig index 0a66bd9863..cb601c5562 100644 --- a/layout/_partials/sidebar/site-overview.swig +++ b/layout/_partials/sidebar/site-overview.swig @@ -23,6 +23,7 @@ {%- endif %} + {%- if site.categories.length > 0 %} {%- set categoriesPageQuery = site.pages.find({type: 'categories'}, {lean: true}) %} {%- set hasCategoriesPage = categoriesPageQuery.length > 0 %} @@ -39,6 +40,7 @@ {%- if hasCategoriesPage %}{%- endif %} {%- endif %} + {%- if site.tags.length > 0 %} {%- set tagsPageQuery = site.pages.find({type: 'tags'}, {lean: true}) %} {%- set hasTagsPage = tagsPageQuery.length > 0 %}