hexo-theme-next
Advanced tools
Comparing version 7.7.0 to 7.7.1
{ | ||
"name": "hexo-theme-next", | ||
"version": "7.7.0", | ||
"version": "7.7.1", | ||
"description": "Elegant and powerful theme for Hexo.", | ||
@@ -5,0 +5,0 @@ "main": "gulpfile.js", |
@@ -34,3 +34,3 @@ /* global hexo */ | ||
${iconText('comment-o', 'disqus')} | ||
<a title="disqus" href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl"> | ||
<a title="disqus" href="{{ url_for(post.path) }}#disqus_thread" itemprop="discussionUrl"> | ||
<span class="post-comments-count disqus-comment-count" data-disqus-identifier="{{ post.path }}" itemprop="commentCount"></span> | ||
@@ -37,0 +37,0 @@ </a> |
@@ -28,3 +28,3 @@ /* global hexo */ | ||
${iconText('comment-o', 'valine')} | ||
<a title="valine" href="{{ url_for(post.path) }}#comments" itemprop="discussionUrl"> | ||
<a title="valine" href="{{ url_for(post.path) }}#valine-comments" itemprop="discussionUrl"> | ||
<span class="post-comments-count valine-comment-count" data-xid="{{ url_for(post.path) }}" itemprop="commentCount"></span> | ||
@@ -31,0 +31,0 @@ </a> |
@@ -8,11 +8,7 @@ /* global hexo */ | ||
const theme = hexo.theme.config; | ||
const filters = { | ||
exturl : theme.exturl, | ||
lazyload: theme.lazyload | ||
}; | ||
if (!filters.exturl && !filters.lazyload) return; | ||
if (filters.lazyload) { | ||
if (!theme.exturl && !theme.lazyload) return; | ||
if (theme.lazyload) { | ||
data.content = data.content.replace(/(<img[^>]*) src=/img, '$1 data-src='); | ||
} | ||
if (filters.exturl) { | ||
if (theme.exturl) { | ||
const url = require('url'); | ||
@@ -19,0 +15,0 @@ var siteHost = url.parse(config.url).hostname || config.url; |
@@ -84,5 +84,5 @@ /* global CONFIG */ | ||
return { | ||
hits : hits, | ||
start : start, | ||
end : end, | ||
hits, | ||
start, | ||
end, | ||
searchTextCount: searchTextCountInSlice | ||
@@ -283,3 +283,3 @@ }; | ||
input.addEventListener('keypress', event => { | ||
if (event.keyCode === 13) { | ||
if (event.key === 'Enter') { | ||
inputEventFunction(); | ||
@@ -286,0 +286,0 @@ } |
@@ -48,3 +48,3 @@ /* global NexT, CONFIG, Velocity */ | ||
e: element, | ||
p: {translateX: translateX}, | ||
p: {translateX}, | ||
o: { | ||
@@ -102,3 +102,2 @@ duration : 500, | ||
menu: function(integrator) { | ||
Velocity(document.querySelectorAll('.menu-item'), 'transition.slideDownIn', { | ||
@@ -117,4 +116,13 @@ display : null, | ||
subMenu: function(integrator) { | ||
var subMenuItem = document.querySelectorAll('.sub-menu .menu-item'); | ||
if (subMenuItem.length > 0) { | ||
subMenuItem.forEach(element => { | ||
element.style.opacity = 1; | ||
}); | ||
} | ||
integrator.next(); | ||
}, | ||
postList: function(integrator) { | ||
var postBlock = document.querySelectorAll('.post-block, .pagination, .comments'); | ||
@@ -128,5 +136,4 @@ var postBlockTransition = CONFIG.motion.transition.post_block; | ||
var collHeaderTransition = CONFIG.motion.transition.coll_header; | ||
var hasPost = postBlock.length > 0; | ||
if (hasPost) { | ||
if (postBlock.length > 0) { | ||
var postMotionOptions = window.postMotionOptions || { | ||
@@ -133,0 +140,0 @@ stagger : 100, |
@@ -8,3 +8,3 @@ /* global NexT, CONFIG, Velocity */ | ||
var SIDEBAR_DISPLAY_DURATION = 400; | ||
var mousePos = {}; var touchPos = {}; | ||
var mousePos = {}; | ||
@@ -38,5 +38,2 @@ var sidebarToggleLines = { | ||
document.querySelector('.sidebar-toggle').addEventListener('mouseleave', this.mouseLeaveHandler.bind(this)); | ||
this.sidebarEl.addEventListener('touchstart', this.touchstartHandler.bind(this)); | ||
this.sidebarEl.addEventListener('touchend', this.touchendHandler.bind(this)); | ||
this.sidebarEl.addEventListener('touchmove', event => event.preventDefault()); | ||
window.addEventListener('sidebar:show', this.showSidebar.bind(this)); | ||
@@ -70,14 +67,2 @@ window.addEventListener('sidebar:hide', this.hideSidebar.bind(this)); | ||
}, | ||
touchstartHandler: function(event) { | ||
touchPos.X = event.touches[0].clientX; | ||
touchPos.Y = event.touches[0].clientY; | ||
}, | ||
touchendHandler: function(event) { | ||
var deltaX = event.changedTouches[0].clientX - touchPos.X; | ||
var deltaY = event.changedTouches[0].clientY - touchPos.Y; | ||
var effectiveSliding = Math.abs(deltaY) < 20 && ((deltaX > 30 && isRight) || (deltaX < -30 && !isRight)); | ||
if (this.isSidebarVisible && effectiveSliding) { | ||
this.hideSidebar(); | ||
} | ||
}, | ||
showSidebar: function() { | ||
@@ -84,0 +69,0 @@ this.isSidebarVisible = true; |
@@ -23,3 +23,6 @@ /* global NexT, CONFIG */ | ||
let targetHeight = window.innerHeight; | ||
if (offsetTop != null && this.affixed === 'top') return scrollTop < offsetTop ? 'top' : false; | ||
if (offsetTop != null && this.affixed === 'top') { | ||
if (document.querySelector('.content-wrap').offsetHeight < offsetTop) return 'top'; | ||
return scrollTop < offsetTop ? 'top' : false; | ||
} | ||
if (this.affixed === 'bottom') { | ||
@@ -47,3 +50,3 @@ if (offsetTop != null) return this.unpin <= this.element.getBoundingClientRect().top ? false : 'bottom'; | ||
if (window.getComputedStyle(this.element).display === 'none') return; | ||
let height = this.element.offsetHeight - (CONFIG.sidebar.padding * 2); | ||
let height = this.element.offsetHeight; | ||
let offset = this.offset; | ||
@@ -71,12 +74,9 @@ let offsetTop = offset.top; | ||
let headerOffset = document.querySelector('.header-inner').offsetHeight + sidebarOffset; | ||
let footer = document.querySelector('.footer'); | ||
let footerInner = document.querySelector('.footer-inner'); | ||
let footerMargin = footer.offsetHeight - footerInner.offsetHeight; | ||
let footerOffset = footer.offsetHeight + footerMargin; | ||
let headerOffset = document.querySelector('.header-inner').offsetHeight; | ||
let footerOffset = document.querySelector('.footer').offsetHeight; | ||
document.querySelector('.sidebar').style.marginTop = headerOffset + 'px'; | ||
document.querySelector('.sidebar').style.marginTop = headerOffset + sidebarOffset + 'px'; | ||
return { | ||
top : headerOffset - sidebarOffset, | ||
top : headerOffset, | ||
bottom: footerOffset | ||
@@ -83,0 +83,0 @@ }; |
@@ -138,3 +138,2 @@ /* global NexT, CONFIG */ | ||
window.addEventListener('scroll', () => { | ||
var scrollPercent; | ||
if (backToTop || readingProgressBar) { | ||
@@ -144,12 +143,11 @@ var docHeight = document.querySelector('.container').offsetHeight; | ||
var contentVisibilityHeight = docHeight > winHeight ? docHeight - winHeight : document.body.scrollHeight - winHeight; | ||
var scrollPercentRounded = Math.round(100 * window.scrollY / contentVisibilityHeight); | ||
scrollPercent = Math.min(scrollPercentRounded, 100) + '%'; | ||
var scrollPercent = Math.min(100 * window.scrollY / contentVisibilityHeight, 100); | ||
if (backToTop) { | ||
backToTop.classList.toggle('back-to-top-on', window.scrollY > THRESHOLD); | ||
backToTop.querySelector('span').innerText = Math.round(scrollPercent) + '%'; | ||
} | ||
if (readingProgressBar) { | ||
readingProgressBar.style.width = scrollPercent.toFixed(2) + '%'; | ||
} | ||
} | ||
if (backToTop) { | ||
backToTop.classList.toggle('back-to-top-on', window.scrollY > THRESHOLD); | ||
backToTop.querySelector('span').innerText = scrollPercent; | ||
} | ||
if (readingProgressBar) { | ||
readingProgressBar.style.width = scrollPercent; | ||
} | ||
}); | ||
@@ -201,8 +199,7 @@ | ||
// Get responsive height passed from iframe. | ||
window.addEventListener('message', event => { | ||
var data = event.data; | ||
if ((typeof data === 'string') && (data.indexOf('ciu_embed') > -1)) { | ||
window.addEventListener('message', ({ data }) => { | ||
if ((typeof data === 'string') && data.includes('ciu_embed')) { | ||
var featureID = data.split(':')[1]; | ||
var height = data.split(':')[2]; | ||
document.querySelector(`iframe[data-feature=${featureID}]`).style.height = parseInt(height, 10) + 'px'; | ||
document.querySelector(`iframe[data-feature=${featureID}]`).style.height = parseInt(height, 10) + 5 + 'px'; | ||
} | ||
@@ -209,0 +206,0 @@ }, false); |
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
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
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
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
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
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
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
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
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
Sorry, the diff of this file is not supported yet
1134978
300
4890