mirror of
https://github.com/mashirozx/sakura.git
synced 2024-11-26 08:48:13 +08:00
简化代码
This commit is contained in:
parent
9a0840bc93
commit
e778d03f56
@ -300,7 +300,7 @@ function checkskinSecter() {
|
|||||||
function checkBgImgCookie() {
|
function checkBgImgCookie() {
|
||||||
var bgurl = getCookie("bgImgSetting");
|
var bgurl = getCookie("bgImgSetting");
|
||||||
if (bgurl != "") {
|
if (bgurl != "") {
|
||||||
$(".skin-menu #" + bgurl + "-bg").click();
|
$(".skin-menu #" + bgurl).click();
|
||||||
} else {
|
} else {
|
||||||
$(".skin-menu #white-bg").click();
|
$(".skin-menu #white-bg").click();
|
||||||
}
|
}
|
||||||
@ -328,12 +328,10 @@ $(document).ready(function() {
|
|||||||
$(".skin-menu #" + tagid).click(function() {
|
$(".skin-menu #" + tagid).click(function() {
|
||||||
if (tagid == "white-bg") {
|
if (tagid == "white-bg") {
|
||||||
mashiro_global.variables.skinSecter = true;
|
mashiro_global.variables.skinSecter = true;
|
||||||
$(".pattern-center-sakura").removeClass('pattern-center-sakura').addClass('pattern-center');
|
checkskinSecter();
|
||||||
$(".headertop-bar-sakura").removeClass('headertop-bar-sakura').addClass('headertop-bar');
|
|
||||||
} else {
|
} else {
|
||||||
mashiro_global.variables.skinSecter = false;
|
mashiro_global.variables.skinSecter = false;
|
||||||
$(".pattern-center").removeClass('pattern-center').addClass('pattern-center-sakura');
|
checkskinSecter();
|
||||||
$(".headertop-bar").removeClass('headertop-bar').addClass('headertop-bar-sakura');
|
|
||||||
}
|
}
|
||||||
if (tagid == "dark-bg") {
|
if (tagid == "dark-bg") {
|
||||||
$("#night-mode-cover").css("visibility", "visible");
|
$("#night-mode-cover").css("visibility", "visible");
|
||||||
@ -342,37 +340,30 @@ $(document).ready(function() {
|
|||||||
switch (tagid) {
|
switch (tagid) {
|
||||||
case "white-bg":
|
case "white-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg0) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg0) + ")");
|
||||||
setCookie("bgImgSetting", "white", 30);
|
|
||||||
break;
|
break;
|
||||||
case "sakura-bg":
|
case "sakura-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg1) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg1) + ")");
|
||||||
setCookie("bgImgSetting", "sakura", 30);
|
|
||||||
break;
|
break;
|
||||||
case "gribs-bg":
|
case "gribs-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg2) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg2) + ")");
|
||||||
setCookie("bgImgSetting", "gribs", 30);
|
|
||||||
break;
|
break;
|
||||||
case "pixiv-bg":
|
case "pixiv-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg3) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg3) + ")");
|
||||||
setCookie("bgImgSetting", "pixiv", 30);
|
|
||||||
break;
|
break;
|
||||||
case "KAdots-bg":
|
case "KAdots-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg4) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg4) + ")");
|
||||||
setCookie("bgImgSetting", "KAdots", 30);
|
|
||||||
break;
|
break;
|
||||||
case "totem-bg":
|
case "totem-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg5) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg5) + ")");
|
||||||
setCookie("bgImgSetting", "totem", 30);
|
|
||||||
break;
|
break;
|
||||||
case "bing-bg":
|
case "bing-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg6) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg6) + ")");
|
||||||
setCookie("bgImgSetting", "bing", 30);
|
|
||||||
break;
|
break;
|
||||||
case "dark-bg":
|
case "dark-bg":
|
||||||
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg7) + ")");
|
$("body").css("background-image", "url(" + checkskin_bg(mashiro_option.skin_bg7) + ")");
|
||||||
setCookie("bgImgSetting", "dark", 30);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
setCookie("bgImgSetting", tagid, 30);
|
||||||
closeSkinMenu();
|
closeSkinMenu();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -419,9 +410,9 @@ if (document.body.clientWidth <= 860) {
|
|||||||
|
|
||||||
function scrollFunction() {
|
function scrollFunction() {
|
||||||
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
|
||||||
document.getElementById("moblieGoTop").style.display = "block";
|
addComment.I("moblieGoTop").style.display = "block";
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("moblieGoTop").style.display = "none";
|
addComment.I("moblieGoTop").style.display = "none";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,8 +476,8 @@ timeSeriesReload();
|
|||||||
|
|
||||||
/*视频feature*/
|
/*视频feature*/
|
||||||
function coverVideo() {
|
function coverVideo() {
|
||||||
var video = document.getElementById("coverVideo");
|
var video = addComment.I("coverVideo");
|
||||||
var btn = document.getElementById("coverVideo-btn");
|
var btn = addComment.I("coverVideo-btn");
|
||||||
|
|
||||||
if (video.paused) {
|
if (video.paused) {
|
||||||
video.play();
|
video.play();
|
||||||
@ -504,8 +495,8 @@ function coverVideo() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function killCoverVideo() {
|
function killCoverVideo() {
|
||||||
var video = document.getElementById("coverVideo");
|
var video = addComment.I("coverVideo");
|
||||||
var btn = document.getElementById("coverVideo-btn");
|
var btn = addComment.I("coverVideo-btn");
|
||||||
|
|
||||||
if (video.paused) {
|
if (video.paused) {
|
||||||
//console.info('none:killCoverVideo()');
|
//console.info('none:killCoverVideo()');
|
||||||
@ -520,7 +511,7 @@ function killCoverVideo() {
|
|||||||
|
|
||||||
function coverVideoIni() {
|
function coverVideoIni() {
|
||||||
if ($('video').hasClass('hls')) {
|
if ($('video').hasClass('hls')) {
|
||||||
var video = document.getElementById('coverVideo');
|
var video = addComment.I('coverVideo');
|
||||||
var video_src = $('#coverVideo').attr('data-src');
|
var video_src = $('#coverVideo').attr('data-src');
|
||||||
if(Hls.isSupported()) {
|
if(Hls.isSupported()) {
|
||||||
var hls = new Hls();
|
var hls = new Hls();
|
||||||
@ -690,8 +681,8 @@ function grin(tag, type, before, after) {
|
|||||||
} else {
|
} else {
|
||||||
tag = ' :' + tag + ': ';
|
tag = ' :' + tag + ': ';
|
||||||
}
|
}
|
||||||
if (document.getElementById('comment') && document.getElementById('comment').type == 'textarea') {
|
if (addComment.I('comment') && addComment.I('comment').type == 'textarea') {
|
||||||
myField = document.getElementById('comment');
|
myField = addComment.I('comment');
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1371,8 +1362,8 @@ var home = location.href,
|
|||||||
var QueryStorage = [];
|
var QueryStorage = [];
|
||||||
search_a("https://"+document.domain+"/wp-json/cache_search/v1/json/");
|
search_a("https://"+document.domain+"/wp-json/cache_search/v1/json/");
|
||||||
|
|
||||||
var otxt = document.getElementById("search-input"),
|
var otxt = addComment.I("search-input"),
|
||||||
list = document.getElementById("PostlistBox"),
|
list = addComment.I("PostlistBox"),
|
||||||
Record = list.innerHTML,
|
Record = list.innerHTML,
|
||||||
searchFlag = null;
|
searchFlag = null;
|
||||||
otxt.oninput = function () {
|
otxt.oninput = function () {
|
||||||
@ -1482,7 +1473,7 @@ var home = location.href,
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w && (y = y + G + "文章" + E + w + D), u && (y = y + G + "页面" + E + u + D), r && (y = y + G + "分类" + E + r + D), p && (y = y + G + "标签" + E + p + D), F && (y = y + G + "评论" + E + F + D), s = document.getElementById("PostlistBox"), s.innerHTML = y
|
w && (y = y + G + "文章" + E + w + D), u && (y = y + G + "页面" + E + u + D), r && (y = y + G + "分类" + E + r + D), p && (y = y + G + "标签" + E + p + D), F && (y = y + G + "评论" + E + F + D), s = addComment.I("PostlistBox"), s.innerHTML = y
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1535,9 +1526,9 @@ var home = location.href,
|
|||||||
var intersectionObserver = new IntersectionObserver(function (entries) {
|
var intersectionObserver = new IntersectionObserver(function (entries) {
|
||||||
if (entries[0].intersectionRatio <= 0) return;
|
if (entries[0].intersectionRatio <= 0) return;
|
||||||
var page_next = $('#pagination a').attr("href");
|
var page_next = $('#pagination a').attr("href");
|
||||||
var load_key = document.getElementById("add_post_time");
|
var load_key = addComment.I("add_post_time");
|
||||||
if(page_next!=undefined && load_key ){
|
if(page_next!=undefined && load_key ){
|
||||||
var load_time = document.getElementById("add_post_time").title;
|
var load_time = addComment.I("add_post_time").title;
|
||||||
if(load_time !="233"){
|
if(load_time !="233"){
|
||||||
console.log("%c 自动加载时倒计时 %c","background:#9a9da2; color:#ffffff; border-radius:4px;","","",load_time);
|
console.log("%c 自动加载时倒计时 %c","background:#9a9da2; color:#ffffff; border-radius:4px;","","",load_time);
|
||||||
load_post_timer=setTimeout(function(){load_post();},load_time*1000);
|
load_post_timer=setTimeout(function(){load_post();},load_time*1000);
|
||||||
@ -1856,7 +1847,7 @@ if ((isWebkit || isOpera || isIe) && document.getElementById && window.addEventL
|
|||||||
if (!(/^[A-z0-9_-]+$/.test(id))) {
|
if (!(/^[A-z0-9_-]+$/.test(id))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
element = document.getElementById(id);
|
element = addComment.I(id);
|
||||||
if (element) {
|
if (element) {
|
||||||
if (!(/^(?:a|select|input|button|textarea)$/i.test(element.tagName))) {
|
if (!(/^(?:a|select|input|button|textarea)$/i.test(element.tagName))) {
|
||||||
element.tabIndex = -1;
|
element.tabIndex = -1;
|
||||||
|
Loading…
Reference in New Issue
Block a user