2023-04-26 06:12:09 +00:00
|
|
|
|
/* global CONFIG */
|
|
|
|
|
|
|
|
|
|
window.addEventListener('tabs:register', () => {
|
|
|
|
|
let { activeClass } = CONFIG.comments;
|
|
|
|
|
if (CONFIG.comments.storage) {
|
|
|
|
|
activeClass = localStorage.getItem('comments_active') || activeClass;
|
|
|
|
|
}
|
|
|
|
|
if (activeClass) {
|
|
|
|
|
const activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
|
|
|
|
|
if (activeTab) {
|
|
|
|
|
activeTab.click();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (CONFIG.comments.storage) {
|
|
|
|
|
window.addEventListener('tabs:click', event => {
|
|
|
|
|
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
|
|
|
|
|
const commentClass = event.target.classList[1];
|
|
|
|
|
localStorage.setItem('comments_active', commentClass);
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-05-07 10:17:41 +00:00
|
|
|
|
// 首先获取所有菜单的超链接
|
|
|
|
|
let menus = document.querySelectorAll(".site-nav a");
|
|
|
|
|
|
2023-05-08 03:41:10 +00:00
|
|
|
|
// // 遍历这些超链接对象
|
|
|
|
|
// for (let menu of menus) {
|
|
|
|
|
// // 找到想要操作的超链接对象。例如我在分类页面添加了自定义JS,想要排除分类页面
|
|
|
|
|
// if (menu.getAttribute("href")==="/tags/") {
|
|
|
|
|
// // 修改这个超链接对象的属性值
|
|
|
|
|
// menu.setAttribute("data-pjax-state", "unload");
|
|
|
|
|
// }
|
|
|
|
|
// }
|