From efa995809b07a91038e68667f5e5219a68b57c45 Mon Sep 17 00:00:00 2001 From: zhuzhuyule Date: Sun, 11 Mar 2018 00:27:22 +0800 Subject: [PATCH 1/3] Add Scheme.Mist the sidebar position to left or right stting _config.yml 'sidebar.position' with left or right --- source/css/_schemes/Mist/sidebar/_sidebar.styl | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 source/css/_schemes/Mist/sidebar/_sidebar.styl diff --git a/source/css/_schemes/Mist/sidebar/_sidebar.styl b/source/css/_schemes/Mist/sidebar/_sidebar.styl new file mode 100644 index 0000000000..279fb0ebef --- /dev/null +++ b/source/css/_schemes/Mist/sidebar/_sidebar.styl @@ -0,0 +1,10 @@ +if (hexo-config('sidebar.position') == 'left' ) { + .sidebar { + right: auto; + left: 0; + } + .sidebar-toggle { + right: auto; + left: 50px; + } +} From a3758963a60769dd6ed41fdf74c29548360abf35 Mon Sep 17 00:00:00 2001 From: zhuzhuyule Date: Sun, 11 Mar 2018 00:27:22 +0800 Subject: [PATCH 2/3] Add Scheme.Mist the sidebar position to left or right stting _config.yml 'sidebar.position' with left or right --- _config.yml | 2 +- source/css/_schemes/Mist/index.styl | 1 + .../css/_schemes/Mist/sidebar/_sidebar.styl | 10 +++ source/js/src/motion.js | 74 +++++++++++++------ 4 files changed, 63 insertions(+), 24 deletions(-) create mode 100644 source/css/_schemes/Mist/sidebar/_sidebar.styl diff --git a/_config.yml b/_config.yml index 680e5e2eb9..1cb1ef5e20 100644 --- a/_config.yml +++ b/_config.yml @@ -204,7 +204,7 @@ toc: #creative_commons: sidebar: - # Sidebar Position, available value: left | right (only for Pisces | Gemini). + # Sidebar Position, available value: left | right . position: left #position: right diff --git a/source/css/_schemes/Mist/index.styl b/source/css/_schemes/Mist/index.styl index bb2f4c50a4..62f2679f8a 100644 --- a/source/css/_schemes/Mist/index.styl +++ b/source/css/_schemes/Mist/index.styl @@ -9,6 +9,7 @@ @import "_menu"; @import "_search.styl"; @import "_posts-expanded"; +@import "sidebar/_sidebar"; @import "sidebar/sidebar-blogroll"; // Import _posts if want to justify text-align on mobile. // @import "../Pisces/_posts"; diff --git a/source/css/_schemes/Mist/sidebar/_sidebar.styl b/source/css/_schemes/Mist/sidebar/_sidebar.styl new file mode 100644 index 0000000000..279fb0ebef --- /dev/null +++ b/source/css/_schemes/Mist/sidebar/_sidebar.styl @@ -0,0 +1,10 @@ +if (hexo-config('sidebar.position') == 'left' ) { + .sidebar { + right: auto; + left: 0; + } + .sidebar-toggle { + right: auto; + left: 50px; + } +} diff --git a/source/js/src/motion.js b/source/js/src/motion.js index c6b72257f9..43f0717b64 100644 --- a/source/js/src/motion.js +++ b/source/js/src/motion.js @@ -51,27 +51,55 @@ $(document).ready(function () { this.el.velocity('stop').velocity(this.status[status]); }; - var sidebarToggleLine1st = new SidebarToggleLine({ - el: '.sidebar-toggle-line-first', - status: { - arrow: {width: '50%', rotateZ: '-45deg', top: '2px'}, - close: {width: '100%', rotateZ: '-45deg', top: '5px'} - } - }); - var sidebarToggleLine2nd = new SidebarToggleLine({ - el: '.sidebar-toggle-line-middle', - status: { - arrow: {width: '90%'}, - close: {opacity: 0} - } - }); - var sidebarToggleLine3rd = new SidebarToggleLine({ - el: '.sidebar-toggle-line-last', - status: { - arrow: {width: '50%', rotateZ: '45deg', top: '-2px'}, - close: {width: '100%', rotateZ: '45deg', top: '-5px'} - } - }); + var sidebarToggleLine1st; + var sidebarToggleLine2nd; + var sidebarToggleLine3rd; + var isRight = (NexT.utils.isMist() && (CONFIG.sidebar.position != 'left')); + if (isRight){ + sidebarToggleLine1st = new SidebarToggleLine({ + el: '.sidebar-toggle-line-first', + status: { + arrow: {width: '50%', rotateZ: '-45deg', top: '2px'}, + close: {width: '100%', rotateZ: '-45deg', top: '5px'} + } + }); + sidebarToggleLine2nd = new SidebarToggleLine({ + el: '.sidebar-toggle-line-middle', + status: { + arrow: {width: '90%'}, + close: {opacity: 0} + } + }); + sidebarToggleLine3rd = new SidebarToggleLine({ + el: '.sidebar-toggle-line-last', + status: { + arrow: {width: '50%', rotateZ: '45deg', top: '-2px'}, + close: {width: '100%', rotateZ: '45deg', top: '-5px'} + } + }); + } else { + sidebarToggleLine1st = new SidebarToggleLine({ + el: '.sidebar-toggle-line-first', + status: { + arrow: {width: '50%', rotateZ: '45deg', top: '2px', left: '50%'}, + close: {width: '100%', rotateZ: '-45deg', top: '5px', left: '0px'} + } + }); + sidebarToggleLine2nd = new SidebarToggleLine({ + el: '.sidebar-toggle-line-middle', + status: { + arrow: {width: '90%', left: '2px'}, + close: {opacity: 0, left: '0px'} + } + }); + sidebarToggleLine3rd = new SidebarToggleLine({ + el: '.sidebar-toggle-line-last', + status: { + arrow: {width: '50%', rotateZ: '-45deg', top: '-2px', left: '50%'}, + close: {width: '100%', rotateZ: '45deg', top: '-5px', left: '0px'} + } + }); + } sidebarToggleLines.push(sidebarToggleLine1st); sidebarToggleLines.push(sidebarToggleLine2nd); @@ -98,7 +126,7 @@ $(document).ready(function () { $(document) .on('sidebar.isShowing', function () { NexT.utils.isDesktop() && $('body').velocity('stop').velocity( - {paddingRight: SIDEBAR_WIDTH}, + isRight ? {paddingRight: SIDEBAR_WIDTH} : {paddingLeft: SIDEBAR_WIDTH}, SIDEBAR_DISPLAY_DURATION ); }) @@ -164,7 +192,7 @@ $(document).ready(function () { this.sidebarEl.trigger('sidebar.isShowing'); }, hideSidebar: function () { - NexT.utils.isDesktop() && $('body').velocity('stop').velocity({paddingRight: 0}); + NexT.utils.isDesktop() && $('body').velocity('stop').velocity(isRight?{paddingRight: 0}:{paddingLeft: 0}); this.sidebarEl.find('.motion-element').velocity('stop').css('display', 'none'); this.sidebarEl.velocity('stop').velocity({width: 0}, {display: 'none'}); From 3db00c2b749da651580969c951c2195ec4baaead Mon Sep 17 00:00:00 2001 From: "Ivan.Nginx" Date: Wed, 14 Mar 2018 12:50:52 +0300 Subject: [PATCH 3/3] Replace Mist with Muse order. --- source/js/src/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/js/src/utils.js b/source/js/src/utils.js index 9840089b7f..0008990aaa 100644 --- a/source/js/src/utils.js +++ b/source/js/src/utils.js @@ -253,14 +253,14 @@ NexT.utils = NexT.$u = { $('.sidebar-toggle').trigger('click'); }, - isMist: function () { - return CONFIG.scheme === 'Mist'; - }, - isMuse: function () { return CONFIG.scheme === 'Muse'; }, + isMist: function () { + return CONFIG.scheme === 'Mist'; + }, + isPisces: function () { return CONFIG.scheme === 'Pisces'; },