chore(*): multiple improvements

This commit is contained in:
ppoffice 2018-10-22 00:51:51 -04:00
parent e94ec6f445
commit 7cc09f00e9
13 changed files with 91 additions and 16 deletions

View File

@ -4,7 +4,7 @@ module.exports = {
favicon: {
[type]: 'string',
[doc]: 'Path or URL to the website\'s icon',
[defaultValue]: null
[defaultValue]: '/images/favicon.svg',
},
rss: {
[type]: 'string',

View File

@ -5,22 +5,27 @@ module.exports = {
[doc]: 'Other plugin settings',
gallery: {
[type]: 'boolean',
[doc]: 'Enable the lightGallery and Justified Gallery plugins',
[doc]: 'Enable the lightGallery and Justified Gallery plugins (http://ppoffice.github.io/hexo-theme-icarus/2016/07/08/plugin/Gallery/)',
[defaultValue]: true
},
'outdated-browser': {
[type]: 'boolean',
[doc]: 'Enable the Outdated Browser plugin',
[doc]: 'Enable the Outdated Browser plugin (http://outdatedbrowser.com/)',
[defaultValue]: true
},
animejs: {
[type]: 'boolean',
[doc]: 'Enable page animations',
[doc]: 'Enable page animations (http://animejs.com/)',
[defaultValue]: true
},
mathjax: {
[type]: 'boolean',
[doc]: 'Enable the MathJax plugin',
[doc]: 'Enable the MathJax plugin (http://ppoffice.github.io/hexo-theme-icarus/2018/01/01/plugin/MathJax/)',
[defaultValue]: true
},
'back-to-top': {
[type]: 'boolean',
[doc]: 'Show the back to top button on mobile devices',
[defaultValue]: true
},
'google-analytics': {

View File

@ -42,7 +42,7 @@ const DEFAULT_WIDGETS = [
position: 'left',
links: {
Hexo: 'https://hexo.io',
Github: 'https://github.com/ppoffice'
PPOffice: 'https://github.com/ppoffice'
}
},
{
@ -121,7 +121,7 @@ const LinksSpec = {
module.exports = {
[type]: 'array',
[doc]: 'Sidebar widget settings',
[doc]: 'Sidebar widget settings (http://ppoffice.github.io/hexo-theme-icarus/categories/Widgets/)',
[defaultValue]: DEFAULT_WIDGETS,
'*': {
[type]: 'object',

View File

@ -11,7 +11,7 @@ const ConfigGenerator = require('../common/ConfigGenerator');
const CONFIG_PATH = path.join(__dirname, '../..', '_config.yml');
logger.info('Checking if the configuration file exists...');
logger.info('Validating the configuration file');
if (!fs.existsSync(CONFIG_PATH)) {
const relativePath = path.relative(process.cwd(), CONFIG_PATH);
@ -21,7 +21,6 @@ if (!fs.existsSync(CONFIG_PATH)) {
process.exit(0);
}
logger.info('Validating the configuration file...');
const validator = new ConfigValidator(rootSpec);
const config = yaml.safeLoad(fs.readFileSync(CONFIG_PATH));
try {

View File

@ -1,5 +1,10 @@
const logger = require('hexo-log')();
logger.info(`=======================================
Icarus V2
=============================================`);

View File

@ -25,6 +25,8 @@ article:
read: 'read'
about: 'About'
words: 'words'
plugin:
backtotop: 'Back to Top'
search:
search: 'Search'
hint: 'Type something...'

View File

@ -25,6 +25,8 @@ article:
read: '读完'
about: '大约'
words: '个字'
plugin:
backtotop: '回到顶端'
search:
search: '搜索'
hint: '想要查找什么...'

View File

@ -1,6 +1,6 @@
<nav class="navbar navbar-main">
<div class="container">
<div class="navbar-brand">
<div class="navbar-brand is-flex-center">
<a class="navbar-item navbar-logo" href="<%- url_for('/') %>">
<% if (has_config('logo.text') && get_config('logo.text')) { %>
<%= get_config('logo.text') %>

View File

@ -34,10 +34,10 @@ function pagination(c, m) {
<div class="card card-transparent">
<nav class="pagination is-centered" role="navigation" aria-label="pagination">
<div class="pagination-previous<%= page.current > 1 ? '' : ' is-invisible is-hidden-mobile' %>">
<a class="has-text-black-ter" href="<%= link_url(page.current - 1) %>"><%= __('common.prev') %></a>
<a class="is-flex-grow has-text-black-ter" href="<%= link_url(page.current - 1) %>"><%= __('common.prev') %></a>
</div>
<div class="pagination-next<%= page.current < page.total ? '' : ' is-invisible is-hidden-mobile' %>">
<a class="has-text-black-ter" href="<%= link_url(page.current + 1) %>"><%= __('common.next') %></a>
<a class="is-flex-grow has-text-black-ter" href="<%= link_url(page.current + 1) %>"><%= __('common.next') %></a>
</div>
<ul class="pagination-list is-hidden-mobile">
<% pagination(page.current, page.total).forEach(element => { %>

View File

@ -0,0 +1,26 @@
<% if (plugin !== false) { %>
<% if (!head) { %>
<div id="back-to-top" class="is-flex is-flex-center is-hidden-tablet">
<i class="material-icons">keyboard_arrow_up</i>
<span class="is-size-7">
<%= __('plugin.backtotop') %></span>
</div>
<script>
$(document).ready(function () {
var lastScrollTop = 0;
$(window).scroll(function (event) {
var scrollTop = $(this).scrollTop();
if (scrollTop > lastScrollTop || scrollTop === 0) {
$('#back-to-top').removeClass('is-active');
} else {
$('#back-to-top').addClass('is-active');
}
lastScrollTop = scrollTop;
});
$('#back-to-top').on('click', function () {
$('body, html').animate({ scrollTop: 0 }, 400);
});
});
</script>
<% } %>
<% } %>

View File

@ -52,8 +52,6 @@ img.thumbnail
.navbar-main
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05)
.navbar-brand
justify-content: center
.navbar-menu,
.navbar-start,
.navbar-end
@ -162,6 +160,21 @@ img.thumbnail
margin-left: 0.75rem
margin-right: 0
#back-to-top
position: fixed
bottom: 0
left: 0
right: 0
text-align: center
background: white
box-shadow: 0 -1px 8px rgba(0,0,0,0.1)
padding: 8px 0
line-height: 24px
transform: translateY(100px)
transition: 0.4s ease
&.is-active
transform: translateY(0)
/* ---------------------------------
* Custom modifiers
* --------------------------------- */
@ -180,9 +193,15 @@ img.thumbnail
.is-overflow-x-auto
overflow-x: auto !important
.is-flex-grow
flex-grow: 1 !important
.is-flex-wrap
flex-wrap: wrap !important
.is-flex-start
justify-content: start !important
.is-flex-center
justify-content: center !important
@ -260,7 +279,7 @@ img.thumbnail
figure.highlight
padding: 0
width: 100%
margin: 0 0 1.5rem
margin: 1em 0 1em !important
pre,
table tr:hover

View File

@ -0,0 +1,6 @@
<svg
xmlns="http://www.w3.org/2000/svg" version="1.1" width="256" height="256" viewbox="0 0 949 256">
<path fill="#2366d1" d="M110.85125168440814 128L221.70250336881628 192L110.85125168440814 256L0 192Z"/>
<path fill="#609dff" d="M110.85125168440814 64L221.70250336881628 128L110.85125168440814 192L0 128Z"/>
<path fill="#a4c7ff" d="M110.85125168440814 0L221.70250336881628 64L110.85125168440814 128L0 64Z"/>
</svg>

After

Width:  |  Height:  |  Size: 431 B

View File

@ -14,4 +14,15 @@
$(this).text(moment($(this).attr('datetime')).fromNow());
});
}
function adjustNavbar() {
const navbarWidth = $('.navbar-main .navbar-start').outerWidth() + $('.navbar-main .navbar-end').outerWidth();
if ($(document).outerWidth() < navbarWidth) {
$('.navbar-main .navbar-menu').addClass('is-flex-start');
} else {
$('.navbar-main .navbar-menu').removeClass('is-flex-start');
}
}
adjustNavbar();
$(window).resize(adjustNavbar);
})(jQuery);