feat(*): several new features and fixes
- config generator now can add multiple lines of comment - sidebars can be set to sticky on tablet and desktop devices #359 - fix toc widget display issue when it's on the right sidebar #360 - update some links in the config specspull/404/head
parent
137cc047ce
commit
52ef5bd93b
|
@ -55,7 +55,10 @@ function generate(spec, parentConfig = null) {
|
||||||
defaults = {};
|
defaults = {};
|
||||||
}
|
}
|
||||||
if (spec[key].hasOwnProperty(doc)) {
|
if (spec[key].hasOwnProperty(doc)) {
|
||||||
defaults['#' + key] = spec[key][doc];
|
let i = 0;
|
||||||
|
for (let line of spec[key][doc].split('\n')) {
|
||||||
|
defaults['#' + key + i++] = line;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
defaults[key] = value;
|
defaults[key] = value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ module.exports = {
|
||||||
[doc]: 'Article display settings',
|
[doc]: 'Article display settings',
|
||||||
highlight: {
|
highlight: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Code highlight theme (https://github.com/highlightjs/highlight.js/tree/master/src/styles)',
|
[doc]: 'Code highlight theme\nhttps://github.com/highlightjs/highlight.js/tree/master/src/styles',
|
||||||
[defaultValue]: 'atom-one-light'
|
[defaultValue]: 'atom-one-light'
|
||||||
},
|
},
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
|
|
|
@ -104,7 +104,7 @@ const ValineSpec = {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
[type]: 'object',
|
[type]: 'object',
|
||||||
[doc]: 'Comment plugin settings (http://ppoffice.github.io/hexo-theme-icarus/categories/Configuration/Comment-Plugins)',
|
[doc]: 'Comment plugin settings\nhttp://ppoffice.github.io/hexo-theme-icarus/categories/Configuration/Comment-Plugins',
|
||||||
type: {
|
type: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Name of the comment plugin',
|
[doc]: 'Name of the comment plugin',
|
||||||
|
|
|
@ -18,6 +18,7 @@ module.exports = {
|
||||||
search: require('./search.spec'),
|
search: require('./search.spec'),
|
||||||
comment: require('./comment.spec'),
|
comment: require('./comment.spec'),
|
||||||
share: require('./share.spec'),
|
share: require('./share.spec'),
|
||||||
|
sidebar: require('./sidebar.spec'),
|
||||||
widgets: require('./widgets.spec'),
|
widgets: require('./widgets.spec'),
|
||||||
plugins: require('./plugins.spec'),
|
plugins: require('./plugins.spec'),
|
||||||
providers: require('./providers.spec')
|
providers: require('./providers.spec')
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
open_graph: {
|
open_graph: {
|
||||||
[type]: 'object',
|
[type]: 'object',
|
||||||
[doc]: 'Open Graph metadata (https://hexo.io/docs/helpers.html#open-graph)',
|
[doc]: 'Open Graph metadata\nhttps://hexo.io/docs/helpers.html#open-graph',
|
||||||
fb_app_id: {
|
fb_app_id: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Facebook App ID',
|
[doc]: 'Facebook App ID',
|
||||||
|
|
|
@ -10,17 +10,17 @@ module.exports = {
|
||||||
},
|
},
|
||||||
gallery: {
|
gallery: {
|
||||||
[type]: 'boolean',
|
[type]: 'boolean',
|
||||||
[doc]: 'Enable the lightGallery and Justified Gallery plugins (http://ppoffice.github.io/hexo-theme-icarus/2016/07/08/plugin/Gallery/)',
|
[doc]: 'Enable the lightGallery and Justified Gallery plugins\nhttp://ppoffice.github.io/hexo-theme-icarus/Plugins/General/gallery-plugin/',
|
||||||
[defaultValue]: true
|
[defaultValue]: true
|
||||||
},
|
},
|
||||||
'outdated-browser': {
|
'outdated-browser': {
|
||||||
[type]: 'boolean',
|
[type]: 'boolean',
|
||||||
[doc]: 'Enable the Outdated Browser plugin (http://outdatedbrowser.com/)',
|
[doc]: 'Enable the Outdated Browser plugin\nhttp://outdatedbrowser.com/',
|
||||||
[defaultValue]: true
|
[defaultValue]: true
|
||||||
},
|
},
|
||||||
mathjax: {
|
mathjax: {
|
||||||
[type]: 'boolean',
|
[type]: 'boolean',
|
||||||
[doc]: 'Enable the MathJax plugin (http://ppoffice.github.io/hexo-theme-icarus/2018/01/01/plugin/MathJax/)',
|
[doc]: 'Enable the MathJax plugin\nhttp://ppoffice.github.io/hexo-theme-icarus/Plugins/General/mathjax-plugin/',
|
||||||
[defaultValue]: true
|
[defaultValue]: true
|
||||||
},
|
},
|
||||||
'back-to-top': {
|
'back-to-top': {
|
||||||
|
@ -30,7 +30,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
'google-analytics': {
|
'google-analytics': {
|
||||||
[type]: ['boolean', 'object'],
|
[type]: ['boolean', 'object'],
|
||||||
[doc]: 'Google Analytics plugin settings (http://ppoffice.github.io/hexo-theme-icarus/2018/01/01/plugin/Analytics/#Google-Analytics)',
|
[doc]: 'Google Analytics plugin settings\nhttp://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Google-Analytics',
|
||||||
tracking_id: {
|
tracking_id: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Google Analytics tracking id',
|
[doc]: 'Google Analytics tracking id',
|
||||||
|
@ -39,7 +39,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
'baidu-analytics': {
|
'baidu-analytics': {
|
||||||
[type]: ['boolean', 'object'],
|
[type]: ['boolean', 'object'],
|
||||||
[doc]: 'Baidu Analytics plugin settings (http://ppoffice.github.io/hexo-theme-icarus/2018/01/01/plugin/Analytics/#Baidu-Analytics)',
|
[doc]: 'Baidu Analytics plugin settings\nhttp://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Baidu-Analytics',
|
||||||
tracking_id: {
|
tracking_id: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Baidu Analytics tracking id',
|
[doc]: 'Baidu Analytics tracking id',
|
||||||
|
@ -48,7 +48,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
hotjar: {
|
hotjar: {
|
||||||
[type]: ['boolean', 'object'],
|
[type]: ['boolean', 'object'],
|
||||||
[doc]: 'Hotjar user feedback plugin (http://ppoffice.github.io/hexo-theme-icarus/2018/01/01/plugin/Analytics/#Hotjar)',
|
[doc]: 'Hotjar user feedback plugin\nhttp://ppoffice.github.io/hexo-theme-icarus/Plugins/General/site-analytics-plugin/#Hotjar',
|
||||||
site_id: {
|
site_id: {
|
||||||
[type]: ['string', 'number'],
|
[type]: ['string', 'number'],
|
||||||
[doc]: 'Hotjar site id',
|
[doc]: 'Hotjar site id',
|
||||||
|
|
|
@ -2,7 +2,7 @@ const { doc, type, defaultValue } = require('../common/utils').descriptors;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
[type]: 'object',
|
[type]: 'object',
|
||||||
[doc]: 'CDN provider settings',
|
[doc]: 'CDN provider settings\nhttp://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/speed-up-your-site-with-custom-cdn/',
|
||||||
cdn: {
|
cdn: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Name or URL of the JavaScript and/or stylesheet CDN provider',
|
[doc]: 'Name or URL of the JavaScript and/or stylesheet CDN provider',
|
||||||
|
|
|
@ -2,7 +2,7 @@ const { doc, type, defaultValue, required, requires } = require('../common/utils
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
[type]: 'object',
|
[type]: 'object',
|
||||||
[doc]: 'Search plugin settings (http://ppoffice.github.io/hexo-theme-icarus/categories/Configuration/Search-Plugins)',
|
[doc]: 'Search plugin settings\nhttp://ppoffice.github.io/hexo-theme-icarus/categories/Configuration/Search-Plugins',
|
||||||
type: {
|
type: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Name of the search plugin',
|
[doc]: 'Name of the search plugin',
|
||||||
|
|
|
@ -2,7 +2,7 @@ const { doc, type, defaultValue, required, requires } = require('../common/utils
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
[type]: 'object',
|
[type]: 'object',
|
||||||
[doc]: 'Share plugin settings (http://ppoffice.github.io/hexo-theme-icarus/categories/Configuration/Share-Plugins)',
|
[doc]: 'Share plugin settings\nhttp://ppoffice.github.io/hexo-theme-icarus/categories/Configuration/Share-Plugins',
|
||||||
type: {
|
type: {
|
||||||
[type]: 'string',
|
[type]: 'string',
|
||||||
[doc]: 'Share plugin name',
|
[doc]: 'Share plugin name',
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
const { doc, type, defaultValue, required, requires, format } = require('../common/utils').descriptors;
|
||||||
|
|
||||||
|
function commonSettings(position) {
|
||||||
|
return {
|
||||||
|
[type]: 'object',
|
||||||
|
[doc]: position + ' sidebar settings',
|
||||||
|
sticky: {
|
||||||
|
[type]: 'boolean',
|
||||||
|
[doc]: 'Whether the ' + position + ' sidebar is sticky when page scrolls\nhttp://ppoffice.github.io/hexo-theme-icarus/Configuration/Theme/make-a-sidebar-sticky-when-page-scrolls/',
|
||||||
|
[defaultValue]: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
[type]: 'object',
|
||||||
|
[doc]: 'Sidebar settings.\nPlease be noted that a sidebar is only visible when it has at least one widget',
|
||||||
|
left: commonSettings('left'),
|
||||||
|
right: commonSettings('right')
|
||||||
|
}
|
|
@ -121,7 +121,7 @@ const LinksSpec = {
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
[type]: 'array',
|
[type]: 'array',
|
||||||
[doc]: 'Sidebar widget settings (http://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/)',
|
[doc]: 'Sidebar widget settings\nhttp://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/',
|
||||||
[defaultValue]: DEFAULT_WIDGETS,
|
[defaultValue]: DEFAULT_WIDGETS,
|
||||||
'*': {
|
'*': {
|
||||||
[type]: 'object',
|
[type]: 'object',
|
||||||
|
|
|
@ -17,12 +17,15 @@
|
||||||
<% function order_class() {
|
<% function order_class() {
|
||||||
return position === 'left' ? 'has-order-1' : 'has-order-3';
|
return position === 'left' ? 'has-order-1' : 'has-order-3';
|
||||||
} %>
|
} %>
|
||||||
<div class="column <%= side_column_class() %> <%= visibility_class() %> <%= order_class() %> column-<%= position %>">
|
<% function sticky_class(position) {
|
||||||
|
return get_config('sidebar.' + position + '.sticky', false) ? 'is-sticky' : '';
|
||||||
|
} %>
|
||||||
|
<div class="column <%= side_column_class() %> <%= visibility_class() %> <%= order_class() %> column-<%= position %> <%= sticky_class(position) %>">
|
||||||
<% get_widgets(position).forEach(widget => {%>
|
<% get_widgets(position).forEach(widget => {%>
|
||||||
<%- partial('widget/' + widget.type, { widget, post: page }) %>
|
<%- partial('widget/' + widget.type, { widget, post: page }) %>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
<% if (position === 'left') { %>
|
<% if (position === 'left') { %>
|
||||||
<div class="card card-transparent is-hidden-widescreen">
|
<div class="column-right-shadow is-hidden-widescreen <%= sticky_class('right') %>">
|
||||||
<% get_widgets('right').forEach(widget => {%>
|
<% get_widgets('right').forEach(widget => {%>
|
||||||
<%- partial('widget/' + widget.type, { widget, post: page }) %>
|
<%- partial('widget/' + widget.type, { widget, post: page }) %>
|
||||||
<% }) %>
|
<% }) %>
|
||||||
|
|
|
@ -35,19 +35,25 @@ body, button, input, select, textarea
|
||||||
.section
|
.section
|
||||||
padding: 1.5rem 1rem
|
padding: 1.5rem 1rem
|
||||||
|
|
||||||
.column-main,
|
@media screen and (min-width: screen-tablet)
|
||||||
.column-left,
|
.column-main,
|
||||||
.column-right
|
.column-left,
|
||||||
align-self: flex-start
|
.column-right,
|
||||||
&.is-sticky
|
.column-right-shadow
|
||||||
position: sticky
|
&.is-sticky
|
||||||
top: .75rem
|
align-self: flex-start
|
||||||
|
position: sticky
|
||||||
|
top: .75rem
|
||||||
|
.column-right-shadow
|
||||||
|
&.is-sticky
|
||||||
|
top: 1.5rem
|
||||||
|
|
||||||
.card
|
.card
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
border-radius: 4px
|
border-radius: 4px
|
||||||
box-shadow: 0 4px 10px rgba(0,0,0,0.05), 0 0 1px rgba(0,0,0,0.1)
|
box-shadow: 0 4px 10px rgba(0,0,0,0.05), 0 0 1px rgba(0,0,0,0.1)
|
||||||
& + .card
|
& + .card,
|
||||||
|
& + .column-right-shadow
|
||||||
margin-top: 1.5rem
|
margin-top: 1.5rem
|
||||||
&.card-transparent
|
&.card-transparent
|
||||||
overflow: visible
|
overflow: visible
|
||||||
|
|
|
@ -8,7 +8,9 @@
|
||||||
element.style.opacity = '0';
|
element.style.opacity = '0';
|
||||||
});
|
});
|
||||||
document.querySelector('body > .navbar').style.transform = 'translateY(-100px)';
|
document.querySelector('body > .navbar').style.transform = 'translateY(-100px)';
|
||||||
['.column-main > .card', '.column-left > .card', '.column-right > .card'].map(function (selector) {
|
['.column-main > .card',
|
||||||
|
'.column-left > .card, .column-right-shadow > .card',
|
||||||
|
'.column-right > .card'].map(function (selector) {
|
||||||
$(selector).forEach(function (element) {
|
$(selector).forEach(function (element) {
|
||||||
element.style.transition = '0s';
|
element.style.transition = '0s';
|
||||||
element.style.opacity = '0';
|
element.style.opacity = '0';
|
||||||
|
@ -22,7 +24,9 @@
|
||||||
element.style.transition = 'opacity 0.3s ease-out, transform 0.3s ease-out';
|
element.style.transition = 'opacity 0.3s ease-out, transform 0.3s ease-out';
|
||||||
});
|
});
|
||||||
document.querySelector('body > .navbar').style.transform = 'translateY(0)';
|
document.querySelector('body > .navbar').style.transform = 'translateY(0)';
|
||||||
['.column-main > .card', '.column-left > .card', '.column-right > .card'].map(function (selector) {
|
['.column-main > .card',
|
||||||
|
'.column-left > .card, .column-right-shadow > .card',
|
||||||
|
'.column-right > .card'].map(function (selector) {
|
||||||
var i = 1;
|
var i = 1;
|
||||||
$(selector).forEach(function (element) {
|
$(selector).forEach(function (element) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
|
Loading…
Reference in New Issue