hexo-theme-next
Advanced tools
Comparing version 8.8.0 to 8.8.1
{ | ||
"name": "hexo-theme-next", | ||
"version": "8.8.0", | ||
"version": "8.8.1", | ||
"description": "Elegant and powerful theme for Hexo.", | ||
@@ -37,7 +37,7 @@ "main": "package.json", | ||
"chai": "4.3.4", | ||
"eslint": "7.32.0", | ||
"eslint": "8.1.0", | ||
"hexo": "5.4.0", | ||
"hexo-renderer-marked": "4.1.0", | ||
"js-yaml": "4.1.0", | ||
"mocha": "9.1.2", | ||
"mocha": "9.1.3", | ||
"nyc": "15.1.0", | ||
@@ -44,0 +44,0 @@ "stylint": "2.0.0" |
@@ -28,6 +28,8 @@ /* global NexT, CONFIG, Pjax */ | ||
} | ||
const hasTOC = document.querySelector('.post-toc'); | ||
document.querySelector('.sidebar-inner').classList.toggle('sidebar-nav-active', hasTOC); | ||
NexT.utils.activateSidebarPanel(hasTOC ? 0 : 1); | ||
NexT.utils.updateSidebarPosition(); | ||
if (CONFIG.sidebar.display !== 'remove') { | ||
const hasTOC = document.querySelector('.post-toc'); | ||
document.querySelector('.sidebar-inner').classList.toggle('sidebar-nav-active', hasTOC); | ||
NexT.utils.activateSidebarPanel(hasTOC ? 0 : 1); | ||
NexT.utils.updateSidebarPosition(); | ||
} | ||
}); |
@@ -6,8 +6,7 @@ /* global CONFIG */ | ||
const isRight = CONFIG.sidebar.position === 'right'; | ||
const mousePos = {}; | ||
const sidebarToggleMotion = { | ||
lines: document.querySelector('.sidebar-toggle'), | ||
mouse: {}, | ||
init : function() { | ||
window.addEventListener('mousedown', this.mousedownHandler); | ||
window.addEventListener('mousedown', this.mousedownHandler.bind(this)); | ||
window.addEventListener('mouseup', this.mouseupHandler.bind(this)); | ||
@@ -20,8 +19,8 @@ document.querySelector('.sidebar-dimmer').addEventListener('click', this.clickHandler.bind(this)); | ||
mousedownHandler: function(event) { | ||
mousePos.X = event.pageX; | ||
mousePos.Y = event.pageY; | ||
this.mouse.X = event.pageX; | ||
this.mouse.Y = event.pageY; | ||
}, | ||
mouseupHandler: function(event) { | ||
const deltaX = event.pageX - mousePos.X; | ||
const deltaY = event.pageY - mousePos.Y; | ||
const deltaX = event.pageX - this.mouse.X; | ||
const deltaY = event.pageY - this.mouse.Y; | ||
const clickingBlankPart = Math.hypot(deltaX, deltaY) < 20 && event.target.matches('.main'); | ||
@@ -52,3 +51,3 @@ // Fancybox has z-index property, but medium-zoom does not, so the sidebar will overlay the zoomed image. | ||
}; | ||
sidebarToggleMotion.init(); | ||
if (CONFIG.sidebar.display !== 'remove') sidebarToggleMotion.init(); | ||
@@ -55,0 +54,0 @@ function updateFooterPosition() { |
@@ -9,10 +9,2 @@ /* global NexT, CONFIG */ | ||
// https://caniuse.com/mdn-api_element_classlist_replace | ||
if (typeof DOMTokenList.prototype.replace !== 'function') { | ||
DOMTokenList.prototype.replace = function(remove, add) { | ||
this.remove(remove); | ||
this.add(add); | ||
}; | ||
} | ||
(function() { | ||
@@ -19,0 +11,0 @@ const onPageLoaded = () => document.dispatchEvent( |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
437752
2845