mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-18 18:33:42 +00:00
Some minor fixes
This commit is contained in:
parent
036d2d3059
commit
5f6271d4b8
@ -609,10 +609,7 @@ valine:
|
||||
appKey: # Your leancloud application appkey
|
||||
placeholder: Just go go # Comment box placeholder
|
||||
avatar: mm # Gravatar style
|
||||
meta: # Custom comment header
|
||||
- nick
|
||||
- mail
|
||||
- link
|
||||
meta: [nick, mail, link] # Custom comment header
|
||||
pageSize: 10 # Pagination size
|
||||
language: # Language, available values: en, zh-cn
|
||||
visitor: false # Article reading statistic
|
||||
|
||||
@ -20,10 +20,8 @@
|
||||
commentButton.forEach(element => {
|
||||
let commentClass = element.classList[2];
|
||||
element.addEventListener('click', () => {
|
||||
commentButton.forEach(rmActive => rmActive.classList.remove('active'));
|
||||
element.classList.add('active');
|
||||
document.querySelectorAll('.comment-position').forEach(rmActive => rmActive.classList.remove('active'));
|
||||
document.querySelector(`.comment-position.${commentClass}`).classList.add('active');
|
||||
commentButton.forEach(active => active.classList.toggle('active', active === element));
|
||||
document.querySelectorAll('.comment-position').forEach(active => active.classList.toggle('active', active.classList.contains(commentClass)));
|
||||
if (CONFIG.comments.storage) {
|
||||
localStorage.setItem('comments_active', commentClass);
|
||||
}
|
||||
|
||||
@ -22,9 +22,7 @@ function postButton(args) {
|
||||
icon = icon.startsWith('fa') ? icon : 'fa fa-' + icon;
|
||||
title = title.trim();
|
||||
|
||||
return `<a class="btn" href="${url}"${title.length > 0 ? ` title="${title}"` : ''}>
|
||||
${icon.length > 0 ? `<i class="${icon}"></i>` : ''}${text}
|
||||
</a>`;
|
||||
return `<a class="btn" href="${url}"${title.length > 0 ? ` title="${title}"` : ''}>${icon.length > 0 ? `<i class="${icon}"></i>` : ''}${text}</a>`;
|
||||
}
|
||||
|
||||
hexo.extend.tag.register('button', postButton, {ends: false});
|
||||
|
||||
@ -8,7 +8,7 @@ NexT.boot.registerEvents = function() {
|
||||
NexT.utils.registerCanIUseTag();
|
||||
|
||||
// Mobile top menu bar.
|
||||
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', () => {
|
||||
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', event => {
|
||||
event.currentTarget.classList.toggle('toggle-close');
|
||||
const siteNav = document.querySelector('.site-nav');
|
||||
if (!siteNav) return;
|
||||
@ -57,9 +57,8 @@ NexT.boot.registerEvents = function() {
|
||||
});
|
||||
|
||||
[...item.parentNode.children].forEach(element => {
|
||||
element.classList.remove(activeTabClassName);
|
||||
element.classList.toggle(activeTabClassName, element === item);
|
||||
});
|
||||
item.classList.add(activeTabClassName);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -99,9 +99,9 @@ NexT.utils = {
|
||||
}
|
||||
document.body.removeChild(ta);
|
||||
});
|
||||
button.addEventListener('mouseleave', event => {
|
||||
element.addEventListener('mouseleave', () => {
|
||||
setTimeout(() => {
|
||||
event.target.querySelector('i').className = 'fa fa-clipboard fa-fw';
|
||||
button.querySelector('i').className = 'fa fa-clipboard fa-fw';
|
||||
}, 300);
|
||||
});
|
||||
});
|
||||
@ -131,7 +131,7 @@ NexT.utils = {
|
||||
let width = Number(element.width);
|
||||
let height = Number(element.height);
|
||||
if (width && height) {
|
||||
element.parentNode.style.paddingTop = (height / width * 100) + '%';
|
||||
box.style.paddingTop = (height / width * 100) + '%';
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -181,14 +181,12 @@ NexT.utils = {
|
||||
if (!target.classList.contains('active')) {
|
||||
// Add & Remove active class on `nav-tabs` & `tab-content`.
|
||||
[...target.parentNode.children].forEach(element => {
|
||||
element.classList.remove('active');
|
||||
element.classList.toggle('active', element === target);
|
||||
});
|
||||
target.classList.add('active');
|
||||
const tActive = document.getElementById(target.querySelector('a').getAttribute('href').replace('#', ''));
|
||||
const tActive = document.querySelector(target.querySelector('a').getAttribute('href'));
|
||||
[...tActive.parentNode.children].forEach(element => {
|
||||
element.classList.remove('active');
|
||||
element.classList.toggle('active', element === tActive);
|
||||
});
|
||||
tActive.classList.add('active');
|
||||
// Trigger event
|
||||
tActive.dispatchEvent(new Event('tabs:click', {
|
||||
bubbles: true
|
||||
@ -203,7 +201,7 @@ NexT.utils = {
|
||||
registerCanIUseTag: function() {
|
||||
// Get responsive height passed from iframe.
|
||||
window.addEventListener('message', ({ data }) => {
|
||||
if ((typeof data === 'string') && data.includes('ciu_embed')) {
|
||||
if (typeof data === 'string' && data.includes('ciu_embed')) {
|
||||
const featureID = data.split(':')[1];
|
||||
const height = data.split(':')[2];
|
||||
document.querySelector(`iframe[data-feature=${featureID}]`).style.height = parseInt(height, 10) + 5 + 'px';
|
||||
@ -237,7 +235,7 @@ NexT.utils = {
|
||||
const navItems = document.querySelectorAll('.post-toc li');
|
||||
const sections = [...navItems].map(element => {
|
||||
const link = element.querySelector('a.nav-link');
|
||||
const target = document.getElementById(decodeURI(link.getAttribute('href')).replace('#', ''));
|
||||
const target = document.querySelector(decodeURI(link.getAttribute('href')));
|
||||
// TOC item animation navigate.
|
||||
link.addEventListener('click', event => {
|
||||
event.preventDefault();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user