修正返回和黑暗模式下面友连颜色不一致的bug

This commit is contained in:
yumo 2023-02-06 00:04:13 +08:00
parent 5e21c27aae
commit 2a730880f3
6 changed files with 480 additions and 231 deletions

File diff suppressed because one or more lines are too long

View File

@ -252,7 +252,7 @@
<div class="list-plane-title"> <div class="list-plane-title">
<div>友情链接 <span class="list-plane-linksdescribe"></span></div> <div>友情链接 <span class="list-plane-linksdescribe"></span></div>
</div> </div>
<div class="friend-links-list"> <div class="friend-links-list friend-links-card-list">
{ape:flink pagesize="5"} {ape:flink pagesize="5"}
<a class="friend-links-item-card" href="{$field['url']}" target="_blank"> <a class="friend-links-item-card" href="{$field['url']}" target="_blank">
{notempty name="$field['image']"} {notempty name="$field['image']"}

View File

@ -0,0 +1 @@
(function(r,e){if(typeof exports==="object"){module.exports=exports=e()}else if(typeof define==="function"&&define.amd){define(e)}else{window.BASE64=e()}})(this,function(){var d=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","+","/"];var p=["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","0","1","2","3","4","5","6","7","8","9","-","_"];var w=function(r){var e=[];while(r>0){var a=r%2;r=Math.floor(r/2);e.push(a)}e.reverse();return e};var l=function(r){var e=0;var a=0;for(var n=r.length-1;n>=0;--n){var t=r[n];if(t==1){e+=Math.pow(2,a)}++a}return e};var v=function(r,e){var a=8-(r+1)+(r-1)*6;var n=e.length;var t=a-n;while(--t>=0){e.unshift(0)}var f=[];var i=r;while(--i>=0){f.push(1)}f.push(0);var v=0,o=8-(r+1);for(;v<o;++v){f.push(e[v])}for(var c=0;c<r-1;++c){f.push(1);f.push(0);var u=6;while(--u>=0){f.push(e[v++])}}return f};var h=function(r){var e=[];for(var a=0,n=r.length;a<n;++a){var t=r.charCodeAt(a);var f=w(t);if(t<128){var i=8-f.length;while(--i>=0){f.unshift(0)}e=e.concat(f)}else if(t>=128&&t<=2047){e=e.concat(v(2,f))}else if(t>=2048&&t<=65535){e=e.concat(v(3,f))}else if(t>=65536&&t<=2097151){e=e.concat(v(4,f))}else if(t>=2097152&&t<=67108863){e=e.concat(v(5,f))}else if(t>=4e6&&t<=2147483647){e=e.concat(v(6,f))}}return e};var b=function(r){var e;var a=[];var n="";for(var t=0,f=r.length;t<f;){if(r[t]==0){e=l(r.slice(t,t+8));n+=String.fromCharCode(e);t+=8}else{var i=0;while(t<f){if(r[t]==1){++i}else{break}++t}a=a.concat(r.slice(t+1,t+8-i));t+=8-i;while(i>1){a=a.concat(r.slice(t+2,t+8));t+=8;--i}e=l(a);n+=String.fromCharCode(e);a=[]}}return n};var e=function(r,e){var a=[];var n=h(r);var t=e?p:d;var f=0;for(var i=0,v=n.length;i<v;i+=6){var o=i+6-v;if(o==2){f=2}else if(o==4){f=4}var c=f;while(--c>=0){n.push(0)}a.push(l(n.slice(i,i+6)))}var u="";for(var i=0,v=a.length;i<v;++i){u+=t[a[i]]}for(var i=0,v=f/2;i<v;++i){u+="="}return u};var a=function(r,e){var a=r.length;var n=0;var t=e?p:d;if(r.charAt(a-1)=="="){if(r.charAt(a-2)=="="){n=4;r=r.substring(0,a-2)}else{n=2;r=r.substring(0,a-1)}}var f=[];for(var i=0,v=r.length;i<v;++i){var o=r.charAt(i);for(var c=0,u=t.length;c<u;++c){if(o==t[c]){var l=w(c);var h=l.length;if(6-h>0){for(var s=6-h;s>0;--s){l.unshift(0)}}f=f.concat(l);break}}}if(n>0){f=f.slice(0,f.length-n)}var g=b(f);return g};var r={encode:function(r){return e(r,false)},decode:function(r){return a(r,false)},urlsafe_encode:function(r){return e(r,true)},urlsafe_decode:function(r){return a(r,true)}};return r});

View File

@ -1,260 +1,508 @@
document.body.oncopy = function () {
if (set.isusercenter == 1) {
return;
}
var copytext = window.getSelection().toString();
if (set.reprint.open == 1) {
if (set.reprint.copylenopen == 1) {
if (copytext.length > set.reprint.copylen) {
addarelt('复制内容太长,禁止复制', 'erro');
event.preventDefault();
return false;
} else {
copyaddurl(copytext);
}
} else {
copyaddurl(copytext);
}
}
}
init_dark(); init_dark();
function init_dark() { function init_dark() {
!0 === cp_user_get_dark() ? loaddarkcss() : "" === cp_user_get_dark() ? 1 == set.autodark ? cp_isdark() ? loaddarkcss() : def_dark() : def_dark() : removedarkcss() if (cp_user_get_dark() === true) {
} loaddarkcss()
} else if (cp_user_get_dark() === "") {
function copyaddurl(content) { if (set.autodark == 1) {
if (set.reprint.addurl == 0) { if (cp_isdark()) {
addarelt(set.reprint.msg, 'succ'); loaddarkcss()
} else { } else {
if (content.length > 100) { def_dark()
addarelt(set.reprint.msg, 'succ'); }
JScopyText(content + '\n 【来源:' + set.reprint.siteurl + ',转载请注明】');
} else { } else {
addarelt(set.reprint.msg, 'succ'); def_dark()
} }
}
}
$(document).scroll(function () {
var scroH = $(document).scrollTop(); //滚动高度
var viewH = $(window).height(); //可见高度
var contentH = $(document).height(); //内容高度
if (scroH > 100) { //距离顶部大于100px时
$('.go-top-plane').addClass('go-top-plane-show')
} else { } else {
$('.go-top-plane').removeClass('go-top-plane-show') removedarkcss()
} }
if (contentH - (scroH + viewH) <= 100) { //距离底部高度小于100px
}
if (contentH == (scroH + viewH)) { //滚动条滑到底部啦
}
});
function mobile_menuclick(e, ethis) {
$('.user-menu .sub-menu').css('visibility', 'hidden');
$('.user-menu .sub-menu').css('opacity', '0');
if ($(ethis).parent().find('.sub-menu').css('visibility') == 'hidden') {
$(ethis).parent().find('.sub-menu').css('opacity', '1');
$(ethis).parent().find('.sub-menu').css('visibility', 'visible');
} else if ($(ethis).parent().parent().find('.user-sub-menu').css('visibility') == 'hidden') {
$(ethis).parent().parent().find('.sub-menu').css('opacity', '1');
$(ethis).parent().parent().find('.sub-menu').css('visibility', 'visible');
}
e.stopPropagation();
} }
function openMenu() {
$(document).ready(function () { $("body").css("overflow", "hidden");
//移动端 $(".drawer-menu-plane").addClass("drawer-menu-plane-show");
$('.menu-mobile .menu-item-has-children').append('<div class="mobile-m-dropdown"><i class="fa fa-angle-down"></i></div>') $(".menu-plane").appendTo($(".drawer-menu-list"));
$('.menu-mobile .mobile-m-dropdown').click(function () { $(".user-menu-plane").appendTo($(".drawer-menu-list"));
$(this).parent().children('.mobile-m-dropdown').children().toggleClass('m-dropdown-show-i') $(".user-menu-main").not(".user-menu-main-notlogin").append('<div class="m-dropdown" onclick="mobile_menuclick(event,this)"><i class="fal fa-angle-down"></i></div>');
$(this).parent().children('.sub-menu').slideToggle() $(".phone-tabs").css("display", "none")
}) }
function closeMenu() {
$("body").css("overflow", "auto");
$('.go-top-plane').click(function () { $(".drawer-menu-plane").removeClass("drawer-menu-plane-show");
$('html,body').animate({scrollTop: '0px'}, 500); $(".user-menu-plane").prependTo($(".header-menu"));
}); $(".menu-plane").prependTo($(".header-menu"));
$('.drawer-menu-list').click(function (e) { $(".m-dropdown").remove();
$('.user-menu .sub-menu').css('visibility', 'hidden'); $(".phone-tabs").css("display", "block")
$('.user-menu .sub-menu').css('opacity', '0'); }
$('.user-menu .sub-menu').removeClass('sub-menu-hide'); function openSearch() {
$('.user-menu .sub-menu').removeClass('sub-menu-show'); $(".dialog-search-plane").addClass("dialog-search-plane-show")
e.stopPropagation(); }
}); function closeSearch() {
$('.tag-cloud-link').each(function () { $(".dialog-search-plane").removeClass("dialog-search-plane-show")
var colors = ['#67C23A', '#E6A23C', '#F56C6C', '#909399', '#CC9966', '#FF6666', '#99CCFF', '#FF9999', '#CC6633']; }
var backcolor = colors[Math.floor((Math.random() * colors.length))]; function darkMode() {
$(this).css('background-color', backcolor); if (window.isdark == true) {
}); removedarkcss();
cp_user_set_dark("0")
if (set.module.imglightbox == 1) { } else {
if (set.is_page == true || set.is_single == true) { loaddarkcss();
var imgarr = $('.post-content-content').find('img').not('.c-downbtn-icon').not('.post-end-tools').not('.link-icon').not('.corepress-url-dh-icon img'); cp_user_set_dark("1")
for (var i = 0; i < imgarr.length; i++) { }
if (set.module.imglazyload == 1) { }
var imgurl = $(imgarr[i]).attr('data-original'); function copyaddurl(t) {
} else { if (set.reprint.addurl == 0) {
var imgurl = $(imgarr[i]).attr('src'); addarelt(set.reprint.msg, "succ")
} } else {
var html = imgarr[i].outerHTML; if (t.length > 100) {
if ($(imgarr[i]).parent()[0].tagName != 'A') { addarelt(set.reprint.msg, "succ");
$(imgarr[i]).replaceWith('<a data-fancybox="gallery" data-type="image" href="' + imgurl + '">' + html + '</a>'); window.closeCopyLimit = 1;
} JScopyText(t + "\n 【来源:" + set.reprint.siteurl + ",转载请注明】")
} } else {
$.fancybox.defaults.buttons = [ addarelt(set.reprint.msg, "succ")
"close"
];
$('a[href*=".jpg"],a[href*=".webp"],a[href*=".ico"],a[href*=".svg"], a[href*=".jpeg"], a[href*=".png"], a[href*=".gif"], a[href*=".bmp"]').fancybox({});
} }
} }
}
function mobile_menuclick(t, e) {
if (set.is_single == 1 || set.is_page == 1) { $(".user-menu .sub-menu").css("visibility", "hidden");
if (set.corepress_post_meta.catalog == 1) { $(".user-menu .sub-menu").css("opacity", "0");
var i = 0; if ($(e).parent().find(".sub-menu").css("visibility") == "hidden") {
//文章目录 $(e).parent().find(".sub-menu").css("opacity", "1");
var html = ''; $(e).parent().find(".sub-menu").css("visibility", "visible")
$(".post-content h2,.post-content h3").each(function () { } else if ($(e).parent().parent().find(".user-sub-menu").css("visibility") == "hidden") {
var tagName = $(this)[0].tagName.toLowerCase(); $(e).parent().parent().find(".sub-menu").css("opacity", "1");
console.log(); $(e).parent().parent().find(".sub-menu").css("visibility", "visible")
if ($(this).parent().attr('class') == 'zd-plane-content') {
return;
}
$(this).attr('catalog', 'catalog-' + tagName + '-' + i);
var clickargs = "go_catalog('catalog-" + tagName + "-" + i + "','" + tagName + "')";
html = html + '<p catalogtagName="' + tagName + '" catalog="' + 'catalog-' + tagName + '-' + i + '" class="catalog-item" onclick="' + clickargs + '">' + $(this).html() + '</p>';
i++;
});
$('#post-catalog-list').html(html);
set_catalog_position();
$('#post-catalog').css('visibility', 'visible');
$('#post-catalog').css('opacity', '1');
if ($(".post-content h2").length == 0 && $(".post-content h3").length == 0) {
$('#post-catalog').css('visibility', 'hidden');
}
}
if (set.has_corepress_video == true) {
const player = new Plyr('.corepress-video', {
i18n: {
restart: '重播',
play: '播放',
pause: '暂停',
speed: '速度',
normal: '正常',
quality: '质量',
}
});
}
} }
//图片延迟加载 $(".user-menu-main .fa-angle-down").toggleClass("m-dropdown-show-i");
$("img").lazyload({effect: "fadeIn", container: $("html,body,#app")}); t.stopPropagation()
$(window).resize() }
if (set.module.imglazyload == 1) { $(document).ready(function() {
endloadhtml(); $("#app").addClass("app-show");
$(".html-loading").addClass("html-loading-hide");
if ($(".cp-pop-window-title>div").css("background-color") != "rgb(255, 255, 255)") {
$(".cp-pop-close").css("color", "#fff")
} }
$("#app").scroll(()=>directoryScroll());
//顶部加载 copyDeal();
mobileDeal();
if (set.theme.loadbar == 1) { if (set.theme.loadbar == 1) {
NProgress.done(); NProgress.done()
} }
//友链图标 if (set.is_home == 1) {
if (set.is_home == true) { loadSwiper()
if (set.index.linksicon == 1) {
var links_url_arr = $('.frinds-links-list').children('li');
for (let i = 0; i < links_url_arr.length; i++) {
var url = $(links_url_arr[i]).children('a').attr('href') + '/favicon.ico';
var default_url = set.index.chromeiconurl;
$(links_url_arr[i]).children('a').prepend(`<img class="frinds-links-icon img-lazyload" src="${default_url}" data-original="${url}" onerror="this.src='${default_url}'"> `);
}
setTimeout(function () {
endloadhtml();
}, 1000)
}
} }
loadlazyimg();
if (set.is_single == 1 || set.is_page == 1) {
loadUAparse();
tableBeautify();
loadCorePressVideo();
loadDirectory();
directoryDeal()
}
//loadPopWindow();
loadPoster();
homeBeautify();
tagCloud()
}); });
function directoryDeal() {
function endloadhtml() { if ($(".cp-widget-directory").length === 0) {
$("img.frinds-links-icon").lazyload({effect: "fadeIn"}); $(".sidebar-box-list").css("position", "sticky");
$(".sidebar-box-list").css("top", "65px");
$(".sidebar-box-list").css("height", "auto")
}
} }
function homeBeautify() {
$(window).resize(function () { if (set.is_home == 1) {
set_catalog_position(); $(".sidebar-box-list").css("position", "sticky");
}); $(".sidebar-box-list").css("top", "65px");
$(document).scroll(function () { $(".sidebar-box-list").css("height", "auto")
if ($('#post-catalog').css('visibility') != 'visible') {
return;
} }
$(".post-content h2[catalog],.post-content h3[catalog]").each(function () { }
var el_y = this.getBoundingClientRect().y; function tagCloud() {
if (el_y < 100 && el_y > 0) { $(".tag-cloud-link").each(function() {
var name = $(this).attr('catalog'); var t = ["#67C23A", "#E6A23C", "#F56C6C", "#909399", "#CC9966", "#FF6666", "#99CCFF", "#FF9999", "#CC6633"];
set_catalog_css(); var e = t[Math.floor(Math.random() * t.length)];
$('p[catalog=' + name + ']').addClass('catalog-hover'); $(this).css("background-color", e)
})
} }
function mobileDeal() {
$(".menu-mobile .menu-item-has-children").append('<div class="mobile-m-dropdown"><i class="fal fa-angle-down"></i></div>');
$(".menu-mobile .menu-item-has-children>a").css("display", " inline-block");
$(".menu-mobile .menu-item-has-children").click(function() {
let t = $(this).children(".mobile-m-dropdown");
t.children().toggleClass("m-dropdown-show-i");
$(this).children(".sub-menu").slideToggle();
return false
}); });
}); $(".menu-mobile a").click(function() {
window.location.href = $(this).attr("href");
function close_show(type) { return false
if (type == 1) { });
$('#post-catalog').removeClass('post-catalog-hide') $(".go-top-plane").click(function() {
$('#post-catalog-bar').css('visibility', 'hidden') $("#app").animate({
} else { scrollTop: "0px"
$('#post-catalog').addClass('post-catalog-hide') }, 500)
$('#post-catalog-bar').css('visibility', 'visible') });
$(".drawer-menu-list").click(function(t) {
$(".user-menu .sub-menu").css("visibility", "hidden");
$(".user-menu .sub-menu").css("opacity", "0");
$(".user-menu .sub-menu").removeClass("sub-menu-hide");
$(".user-menu .sub-menu").removeClass("sub-menu-show");
t.stopPropagation()
})
}
function copyDeal() {
jQuery(document).on("copy", t=>{
var e = window.getSelection().toString();
if (window.closeCopyLimit == 1) {
window.closeCopyLimit = 0;
return true
}
if (set.reprint.open == 1) {
if (set.reprint.copylenopen == 1) {
if (e.length > set.reprint.copylen) {
addarelt("复制内容太长,禁止复制", "erro");
t.preventDefault();
return false
} else {
copyaddurl(e);
return true
}
} else {
copyaddurl(e)
}
}
return true
}
)
}
function loadCorePressVideo() {
if (set.has_corepress_video == true) {
const t = new Plyr(".corepress-video",{
i18n: {
restart: "重播",
play: "播放",
pause: "暂停",
speed: "速度",
normal: "正常",
quality: "质量"
}
})
} }
} }
function tableBeautify() {
function set_catalog_css() { $("table").each(function() {
$('p[catalog]').removeClass('catalog-hover'); $(this)[0].outerHTML = '<div class="cp-table">' + $(this)[0].outerHTML + "</div>"
});
$("table").each(function() {
if ($(this).find("thead").length == 0) {
$(this).find("tr:first-child td").css("color", "var(--Maincolor)");
$(this).find("tr:first-child td").css("border-bottom", "2px solid var(--Maincolor)")
}
})
}
function loadPopWindow() {
if (set.popwindow == 1) {
if (cp_getCookie("cp_popwindow") != "1") {
load_popwindow()
} else if (cp_getCookie("cp_popwindow_md5") != set.popwindowmd5) {
load_popwindow()
}
}
}
function loadPoster() {
$(".cp-dialog").appendTo("body");
$(".cp-dialog").click(function() {
if ($(this).attr("click-close") == "true") {
$(this).css("display", "none")
}
});
$(".cp-poster-plane-main").click(()=>{
return false
}
);
$("#cp-close-poster").click(()=>{
$("#cp-poster-dialog").css("display", "none")
}
);
$("#cp-poster-img").attr("src", set.poster_img)
}
function loadUAparse() {
if ($("#comments").length > 0) {
if (navigator.userAgentData != undefined) {
if (navigator.userAgentData.getHighEntropyValues != undefined) {
navigator.userAgentData.getHighEntropyValues(["platformVersion"]).then(t=>{
if (navigator.userAgentData.platform === "Windows") {
const e = parseInt(t.platformVersion.split(".")[0]);
if (e >= 13) {
document.getElementById("osversion").value = 13
} else {}
}
}
)
}
}
$(".corepress-commentinfo").each(function() {
$.ua.set($(this).text());
var t = $.ua.browser.name;
var e = $.ua.browser.major;
var o = $.ua.cpu.architecture;
var i = $.ua.os.name;
var s = $.ua.os.version;
var a = $.ua.device.vendor;
var n = "";
if (o == "amd64") {
n = " 64Bit"
} else if (o == "ia32") {
n = " 32Bit"
}
if (t != undefined) {
if (e != undefined) {
var c = '<span class="corepress-commentinfo-browser"><img src="' + getBrowsericon(t) + '">' + t + " " + e + "</span>"
} else {
var c = '<span class="corepress-commentinfo-browser"><img src="' + getBrowsericon(t) + '">' + t + "</span>"
}
}
if (i != undefined) {
c = c + '<span class="corepress-commentinfo-os"><img src="' + getOsicon(i, s) + '">' + i + " " + s + n + "</span>"
}
if (a != undefined) {
c = c + '<span class="corepress-commentinfo-devicename"><img src="' + getPhoneicon(a) + '">' + a + "</span>"
}
$.ua.set($(this).html(c));
$(this).css("display", "block")
})
}
}
function directoryScroll() {
var t = $("#app").scrollTop();
var e = $(window).height();
var o = $("#app").height();
if (t > 100) {
$(".go-top-plane").addClass("go-top-plane-show")
} else {
$(".go-top-plane").removeClass("go-top-plane-show")
}
if (set.is_single == 1 || set.is_page == 1) {
if ($("#post-catalog").css("visibility") != "visible") {}
$(".post-content h2[catalog],.post-content h3[catalog],.post-content h4[catalog]").each(function() {
var t = this.getBoundingClientRect().y;
if (t < 256 && t > 0) {
var e = $(this).attr("catalog");
set_catalog_css();
$("#post-catalog-list p[catalog=" + e + "]").addClass("catalog-hover");
return
}
});
let t = "";
let e = $(".directory-widget").attr("index");
if (e == "h2") {
t = ".post-content h2[catalog]"
} else if (e == "h3") {
t = ".post-content h2[catalog],.post-content h3[catalog]"
} else {
t = ".post-content h2[catalog],.post-content h3[catalog],.post-content h4[catalog]"
}
$(t).each(function() {
var t = this.getBoundingClientRect().y;
if (t < 256 && t > 0) {
var e = $(this).attr("catalog");
$(".directory-widget p[catalog]").removeClass("catalog-hover");
$(".directory-widget p[catalog=" + e + "]").addClass("catalog-hover");
return
}
});
if ($(".cp-widget-directory .catalog-hover").length > 0) {
var i = $(".cp-widget-directory .catalog-hover").position().top;
var s = $(".directory-widget").height();
var a = $(".directory-widget").scrollTop();
if (i >= a && i <= a + s + 34) {} else {
let t = $(".catalog-item").index($(".catalog-hover"));
$(".directory-widget").scrollTop(t * 34)
}
}
if (window.set_cp_widget_directory != 1) {
let t = $(".aside-box:last-child");
if (t.length > 0) {
if (t.hasClass("cp-widget-directory")) {
if ($(".scroll-notice").length > 0) {
$(".cp-widget-directory").css("top", "90px")
}
$(".cp-widget-directory").css("position", "sticky");
window.set_cp_widget_directory == 1
} else if (Math.abs($(".aside-box:last-child").offset().top) - $(".aside-box:last-child").outerHeight() + 62 > 0) {
if ($(".scroll-notice").length > 0) {
$(".cp-widget-directory").css("top", "90px")
}
$(".cp-widget-directory").css("position", "sticky")
} else {
$(".cp-widget-directory").css("position", "static")
}
}
}
}
}
function loadDirectory() {
if (set.corepress_post_meta.catalog == 1) {
var o = 0;
var i = "";
$(".post-content h2,.post-content h3").each(function() {
var t = $(this)[0].tagName.toLowerCase();
if ($(this).parent().attr("class") == "zd-plane-content") {
return
}
$(this).attr("catalog", "catalog-" + t + "-" + o);
var e = "go_catalog('catalog-" + t + "-" + o + "','" + t + "')";
i = i + '<p catalogtagName="' + t + '" catalog="' + "catalog-" + t + "-" + o + '" class="catalog-item" onclick="' + e + '">' + $(this).html() + "</p>";
o++
});
$("#post-catalog-list").html(i);
set_catalog_position();
$("#post-catalog").css("visibility", "visible");
$("#post-catalog").css("opacity", "1");
if ($(".post-content h2").length == 0 && $(".post-content h3").length == 0) {
$("#post-catalog").css("visibility", "hidden")
}
}
if ($(".cp-widget-directory").length > 0) {
addTagToTitle();
let t = getDirectoryArray();
if (t.length == 0) {
$(".cp-widget-directory").css("display", "none");
return
}
let s = $(".directory-widget").attr("index");
t.forEach((t,e)=>{
let o = document.createElement("p");
o.setAttribute("catalogtagName", t.tag_name);
o.setAttribute("catalog", t.catalog);
o.setAttribute("class", "catalog-item");
var i = "go_catalog('" + t.catalog + "','" + t.tag_name + "')";
o.setAttribute("onclick", i);
o.innerHTML = t.title;
if (s == "h2") {
if (t.tag_name == "h2") {
$(".directory-widget").append(o)
}
} else if (s == "h3") {
if (t.tag_name == "h2" || t.tag_name == "h3") {
$(".directory-widget").append(o)
}
} else {
$(".directory-widget").append(o)
}
}
)
}
}
function getDirectoryArray() {
let o = [];
$(".post-content h2[catalog],.post-content h3[catalog],.post-content h4[catalog]").each(function() {
var t = $(this).attr("catalog");
var e = $(this)[0].tagName.toLowerCase();
o.push({
tag_name: e,
title: $(this).html(),
catalog: t
})
});
return o
}
function addTagToTitle() {
var o = 0;
$(".post-content h2,.post-content h3,.post-content h4").each(function() {
var t = $(this)[0].tagName.toLowerCase();
if ($(this).parent().attr("class") == "zd-plane-content") {
return
}
var e = "catalog-" + t + "-" + o;
$(this).attr("id", e);
$(this).attr("catalog", "catalog-" + t + "-" + o);
o++
})
}
function loadSwiper() {
let t = $(".swiper-slide").length;
let e = {
loop: t > 1,
autoplay: true,
delay: 3e3,
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev"
}
};
if (t > 1) {
e.pagination = {
el: ".swiper-pagination"
}
}
new Swiper(".swiper-container",e)
}
function createPoster() {
if (window.poster_data != undefined) {
$("#cp-poster-dialog").css("display", "block")
} else {
$("#cp-poster-dialog").css("display", "block");
setTimeout(function() {
html2canvas($("#poster-screenshot")[0]).then(t=>{
window.poster_data = t;
$("#poster-screenshot").css("display", "none");
$("#poster-created").css("display", "block");
$(".poster-loading").css("display", "none");
$("#poster-created").append('<img src="' + t.toDataURL("image/png") + '">')
}
)
}, 500)
}
}
$(window).resize(function() {
set_catalog_position()
});
function close_show(t) {
if (t == 1) {
$("#post-catalog").removeClass("post-catalog-hide");
$("#post-catalog-bar").css("visibility", "hidden")
} else {
$("#post-catalog").addClass("post-catalog-hide");
$("#post-catalog-bar").css("visibility", "visible")
}
}
function set_catalog_css() {
$("#post-catalog-list p[catalog]").removeClass("catalog-hover")
} }
function set_catalog_position() { function set_catalog_position() {
if (set.is_page == true || set.is_single == true) { if (set.is_page == true || set.is_single == true) {
if (set.theme.sidebar_position == 1) { if (set.theme.sidebar_position == 1) {
if ($('.post-info').length == 0 || $('.post-content-body').length == 0) { if ($(".post-title").length == 0 || $(".post-content-body").length == 0) {
return; return
} }
var title_x = $('.post-info').offset().left; var t = $(".post-title").offset().left;
$('#post-catalog').css('left', title_x - 200 + 'px'); $("#post-catalog").css("left", t - 200 + "px");
var e = $(".post-content-body").offset().left;
var post_body_x = $('.post-content-body').offset().left; $("#post-catalog-bar").css("left", e - $("#post-catalog-bar").innerWidth() + "px")
$('#post-catalog-bar').css('left', post_body_x - $("#post-catalog-bar").innerWidth() + 'px');
} else { } else {
var title_x = $('.post-info').offset().left; var t = $(".post-title").offset().left;
title_x = title_x + $('.post-info')[0].getBoundingClientRect().width t = t + $(".post-title")[0].getBoundingClientRect().width;
$('#post-catalog').css('left', title_x + 40 + 'px'); $("#post-catalog").css("left", t + 40 + "px");
var post_body_x = $('.post-content-body').offset().left + $('.post-content-body').innerWidth(); var e = $(".post-content-body").offset().left + $(".post-content-body").innerWidth();
$('#post-catalog-bar').css('left', post_body_x + 'px'); $("#post-catalog-bar").css("left", e + "px");
$('#post-catalog-bar').removeClass('post-catalog-bar-left-minborder'); $("#post-catalog-bar").removeClass("post-catalog-bar-left-minborder");
$('#post-catalog-bar').addClass('post-catalog-bar-right-minborder'); $("#post-catalog-bar").addClass("post-catalog-bar-right-minborder")
} }
} }
} }
function go_catalog(t, e) {
function go_catalog(catalogname, tagName) { var o = $(e + "[catalog=" + t + "]").position().top;
var _scrolltop = $(tagName + '[catalog=' + catalogname + ']').offset().top; $("#app").scrollTop(o)
$('html, body').animate({
scrollTop: _scrolltop - 60
}, 500
);
} }
function widget_sentence_load(t, o) {
function widget_sentence_load(type, el) { $.get(set.ajaxurl, {
$.get(set.ajaxurl, {action: 'corepress_get_widget_sentence', type}, function (data) { action: "corepress_get_widget_sentence",
var obj = JSON.parse(data); type: t
if (obj.code == 200) { }, function(t) {
$(el).html('<p>' + obj.data + '</p>'); var e = JSON.parse(t);
if (e.code == 200) {
$(o).html("<p>" + e.data + "</p>")
} else { } else {
$(el).html('<p>句子加载失败</p>'); $(o).html("<p>句子加载失败</p>")
} }
}) })
} }

View File

@ -6,8 +6,7 @@
"color:#eee;background:#444;padding:5px 10px;" "color:#eee;background:#444;padding:5px 10px;"
); );
</script> </script>
<!-- <script src="t/font_1141258_lpotpn4kdqj.js"></script>--> <div class="go-top-plane go-top-plane-show" title="返回顶部">
<div class="go-top-plane" title="返回顶部">
<i class="fa fa-arrow-up" aria-hidden="true"></i> <i class="fa fa-arrow-up" aria-hidden="true"></i>
</div> </div>
<div class="sidebarlist-main"></div> <div class="sidebarlist-main"></div>

View File

@ -12,6 +12,7 @@
<script type="text/javascript" src="__JS__/jquery.min.js" id="corepress_jquery-js"></script> <script type="text/javascript" src="__JS__/jquery.min.js" id="corepress_jquery-js"></script>
<script type="text/javascript" src="__JS__/jquery.lazyload.min.js" id="corepress_jquery_lazyload-js"></script> <script type="text/javascript" src="__JS__/jquery.lazyload.min.js" id="corepress_jquery_lazyload-js"></script>
<script type="text/javascript" src="__JS__/qrcode.min.js" id="corepress_jquery_qrcode-js"></script> <script type="text/javascript" src="__JS__/qrcode.min.js" id="corepress_jquery_qrcode-js"></script>
<script type='text/javascript' src='__JS__/base64.js' id='base64-js'></script>
<script type="text/javascript" id="tools-js-extra"> <script type="text/javascript" id="tools-js-extra">
/* <![CDATA[ */ /* <![CDATA[ */
var tools = { index: "1", page: "", post: "" }; var tools = { index: "1", page: "", post: "" };