hexo-theme-next
Advanced tools
Comparing version
@@ -23,4 +23,4 @@ <div align="right"> | ||
[](https://github.com/next-theme/hexo-theme-next/blob/master/LICENSE.md) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) | ||
[](https://coveralls.io/github/next-theme/hexo-theme-next) | ||
@@ -27,0 +27,0 @@ |
@@ -23,4 +23,4 @@ <div align="right"> | ||
[](https://github.com/next-theme/hexo-theme-next/blob/master/LICENSE.md) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) | ||
[](https://coveralls.io/github/next-theme/hexo-theme-next) | ||
@@ -27,0 +27,0 @@ |
{ | ||
"name": "hexo-theme-next", | ||
"version": "8.14.0", | ||
"version": "8.14.1", | ||
"description": "Elegant and powerful theme for Hexo.", | ||
@@ -38,10 +38,10 @@ "main": "package.json", | ||
"chai": "4.3.7", | ||
"eslint": "8.28.0", | ||
"eslint": "8.31.0", | ||
"hexo": "6.3.0", | ||
"hexo-renderer-marked": "6.0.0", | ||
"js-yaml": "4.1.0", | ||
"mocha": "10.1.0", | ||
"stylelint": "14.15.0", | ||
"mocha": "10.2.0", | ||
"stylelint": "14.16.1", | ||
"stylelint-stylus": "0.17.0" | ||
} | ||
} |
@@ -23,4 +23,4 @@ <div align="right"> | ||
[](https://github.com/next-theme/hexo-theme-next/blob/master/LICENSE.md) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ALinter) | ||
[](https://github.com/next-theme/hexo-theme-next/actions?query=workflow%3ATester) | ||
[](https://coveralls.io/github/next-theme/hexo-theme-next) | ||
@@ -27,0 +27,0 @@ |
@@ -13,3 +13,3 @@ /* global hexo */ | ||
injects.comment.raw('disqusjs', ` | ||
<div class="comments disqusjs"> | ||
<div class="comments disqusjs-container"> | ||
<noscript>Please enable JavaScript to view the comments powered by Disqus.</noscript> | ||
@@ -16,0 +16,0 @@ </div> |
@@ -45,3 +45,3 @@ 'use strict'; | ||
// Only for simple link need to rewrite/add attributes. | ||
attrs.rel = 'noopener'; | ||
attrs.rel = attrs.rel || 'noopener'; | ||
attrs.target = '_blank'; | ||
@@ -48,0 +48,0 @@ } else { |
@@ -90,5 +90,5 @@ /* global NexT, CONFIG */ | ||
function animate(animation, selector) { | ||
function animate(animation, elements) { | ||
if (!animation) return; | ||
document.querySelectorAll(selector).forEach(targets => { | ||
elements.forEach(targets => { | ||
sequence.push({ | ||
@@ -102,7 +102,15 @@ targets, | ||
animate(post_block, '.post-block, .pagination, .comments'); | ||
animate(coll_header, '.collection-header'); | ||
animate(post_header, '.post-header'); | ||
animate(post_body, '.post-body'); | ||
document.querySelectorAll('.post-block').forEach(targets => { | ||
sequence.push({ | ||
targets, | ||
complete: () => targets.classList.add('animated', post_block), | ||
deltaT : '-=100' | ||
}); | ||
animate(coll_header, targets.querySelectorAll('.collection-header')); | ||
animate(post_header, targets.querySelectorAll('.post-header')); | ||
animate(post_body, targets.querySelectorAll('.post-body')); | ||
}); | ||
animate(post_block, document.querySelectorAll('.pagination, .comments')); | ||
return sequence; | ||
@@ -109,0 +117,0 @@ }, |
@@ -17,3 +17,3 @@ /* global NexT, CONFIG, DisqusJS */ | ||
}); | ||
window.dsqjs.render(document.querySelector('.disqusjs')); | ||
window.dsqjs.render(document.querySelector('.disqusjs-container')); | ||
}); | ||
@@ -20,0 +20,0 @@ }); |
@@ -174,2 +174,13 @@ /* global NexT, CONFIG */ | ||
const nav = element.parentNode; | ||
// Get the height of `tab-pane` which is activated before, and set it as the height of `tab-content` with extra margin / paddings. | ||
const tabContent = nav.nextElementSibling; | ||
tabContent.style.overflow = 'hidden'; | ||
tabContent.style.transition = 'height 1s'; | ||
// Comment system selection tab does not contain .active class. | ||
const activeTab = tabContent.querySelector('.active') || tabContent.firstElementChild; | ||
// Hight might be `auto`. | ||
const prevHeight = parseInt(window.getComputedStyle(activeTab).height.replace('px', ''), 10) || 0; | ||
const paddingTop = parseInt(window.getComputedStyle(activeTab).paddingTop.replace('px', ''), 10); | ||
const marginBottom = parseInt(window.getComputedStyle(activeTab.firstElementChild).marginBottom.replace('px', ''), 10); | ||
tabContent.style.height = prevHeight + paddingTop + marginBottom + 'px'; | ||
// Add & Remove active class on `nav-tabs` & `tab-content`. | ||
@@ -188,2 +199,21 @@ [...nav.children].forEach(target => { | ||
})); | ||
// Get the height of `tab-pane` which is activated now. | ||
const hasScrollBar = document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight); | ||
const currHeight = parseInt(window.getComputedStyle(tabContent.querySelector('.active')).height.replace('px', ''), 10); | ||
// Reset the height of `tab-content` and see the animation. | ||
tabContent.style.height = currHeight + paddingTop + marginBottom + 'px'; | ||
// Change the height of `tab-content` may cause scrollbar show / disappear, which may result in the change of the `tab-pane`'s height | ||
setTimeout(() => { | ||
if ((document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight)) !== hasScrollBar) { | ||
tabContent.style.transition = 'height 0.3s linear'; | ||
// After the animation, we need reset the height of `tab-content` again. | ||
const currHeightAfterScrollBarChange = parseInt(window.getComputedStyle(tabContent.querySelector('.active')).height.replace('px', ''), 10); | ||
tabContent.style.height = currHeightAfterScrollBarChange + paddingTop + marginBottom + 'px'; | ||
} | ||
// Remove all the inline styles, and let the height be adaptive again. | ||
setTimeout(() => { | ||
tabContent.style.transition = ''; | ||
tabContent.style.height = ''; | ||
}, 250); | ||
}, 1000); | ||
if (!CONFIG.stickytabs) return; | ||
@@ -190,0 +220,0 @@ const offset = nav.parentNode.getBoundingClientRect().top + window.scrollY + 10; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
461433
0.66%3017
1.24%