mirror of https://github.com/1099438829/apeblog
更新部分资源
This commit is contained in:
parent
fadbc784a4
commit
e11f6e03f2
File diff suppressed because one or more lines are too long
|
|
@ -2,6 +2,7 @@ document.body.oncopy = function () {
|
||||||
if (set.isusercenter == 1) {
|
if (set.isusercenter == 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var copytext = window.getSelection().toString();
|
var copytext = window.getSelection().toString();
|
||||||
if (set.reprint.open == 1) {
|
if (set.reprint.open == 1) {
|
||||||
if (set.reprint.copylenopen == 1) {
|
if (set.reprint.copylenopen == 1) {
|
||||||
|
|
@ -17,6 +18,11 @@ document.body.oncopy = 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()
|
||||||
|
};
|
||||||
|
|
||||||
function copyaddurl(content) {
|
function copyaddurl(content) {
|
||||||
if (set.reprint.addurl == 0) {
|
if (set.reprint.addurl == 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,96 +1,155 @@
|
||||||
function getQueryVariable(variable) {
|
function getQueryVariable(a) {
|
||||||
var query = window.location.search.substring(1);
|
for (var c = window.location.search.substring(1).split("\x26"), b = 0; b < c.length; b++) {
|
||||||
var vars = query.split("&");
|
var d = c[b].split("\x3d");
|
||||||
for (var i = 0; i < vars.length; i++) {
|
if (d[0] == a)
|
||||||
var pair = vars[i].split("=");
|
return d[1]
|
||||||
if (pair[0] == variable) {
|
|
||||||
return pair[1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (false);
|
return !1
|
||||||
}
|
}
|
||||||
|
function htmlEncodeByRegExp(a) {
|
||||||
function htmlEncodeByRegExp(str) {
|
return $("\x3cdiv/\x3e").text(a).html()
|
||||||
return $('<div/>').text(str).html();
|
|
||||||
}
|
}
|
||||||
|
function htmlDecodeByRegExp(a) {
|
||||||
function htmlDecodeByRegExp(str) {
|
$("\x3cdiv/\x3e").html(a).text()
|
||||||
var text = $('<div/>').html(str).text();
|
|
||||||
}
|
}
|
||||||
|
function isElementInViewport(a) {
|
||||||
function isElementInViewport(el) {
|
a = a.getBoundingClientRect();
|
||||||
//获取元素是否在可视区域
|
return 0 <= a.top && 0 <= a.left && a.bottom <= (window.innerHeight || document.documentElement.clientHeight) && a.right <= (window.innerWidth || document.documentElement.clientWidth)
|
||||||
var rect = el.getBoundingClientRect();
|
|
||||||
return (
|
|
||||||
rect.top >= 0 &&
|
|
||||||
rect.left >= 0 &&
|
|
||||||
rect.bottom <=
|
|
||||||
(window.innerHeight || document.documentElement.clientHeight) &&
|
|
||||||
rect.right <=
|
|
||||||
(window.innerWidth || document.documentElement.clientWidth)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
function replaceTag(a) {
|
||||||
function replaceTag(str) {
|
return a.replace("\x26amp;", "")
|
||||||
//return str;
|
|
||||||
return str.replace('&', '')
|
|
||||||
}
|
}
|
||||||
|
function addarelt(a, c) {
|
||||||
function addarelt(msg, type) {
|
var b = '\x3ci class\x3d"fas fa-info-circle" style\x3d"color: #515a6e"\x3e\x3c/i\x3e';
|
||||||
var icon = '<i class="fas fa-info-circle" style="color: #515a6e"></i>';
|
"succ" == c ? b = '\x3ci class\x3d"fas fa-check-circle" style\x3d"color:#19be6b;"\x3e\x3c/i\x3e' : "erro" == c && (b = '\x3ci class\x3d"fas fa-times-circle" style\x3d"color:#ed4014;"\x3e\x3c/i\x3e');
|
||||||
if (type == 'succ') {
|
$("body").append('\x3cdiv class\x3d"corepress-alert"\x3e\x3cdiv class\x3d"corepress-alert-main"\x3e' + b + a + "\x3c/div\x3e\x3c/div\x3e");
|
||||||
icon = '<i class="fas fa-check-circle" style="color:#19be6b;"></i>'
|
setTimeout(function() {
|
||||||
} else if (type == 'erro') {
|
$(".corepress-alert-main").addClass("corepress-alert-main-show")
|
||||||
icon = '<i class="fas fa-times-circle" style="color:#ed4014;"></i>'
|
|
||||||
}
|
|
||||||
var msg_id = '';
|
|
||||||
$('body').append('<div class="corepress-alert"><div class="corepress-alert-main">' + icon + msg + '</div></div>');
|
|
||||||
setTimeout(function () {
|
|
||||||
$('.corepress-alert-main').addClass('corepress-alert-main-show');
|
|
||||||
}, 20);
|
}, 20);
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
$('.corepress-alert-main:first').removeClass('corepress-alert-main-show');
|
$(".corepress-alert-main:first").removeClass("corepress-alert-main-show")
|
||||||
}, 3000);
|
}, 3E3);
|
||||||
setTimeout(function () {
|
setTimeout(function() {
|
||||||
$('.corepress-alert:first').remove();
|
$(".corepress-alert:first").remove()
|
||||||
}, 3500);
|
}, 3500)
|
||||||
}
|
}
|
||||||
|
function JScopyText(a) {
|
||||||
function JScopyText(str) {
|
|
||||||
copynotmsg = 1;
|
copynotmsg = 1;
|
||||||
$("body").append('<div id="tem-copy" style="visibility: hidden"></div>');
|
$("body").append('\x3cdiv id\x3d"tem-copy" style\x3d"visibility: hidden"\x3e\x3c/div\x3e');
|
||||||
var clipboard = new ClipboardJS('#tem-copy', {
|
var c = new ClipboardJS("#tem-copy",{
|
||||||
text: function () {
|
text: function() {
|
||||||
return str;
|
return a
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//自动点击
|
|
||||||
$("#tem-copy").trigger("click");
|
$("#tem-copy").trigger("click");
|
||||||
//删除
|
c.destroy();
|
||||||
clipboard.destroy();
|
$("#tem-copy").remove()
|
||||||
$("#tem-copy").remove();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function isChinese(a) {
|
||||||
function isChinese(text) {
|
return /.*[\u4e00-\u9fa5]+.*$/.test(a) ? !0 : !1
|
||||||
var re = /.*[\u4e00-\u9fa5]+.*$/;
|
|
||||||
if (re.test(text)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
function haveNumandLetter(a) {
|
||||||
function haveNumandLetter(text) {
|
var c = /[a-z]/i;
|
||||||
var num = /[0-9]/;
|
return /[0-9]/.test(a) && c.test(a) ? !0 : !1
|
||||||
var letter = /[a-z]/i;
|
|
||||||
if (num.test(text) && letter.test(text)) return true;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
function isEmail(a) {
|
||||||
function isEmail(str) {
|
return 1 != /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(a) ? !1 : !0
|
||||||
var re = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/;
|
}
|
||||||
if (re.test(str) != true) {
|
function cp_setCookie(a, c, b) {
|
||||||
return false;
|
b = b || 0;
|
||||||
} else {
|
var d = "";
|
||||||
return true;
|
0 != b && (d = new Date,
|
||||||
|
d.setTime(d.getTime() + 864E5 * b),
|
||||||
|
d = "; expires\x3d" + d.toGMTString());
|
||||||
|
document.cookie = a + "\x3d" + encodeURI(c) + d + "; path\x3d/"
|
||||||
|
}
|
||||||
|
function cp_getCookie(a) {
|
||||||
|
a += "\x3d";
|
||||||
|
for (var c = document.cookie.split(";"), b = 0; b < c.length; b++) {
|
||||||
|
var d = c[b].trim();
|
||||||
|
if (0 == d.indexOf(a))
|
||||||
|
return d.substring(a.length, d.length)
|
||||||
}
|
}
|
||||||
|
return ""
|
||||||
}
|
}
|
||||||
|
function cp_isdark() {
|
||||||
|
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
||||||
|
}
|
||||||
|
function cp_user_get_dark() {
|
||||||
|
return "" == cp_getCookie("corepress_dark") ? "" : 1 == cp_getCookie("corepress_dark") ? !0 : !1
|
||||||
|
}
|
||||||
|
function cp_user_set_dark(a) {
|
||||||
|
cp_setCookie("corepress_dark", a)
|
||||||
|
}
|
||||||
|
function removedarkcss() {
|
||||||
|
$("#darkcss").remove();
|
||||||
|
window.isdark = !1;
|
||||||
|
$("#darkModeicon").removeClass();
|
||||||
|
$("#darkModeicon").addClass("fal fa-moon");
|
||||||
|
$(".header-logo img").attr("src", set.logourl)
|
||||||
|
}
|
||||||
|
function loaddarkcodecss() {
|
||||||
|
var a = document.createElement("link");
|
||||||
|
a.type = "text/css";
|
||||||
|
a.rel = "stylesheet";
|
||||||
|
a.href = set.darkcodecss;
|
||||||
|
a.id = "darkcodecss";
|
||||||
|
$("body").append(a)
|
||||||
|
}
|
||||||
|
function removedarkcodecss() {
|
||||||
|
$("#darkcodecss").remove()
|
||||||
|
}
|
||||||
|
function loaddarkcss() {
|
||||||
|
var a = document.createElement("link");
|
||||||
|
a.type = "text/css";
|
||||||
|
a.rel = "stylesheet";
|
||||||
|
a.href = set.darkcss;
|
||||||
|
a.id = "darkcss";
|
||||||
|
$("body").append(a);
|
||||||
|
window.isdark = !0;
|
||||||
|
$("#darkModeicon").removeClass();
|
||||||
|
$("#darkModeicon").addClass("fas fa-sun");
|
||||||
|
$(".header-logo img").attr("src", set.darklogourl)
|
||||||
|
}
|
||||||
|
function def_dark() {
|
||||||
|
"1" == set.dark && loaddarkcss()
|
||||||
|
}
|
||||||
|
function getBrowsericon(a) {
|
||||||
|
a = -1 != a.search("Chrome") ? "chrome.svg" : "Edge" == a ? "edge.svg" : "Firefox" == a ? "firefox.svg" : -1 != a.search("Safari") ? "safari.svg" : "defaultbrowser.svg";
|
||||||
|
return set.imgurl + "/ua/" + a
|
||||||
|
}
|
||||||
|
function getPhoneicon(a) {
|
||||||
|
return set.imgurl + "/ua/" + ("Apple" == a ? "iphone.svg" : "phone.svg")
|
||||||
|
}
|
||||||
|
function getOsicon(a, c) {
|
||||||
|
var b = "";
|
||||||
|
"Windows" == a ? "XP" == c ? b = "windowsxp.svg" : "Vista" == c ? b = "windowsxp.svg" : "7" == c ? b = "windows7.svg" : "8" == c ? b = "windows8.svg" : "8.1" == c ? b = "windows8.svg" : "10" == c ? b = "windows10.svg" : "11" == c && (b = "windows11.svg") : b = -1 != a.indexOf("Mac") || -1 != a.search("iOS") ? "mac.svg" : -1 != a.indexOf("Android") ? "android.svg" : -1 != a.search("Linux") ? "linux.svg" : "defaultos.svg";
|
||||||
|
return set.imgurl + "/ua/" + b
|
||||||
|
}
|
||||||
|
function close_pop_window() {
|
||||||
|
cp_setCookie("cp_popwindow", "1", 1 * set.popwindowtime);
|
||||||
|
cp_setCookie("cp_popwindow_md5", set.popwindowmd5, 1 * set.popwindowtime);
|
||||||
|
$(".cp-popwindow-window").addClass("animate__bounceOut");
|
||||||
|
$(".cp-popwindow").css("background", "none");
|
||||||
|
setTimeout(function() {
|
||||||
|
$(".cp-popwindow").remove()
|
||||||
|
}, 800)
|
||||||
|
}
|
||||||
|
function load_popwindow() {
|
||||||
|
$("body").append('\x3cdiv class\x3d"cp-popwindow"\x3e\x3cdiv class\x3d"cp-popwindow-window animate__animated animate__bounceIn"\x3e' + BASE64.decode(set.popwindowhtml) + "\x3c/div\x3e\x3c/div\x3e")
|
||||||
|
}
|
||||||
|
function loadlazyimg() {
|
||||||
|
1 == set.module.imglazyload && (1 == set.is_single || 1 == set.is_page ? $("img").lazyload({
|
||||||
|
effect: "fadeIn",
|
||||||
|
container: $("html,body,#app")
|
||||||
|
}) : ($("img.thumbnail").lazyload({
|
||||||
|
effect: "fadeIn",
|
||||||
|
skip_invisible: !1,
|
||||||
|
event: "load",
|
||||||
|
container: $("html,body,#app")
|
||||||
|
}),
|
||||||
|
setTimeout(function() {
|
||||||
|
$("img.thumbnail").trigger("load")
|
||||||
|
}, 1E3)))
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
@ -117,6 +117,9 @@
|
||||||
<div class="user-menu-pc-search" onclick="openSearch()" title="搜索">
|
<div class="user-menu-pc-search" onclick="openSearch()" title="搜索">
|
||||||
<i class="fal fa-search"></i>
|
<i class="fal fa-search"></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="user-menu-pc-dark" onclick="darkMode()" title="深色模式">
|
||||||
|
<i class="far fa-moon" id="darkModeicon"></i>
|
||||||
|
</div>
|
||||||
{notempty name="user_info"}
|
{notempty name="user_info"}
|
||||||
<ul class="user-menu">
|
<ul class="user-menu">
|
||||||
<li>
|
<li>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue