From a38a10761f5d1d4c1143a74504895339e31e998b Mon Sep 17 00:00:00 2001 From: ppoffice Date: Thu, 11 Jun 2015 19:56:09 +0800 Subject: [PATCH] add profile visibility config --- layout/_partial/header.ejs | 2 ++ layout/layout.ejs | 6 ++++-- source/css/_variables.styl | 28 +++++++++++++++++++++------- source/css/style.styl | 20 ++++++++------------ source/js/script.js | 2 +- 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/layout/_partial/header.ejs b/layout/_partial/header.ejs index fb65c5d..c887015 100644 --- a/layout/_partial/header.ejs +++ b/layout/_partial/header.ejs @@ -7,11 +7,13 @@ <%= i %> <% } %> + <% if(theme.profile) { %> + <% } %>
<%- search_form({button: ' '}) %>
diff --git a/layout/layout.ejs b/layout/layout.ejs index 004325d..d4b1d30 100644 --- a/layout/layout.ejs +++ b/layout/layout.ejs @@ -3,9 +3,11 @@
<%- partial('_partial/header') %>
- <%- partial('_partial/profile', null, {cache: !config.relative_link}) %> + <% if (theme.profile){ %> + <%- partial('_partial/profile', null, {cache: !config.relative_link}) %> + <% } %>
<%- body %>
- <% if (theme.sidebar && theme.sidebar !== 'bottom'){ %> + <% if (theme.sidebar){ %> <%- partial('_partial/sidebar', null, {cache: !config.relative_link}) %> <% } %>
diff --git a/source/css/_variables.styl b/source/css/_variables.styl index 06931ae..92785d2 100644 --- a/source/css/_variables.styl +++ b/source/css/_variables.styl @@ -36,28 +36,42 @@ logo-url = "images/logo.png" sidebar = hexo-config("sidebar") thumbnail-default-small = 'images/thumb-default-small.png' -// Profile +// Profile bar +profile = hexo-config("profile") profile-avatar-size = 128px // Layout block-margin = 40px article-padding = 20px mobile-nav-width = 280px -profile-column = 3 -sidebar-column = 3 -sidebar-column-tablet = 4 main-column = 7 -main-column-tablet = 9 +sidebar-column = 3 +profile-column = 3 +sidebar-column-tablet = 4 -if sidebar and sidebar isnt bottom +if sidebar _sidebar-column = sidebar-column else _sidebar-column = 0 +if profile + _profile-column = profile-column +else + _profile-column = 0 + // Grids column-width = 80px gutter-width = 20px -columns = main-column + _sidebar-column + profile-column +if _sidebar-column is 0 and _profile-column is 0 + columns = 10 + main-column = 10 +else + columns = main-column + _sidebar-column + _profile-column + +if sidebar + main-column-tablet = 6 + if profile + main-column-tablet = 9 // Media queries mq-mini = "screen and (max-width: 559px)" diff --git a/source/css/style.styl b/source/css/style.styl index 8cb1d27..0be48d8 100644 --- a/source/css/style.styl +++ b/source/css/style.styl @@ -34,10 +34,6 @@ a padding: 0 gutter-width @media mq-mini padding: 0 - - -.inner - column(columns) .left, .alignleft float: left @@ -57,12 +53,14 @@ a & > .outer margin-bottom: 30px -if sidebar and sidebar isnt bottom - #main - @media mq-normal - column(main-column) - @media mq-tablet +#main + @media mq-normal + column(main-column) + @media mq-tablet + if sidebar column(main-column-tablet) + else + width: 100% @import "_extend" @import "_partial/header" @@ -73,9 +71,7 @@ if sidebar and sidebar isnt bottom @import "_partial/footer" @import "_partial/highlight" @import "_partial/mobile" - -if sidebar - @import "_partial/sidebar" +@import "_partial/sidebar" if sidebar is left #main diff --git a/source/js/script.js b/source/js/script.js index 0b2efbc..d5f3696 100644 --- a/source/js/script.js +++ b/source/js/script.js @@ -1,5 +1,5 @@ (function($){ - var toTop = $('#toTop').offset().top - $(window).height() + 20; + var toTop = $('#toTop').length ? $('#toTop').offset().top - $(window).height() + 20 : 0; // Share $('body').on('click', function(){