mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 20:30:53 +08:00
@@ -1,28 +1,31 @@
|
||||
$(function() {
|
||||
$(function () {
|
||||
changeReadModel();
|
||||
|
||||
function switchReadMode() {
|
||||
var next_mode = $("body").hasClass("night-mode") ? "day" : "night";
|
||||
Cookies.set("read-mode", next_mode, {expires: 7, path: '/'});
|
||||
Cookies.set("night-mode", next_mode, {
|
||||
expires: 7,
|
||||
path: '/'
|
||||
});
|
||||
changeReadModel();
|
||||
}
|
||||
|
||||
function changeReadModel() {
|
||||
if (Cookies.get("read-mode") == "night") {
|
||||
if (Cookies.get("night-mode") == "night") {
|
||||
$("body").addClass("night-mode");
|
||||
$("#nightshift").removeClass("fa-moon-o").addClass("fa-sun-o");
|
||||
}
|
||||
|
||||
// 非夜間模式
|
||||
if (Cookies.get("read-mode") == "day") {
|
||||
if (Cookies.get("night-mode") == "day") {
|
||||
$("body").removeClass("night-mode");
|
||||
$("#nightshift").removeClass("fa-sun-o").addClass("fa-moon-o");
|
||||
}
|
||||
}
|
||||
|
||||
$("#nightshift").click(function() {
|
||||
$("#nightshift").click(function () {
|
||||
switchReadMode();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user