diff --git a/source/css/_common/components/third-party/gitter.styl b/source/css/_common/components/third-party/gitter.styl new file mode 100644 index 0000000..ced2490 --- /dev/null +++ b/source/css/_common/components/third-party/gitter.styl @@ -0,0 +1,7 @@ +if (hexo-config('gitter.enable')) { + .gitter-open-chat-button { + $alignment = sidebar-toggle-alignment(false); + {$alignment[0]}: auto !important; + {$alignment[1]}: 10px !important; + } +} diff --git a/source/css/_common/components/third-party/index.styl b/source/css/_common/components/third-party/index.styl index b16a051..101dc72 100644 --- a/source/css/_common/components/third-party/index.styl +++ b/source/css/_common/components/third-party/index.styl @@ -4,6 +4,7 @@ @import 'search'; @import 'related-posts'; @import 'math'; +@import 'gitter'; .use-motion .animated { // Fix issue #48 #55 diff --git a/source/css/_mixins.styl b/source/css/_mixins.styl index 71f513c..1e365d0 100644 --- a/source/css/_mixins.styl +++ b/source/css/_mixins.styl @@ -120,21 +120,19 @@ main-container() { } } -sidebar-toggle-position($reverse = false) { +sidebar-toggle-alignment($reverse) { $condition = hexo-config('sidebar.position') == 'right'; if (($scheme == 'Muse') or ($scheme == 'Mist')) { $condition = $condition == $reverse; } - if ($condition) { - left: $b2t-position-right; - +tablet-mobile() { - left: $b2t-position-right-mobile; - } - } else { - right: $b2t-position-right; - +tablet-mobile() { - right: $b2t-position-right-mobile; - } + return $condition ? ('left' 'right') : ('right' 'left'); +} + +sidebar-toggle-position($reverse) { + $alignment = sidebar-toggle-alignment($reverse)[0]; + {$alignment}: $b2t-position-right; + +tablet-mobile() { + {$alignment}: $b2t-position-right-mobile; } } @@ -144,7 +142,7 @@ sidebar-toggle() { opacity: $b2t-opacity; position: fixed; z-index: $zindex-3; - sidebar-toggle-position(); + sidebar-toggle-position(false); &:hover { opacity: $b2t-opacity-hover;