Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:部分站点文章点赞按钮和昼夜切换按钮不显示 #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions assets/js/joe.global.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
document.addEventListener("DOMContentLoaded", () => {
/* 初始化昼夜模式 */
{
var dayIcon = document.getElementById("dayIcon");
var nightIcon = document.getElementById("nightIcon");
if (localStorage.getItem("data-night")) {
$(".joe_action_item.mode .icon-1").addClass("active");
$(".joe_action_item.mode .icon-2").removeClass("active");
nightIcon.setAttribute("class","icon-1 active");
dayIcon.setAttribute("class","icon-2");
} else {
$("html").removeAttr("data-night");
$(".joe_action_item.mode .icon-1").removeClass("active");
$(".joe_action_item.mode .icon-2").addClass("active");
nightIcon.setAttribute("class","icon-1");
dayIcon.setAttribute("class","icon-2 active");
}
$(".joe_action_item.mode").on("click", () => {
if (localStorage.getItem("data-night")) {
$(".joe_action_item.mode .icon-1").removeClass("active");
$(".joe_action_item.mode .icon-2").addClass("active");
nightIcon.setAttribute("class","icon-1");
dayIcon.setAttribute("class","icon-2 active");
$("html").removeAttr("data-night");
localStorage.removeItem("data-night");
} else {
$(".joe_action_item.mode .icon-1").addClass("active");
$(".joe_action_item.mode .icon-2").removeClass("active");
nightIcon.setAttribute("class","icon-1 active");
dayIcon.setAttribute("class","icon-2");
$("html").attr("data-night", "night");
localStorage.setItem("data-night", "night");
}
Expand Down
Loading