Skip to content
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ source/lib/font-awesome/less/
source/lib/font-awesome/scss/
!source/lib/font-awesome/

!source/lib/jquery/
!source/lib/anime.min.js

!source/lib/velocity/
11 changes: 5 additions & 6 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -962,11 +962,10 @@ vendors:
# Internal path prefix. Please do not edit it.
_internal: lib

# Internal version: 3.4.1
# Internal version: 3.1.0
# Example:
# jquery: //cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
# jquery: //cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js
jquery:
# anime: //cdn.jsdelivr.net/npm/animejs@3.1.0/lib/anime.min.js
anime:

# Internal version: 4.7.0
# Example:
Expand Down Expand Up @@ -1000,10 +999,10 @@ vendors:

# FancyBox
# Example:
# jquery: //cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js
# fancybox: //cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js
# fancybox: //cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js
# fancybox_css: //cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.css
# fancybox_css: //cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css
jquery:
fancybox:
fancybox_css:

Expand Down
4 changes: 2 additions & 2 deletions layout/_macro/sidebar.swig
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
{%- endif %}

<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc" data-target="post-toc-wrap">
<li class="sidebar-nav-toc">
{{ __('sidebar.toc') }}
</li>
<li class="sidebar-nav-overview" data-target="site-overview-wrap">
<li class="sidebar-nav-overview">
{{ __('sidebar.overview') }}
</li>
</ul>
Expand Down
3 changes: 2 additions & 1 deletion layout/_partials/head/head.swig
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
copy_button: '{{ __("post.copy_button") }}',
copy_success: '{{ __("post.copy_success") }}',
copy_failure: '{{ __("post.copy_failure") }}'
}
},
sidebarPadding: 40
};
</script>
14 changes: 8 additions & 6 deletions layout/_scripts/vendors.swig
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{%- set js_vendors = {} %}
{%- set js_defer_vendors = {} %}
{%- set js_vendors.jquery = 'jquery/index.js?v=3.4.1' %}
{%- set js_vendors.anime = 'anime.min.js?v=3.1.0' %}

{# Velocity must be loaded before jQuery #}
{%- if theme.motion.enable %}
{%- set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %}
{%- set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %}
{%- endif %}

{%- if theme.pjax %}
{%- set js_vendors.pjax = 'pjax/pjax.min.js?v=0.2.8' %}
{%- endif %}

{%- if theme.fancybox %}
{%- set js_vendors.jquery = '//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js' %}
{%- set js_vendors.fancybox = '//cdn.jsdelivr.net/gh/fancyapps/fancybox@3/dist/jquery.fancybox.min.js' %}
{%- endif %}

Expand All @@ -22,11 +29,6 @@
{%- set js_vendors.pangu = '//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js' %}
{%- endif %}

{%- if theme.motion.enable %}
{%- set js_vendors.velocity = 'velocity/velocity.min.js?v=1.2.1' %}
{%- set js_vendors.velocity_ui = 'velocity/velocity.ui.min.js?v=1.2.1' %}
{%- endif %}

{%- if theme.three.enable and not theme.three.delay %}
{%- if theme.three.three_waves %}
{%- set js_defer_vendors.three = 'three/three.min.js' %}
Expand Down
4 changes: 2 additions & 2 deletions scripts/filters/minify.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ hexo.extend.filter.register('after_generate', () => {
});
}

if (theme.vendors.jquery) {
hexo.route.remove('lib/jquery/index.js');
if (theme.vendors.anime) {
hexo.route.remove('lib/anime.min.js');
}

if (!theme.algolia_search.enable) {
Expand Down
7 changes: 7 additions & 0 deletions source/css/_common/components/footer/footer.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
color: $grey-dark;
font-size: $font-size-small;

&.footer-fixed {
bottom: 0;
left: 0;
position: fixed;
right: 0;
}

img {
border: 0;
}
Expand Down
4 changes: 4 additions & 0 deletions source/css/_common/components/header/site-nav.styl
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,8 @@
margin: 0 -10px;
padding: 0 10px;
}

&.site-nav-on {
display: block;
}
}
2 changes: 1 addition & 1 deletion source/css/_common/components/post/post-eof.styl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
width: 8%;
}

.post:last-child {
article:last-child {
.post-eof {
display: none;
}
Expand Down
5 changes: 5 additions & 0 deletions source/css/_common/components/third-party/search.styl
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ if (hexo-config('algolia_search.enable')) {
}

if (hexo-config('local_search.enable')) {
.search-loading-icon {
margin: 20% auto 0 auto;
text-align: center;
}

.search-popup {
ul.search-result-list {
margin: 0 5px;
Expand Down
4 changes: 0 additions & 4 deletions source/css/_common/scaffolding/helpers.styl
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@
}
}

.affix {
position: fixed;
}

.translation {
color: $grey-dark;
font-size: $font-size-small;
Expand Down
4 changes: 0 additions & 4 deletions source/css/_schemes/Pisces/_menu.styl
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@

+tablet() {
display: none;

&.site-nav-on {
display: block;
}
}
}

Expand Down
23 changes: 15 additions & 8 deletions source/js/bookmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ window.addEventListener('DOMContentLoaded', () => {
// If the page opens with a specific hash, just jump out
if (!isNaN(top) && location.hash === '') {
// Auto scroll to the position
$(document.documentElement).animate({
window.anime({
targets : document.documentElement,
duration : 200,
easing : 'linear',
scrollTop: top
}, 'fast');
});
}
};
// Register everything
Expand All @@ -36,12 +39,16 @@ window.addEventListener('DOMContentLoaded', () => {
link.addEventListener('click', event => {
event.preventDefault();
doSaveScroll();
$(link).animate({
top: -30
}, 'fast', () => {
setTimeout(() => {
link.style.top = '';
}, 400);
window.anime({
targets : link,
duration: 200,
easing : 'linear',
top : -30,
complete: () => {
setTimeout(() => {
link.style.top = '';
}, 400);
}
});
});
scrollToMark();
Expand Down
6 changes: 1 addition & 5 deletions source/js/local-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,11 +276,7 @@ window.addEventListener('DOMContentLoaded', () => {
// Search function
const searchFunc = () => {
document.querySelector('.search-pop-overlay').style.display = '';
document.querySelector('.search-pop-overlay').innerHTML = '<div id="search-loading-icon"><i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i></div>';
document.querySelector('#search-loading-icon').css({
margin : '20% auto 0 auto',
'text-align': 'center'
});
document.querySelector('.search-pop-overlay').innerHTML = '<div class="search-loading-icon"><i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i></div>';
fetchData(proceedSearch);
};

Expand Down
16 changes: 8 additions & 8 deletions source/js/motion.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global NexT, CONFIG */
/* global NexT, CONFIG, Velocity */

NexT.motion = {};

Expand Down Expand Up @@ -85,7 +85,7 @@ NexT.motion.middleWares = {
sequence[sequence.length - 1].o.complete = function() {
integrator.next();
};
$.Velocity.RunSequence(sequence);
Velocity.RunSequence(sequence);
} else {
integrator.next();
}
Expand All @@ -97,7 +97,7 @@ NexT.motion.middleWares = {

menu: function(integrator) {

$.Velocity(document.querySelectorAll('.menu-item'), 'transition.slideDownIn', {
Velocity(document.querySelectorAll('.menu-item'), 'transition.slideDownIn', {
display : null,
duration: 200,
complete: function() {
Expand Down Expand Up @@ -132,16 +132,16 @@ NexT.motion.middleWares = {
};

if (CONFIG.motion.transition.post_block) {
$.Velocity(postBlock, 'transition.' + postBlockTransition, postMotionOptions);
Velocity(postBlock, 'transition.' + postBlockTransition, postMotionOptions);
}
if (CONFIG.motion.transition.post_header) {
$.Velocity(postHeader, 'transition.' + postHeaderTransition, postMotionOptions);
Velocity(postHeader, 'transition.' + postHeaderTransition, postMotionOptions);
}
if (CONFIG.motion.transition.post_body) {
$.Velocity(postBody, 'transition.' + postBodyTransition, postMotionOptions);
Velocity(postBody, 'transition.' + postBodyTransition, postMotionOptions);
}
if (CONFIG.motion.transition.coll_header) {
$.Velocity(collHeader, 'transition.' + collHeaderTransition, postMotionOptions);
Velocity(collHeader, 'transition.' + collHeaderTransition, postMotionOptions);
}
}
if (NexT.utils.isPisces() || NexT.utils.isGemini()) {
Expand All @@ -155,7 +155,7 @@ NexT.motion.middleWares = {
var sidebarAffixTransition = CONFIG.motion.transition.sidebar;
// Only for Pisces | Gemini.
if (CONFIG.motion.transition.sidebar && (NexT.utils.isPisces() || NexT.utils.isGemini())) {
$.Velocity(sidebarAffix, 'transition.' + sidebarAffixTransition, {
Velocity(sidebarAffix, 'transition.' + sidebarAffixTransition, {
display : null,
duration: 200,
complete: function() {
Expand Down
65 changes: 41 additions & 24 deletions source/js/next-boot.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global NexT, CONFIG */
/* global NexT, CONFIG, Velocity */

NexT.boot = {};

Expand All @@ -9,39 +9,56 @@ NexT.boot.registerEvents = function() {

// Mobile top menu bar.
document.querySelector('.site-nav-toggle button').addEventListener('click', () => {
var $siteNav = $('.site-nav');
var siteNav = document.querySelector('.site-nav');
var ON_CLASS_NAME = 'site-nav-on';
var isSiteNavOn = $siteNav.hasClass(ON_CLASS_NAME);
var animateAction = isSiteNavOn ? 'slideUp' : 'slideDown';
var animateCallback = isSiteNavOn ? 'removeClass' : 'addClass';
var animateAction = siteNav.classList.contains(ON_CLASS_NAME) ? 'slideUp' : 'slideDown';

$siteNav.stop()[animateAction]('fast', () => {
$siteNav[animateCallback](ON_CLASS_NAME);
});
if (typeof Velocity === 'function') {
Velocity(siteNav, animateAction, {
duration: 200,
complete: function() {
siteNav.classList.toggle(ON_CLASS_NAME);
}
});
} else {
siteNav.classList.toggle(ON_CLASS_NAME);
}
});

var TAB_ANIMATE_DURATION = 200;
document.querySelectorAll('.sidebar-nav li').forEach(li => {
li.addEventListener('click', event => {
var item = $(event.currentTarget);
document.querySelectorAll('.sidebar-nav li').forEach((element, index) => {
element.addEventListener('click', event => {
var item = event.currentTarget;
var activeTabClassName = 'sidebar-nav-active';
var activePanelClassName = 'sidebar-panel-active';
if (item.hasClass(activeTabClassName)) return;
if (item.classList.contains(activeTabClassName)) return;

var target = $('.' + item.data('target'));
var currentTarget = target.siblings('.sidebar-panel');
currentTarget.animate({ opacity: 0 }, TAB_ANIMATE_DURATION, () => {
// Prevent adding TOC to Overview if Overview was selected when close & open sidebar.
currentTarget.removeClass(activePanelClassName);
target
.stop()
.css({ opacity: 0 })
.addClass(activePanelClassName)
.animate({ opacity: 1 }, TAB_ANIMATE_DURATION);
var targets = document.querySelectorAll('.sidebar-panel');
var target = targets[index];
var currentTarget = targets[1 - index];
window.anime({
targets : currentTarget,
duration: TAB_ANIMATE_DURATION,
easing : 'linear',
opacity : 0,
complete: () => {
// Prevent adding TOC to Overview if Overview was selected when close & open sidebar.
currentTarget.classList.remove(activePanelClassName);
target.style.opacity = 0;
target.classList.add(activePanelClassName);
window.anime({
targets : target,
duration: TAB_ANIMATE_DURATION,
easing : 'linear',
opacity : 1
});
}
});

item.siblings().removeClass(activeTabClassName);
item.addClass(activeTabClassName);
[...item.parentNode.children].forEach(element => {
element.classList.remove(activeTabClassName);
});
item.classList.add(activeTabClassName);
});
});

Expand Down
Loading