mirror of https://github.com/1099438829/apeblog
更新主题的seo
This commit is contained in:
parent
d84a1be9b9
commit
f9dfa5e1dc
|
|
@ -99,8 +99,8 @@
|
|||
<div id="qrcode-img"></div>
|
||||
</div>
|
||||
<div id="reward-plane" class="post-pop-plane">
|
||||
{notempty name="(web_config('web_weixin_pay'))"}<img src="{:file_cdn(web_config('web_weixin_pay'))}" alt="">{/notempty}
|
||||
{notempty name="(web_config('web_zhifubao_pay'))"}<img src="{:file_cdn(web_config('web_zhifubao_pay'))}" alt="" />{/notempty}
|
||||
{notempty name="(web_config('web_weixin_pay'))"}<img src="{:file_cdn(web_config('web_weixin_pay'))}" alt="{:web_config('web_weixin_pay')}" />{/notempty}
|
||||
{notempty name="(web_config('web_zhifubao_pay'))"}<img src="{:file_cdn(web_config('web_zhifubao_pay'))}" alt="{:web_config('web_zhifubao_pay')}"/>{/notempty}
|
||||
</div>
|
||||
</div>
|
||||
<div class="post-turn-page-plane">
|
||||
|
|
@ -156,8 +156,7 @@
|
|||
<form action="{:url('/index/article/create_comment')}" method="post" id="form_comment" class="comment-form">
|
||||
<div class="comment-user-plane">
|
||||
<div class="logged-in-as">
|
||||
<img class="comment-user-avatar" width="48" height="auto" src="__IMG__/avatar.png"
|
||||
alt="">
|
||||
<img class="comment-user-avatar" width="48" height="auto" src="__IMG__/avatar.png" alt="comment-user-avatar">
|
||||
</div>
|
||||
<div class="comment_form_textarea_box">
|
||||
<textarea class="comment_form_textarea" name="content" id="comment"
|
||||
|
|
@ -217,7 +216,7 @@
|
|||
<div class="comment-item" id="comment-{$field['id']}">
|
||||
<div class="comment-media">
|
||||
<div class="avatar-img">
|
||||
<img src="{$field['cover_path']}" alt="">
|
||||
<img src="{$field['cover_path']}" alt="avatar-im">
|
||||
</div>
|
||||
</div>
|
||||
<div class="comment-metadata">
|
||||
|
|
|
|||
|
|
@ -60,8 +60,7 @@
|
|||
<div class="index-top-postcard-item">
|
||||
<div class="index-top-postcard-main">
|
||||
<div class="post-item-thumbnail">
|
||||
<a href="{$field['url']}"><img
|
||||
src="{$field['cover_path']}" alt=""></a>
|
||||
<a href="{$field['url']}"><img src="{$field['cover_path']}" alt="{$field['title']}"></a>
|
||||
</div>
|
||||
<div class="index-top-postcard-title">
|
||||
<a href="{$field['url']}">{$field['title']}</a>
|
||||
|
|
@ -240,7 +239,7 @@
|
|||
<h2 class="widget-title">{$field['title']}</h2>
|
||||
<a href="{$field['url']}" target="_blank">
|
||||
<img width="300" height="191" src="{$field['cover_path']}"
|
||||
class="image wp-image-559 attachment-medium size-medium" alt=""
|
||||
class="image wp-image-559 attachment-medium size-medium" alt="{$field['title']}"
|
||||
loading="lazy" style="max-width: 100%; height: auto;">
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -258,10 +257,10 @@
|
|||
<li>
|
||||
<a href="{$field['url']}" title="{$field['title']}" target="_blank">
|
||||
{notempty name="$field['image']"}
|
||||
<img class="frinds-links-icon img-lazyload" src="{$field['image']}" data-original="{$field['image']}"
|
||||
<img class="frinds-links-icon img-lazyload" src="{$field['image']}" alt="{$field['title']}" data-original="{$field['image']}"
|
||||
onerror="this.src='__IMG__/chrome.png'">
|
||||
{else /}
|
||||
<img class="frinds-links-icon img-lazyload" src="__IMG__/chrome.png" data-original="__IMG__/chrome.png"
|
||||
<img class="frinds-links-icon img-lazyload" src="__IMG__/chrome.png" alt="{$field['title']}" data-original="__IMG__/chrome.png"
|
||||
onerror="this.src='__IMG__/chrome.png'">
|
||||
{/notempty} {$field['title']}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -1,263 +1,262 @@
|
|||
document.body.oncopy = function () {
|
||||
if (set.isusercenter == 1) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
||||
function init_dark() {
|
||||
!0 === cp_user_get_dark() ? loaddarkcss() : "" === cp_user_get_dark() ? 1 == set.autodark ? cp_isdark() ? loaddarkcss() : def_dark() : def_dark() : removedarkcss()
|
||||
!0 === cp_user_get_dark() ? loaddarkcss() : "" === cp_user_get_dark() ? 1 == set.autodark ? cp_isdark() ? loaddarkcss() : def_dark() : def_dark() : removedarkcss()
|
||||
}
|
||||
|
||||
function copyaddurl(content) {
|
||||
if (set.reprint.addurl == 0) {
|
||||
addarelt(set.reprint.msg, 'succ');
|
||||
} else {
|
||||
if (content.length > 100) {
|
||||
addarelt(set.reprint.msg, 'succ');
|
||||
JScopyText(content + '\n 【来源:' + set.reprint.siteurl + ',转载请注明】');
|
||||
} else {
|
||||
addarelt(set.reprint.msg, 'succ');
|
||||
}
|
||||
}
|
||||
if (set.reprint.addurl == 0) {
|
||||
addarelt(set.reprint.msg, 'succ');
|
||||
} else {
|
||||
if (content.length > 100) {
|
||||
addarelt(set.reprint.msg, 'succ');
|
||||
JScopyText(content + '\n 【来源:' + set.reprint.siteurl + ',转载请注明】');
|
||||
} else {
|
||||
addarelt(set.reprint.msg, 'succ');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$(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 {
|
||||
$('.go-top-plane').removeClass('go-top-plane-show')
|
||||
}
|
||||
if (contentH - (scroH + viewH) <= 100) { //距离底部高度小于100px
|
||||
}
|
||||
if (contentH == (scroH + viewH)) { //滚动条滑到底部啦
|
||||
}
|
||||
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 {
|
||||
$('.go-top-plane').removeClass('go-top-plane-show')
|
||||
}
|
||||
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();
|
||||
$('.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();
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
//移动端
|
||||
$('.menu-mobile .menu-item-has-children').append('<div class="mobile-m-dropdown"><i class="fa fa-angle-down"></i></div>')
|
||||
$('.menu-mobile .mobile-m-dropdown').click(function() {
|
||||
$(this).parent().children('.mobile-m-dropdown').children().toggleClass('m-dropdown-show-i')
|
||||
$(this).parent().children('.sub-menu').slideToggle()
|
||||
})
|
||||
//移动端
|
||||
$('.menu-mobile .menu-item-has-children').append('<div class="mobile-m-dropdown"><i class="fa fa-angle-down"></i></div>')
|
||||
$('.menu-mobile .mobile-m-dropdown').click(function () {
|
||||
$(this).parent().children('.mobile-m-dropdown').children().toggleClass('m-dropdown-show-i')
|
||||
$(this).parent().children('.sub-menu').slideToggle()
|
||||
})
|
||||
|
||||
|
||||
$('.go-top-plane').click(function () {
|
||||
$('html,body').animate({scrollTop: '0px'}, 500);
|
||||
});
|
||||
$('.drawer-menu-list').click(function (e) {
|
||||
$('.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');
|
||||
e.stopPropagation();
|
||||
});
|
||||
$('.tag-cloud-link').each(function () {
|
||||
var colors = ['#67C23A', '#E6A23C', '#F56C6C', '#909399', '#CC9966', '#FF6666', '#99CCFF', '#FF9999', '#CC6633'];
|
||||
var backcolor = colors[Math.floor((Math.random() * colors.length))];
|
||||
$(this).css('background-color', backcolor);
|
||||
});
|
||||
|
||||
$('.go-top-plane').click(function () {
|
||||
$('html,body').animate({scrollTop: '0px'}, 500);
|
||||
});
|
||||
$('.drawer-menu-list').click(function (e) {
|
||||
$('.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');
|
||||
e.stopPropagation();
|
||||
});
|
||||
$('.tag-cloud-link').each(function () {
|
||||
var colors = ['#67C23A', '#E6A23C', '#F56C6C', '#909399', '#CC9966', '#FF6666', '#99CCFF', '#FF9999', '#CC6633'];
|
||||
var backcolor = colors[Math.floor((Math.random() * colors.length))];
|
||||
$(this).css('background-color', backcolor);
|
||||
});
|
||||
|
||||
if (set.module.imglightbox == 1) {
|
||||
if (set.is_page == true || set.is_single == true) {
|
||||
var imgarr = $('.post-content-content').find('img').not('.c-downbtn-icon').not('.post-end-tools').not('.link-icon').not('.corepress-url-dh-icon img');
|
||||
for (var i = 0; i < imgarr.length; i++) {
|
||||
if (set.module.imglazyload == 1) {
|
||||
var imgurl = $(imgarr[i]).attr('data-original');
|
||||
} else {
|
||||
var imgurl = $(imgarr[i]).attr('src');
|
||||
}
|
||||
var html = imgarr[i].outerHTML;
|
||||
if ($(imgarr[i]).parent()[0].tagName != 'A') {
|
||||
$(imgarr[i]).replaceWith('<a data-fancybox="gallery" data-type="image" href="' + imgurl + '">' + html + '</a>');
|
||||
}
|
||||
}
|
||||
$.fancybox.defaults.buttons = [
|
||||
"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({});
|
||||
}
|
||||
}
|
||||
if (set.module.imglightbox == 1) {
|
||||
if (set.is_page == true || set.is_single == true) {
|
||||
var imgarr = $('.post-content-content').find('img').not('.c-downbtn-icon').not('.post-end-tools').not('.link-icon').not('.corepress-url-dh-icon img');
|
||||
for (var i = 0; i < imgarr.length; i++) {
|
||||
if (set.module.imglazyload == 1) {
|
||||
var imgurl = $(imgarr[i]).attr('data-original');
|
||||
} else {
|
||||
var imgurl = $(imgarr[i]).attr('src');
|
||||
}
|
||||
var html = imgarr[i].outerHTML;
|
||||
if ($(imgarr[i]).parent()[0].tagName != 'A') {
|
||||
$(imgarr[i]).replaceWith('<a data-fancybox="gallery" data-type="image" href="' + imgurl + '">' + html + '</a>');
|
||||
}
|
||||
}
|
||||
$.fancybox.defaults.buttons = [
|
||||
"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({});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (set.is_single == 1 || set.is_page == 1) {
|
||||
if (set.corepress_post_meta.catalog == 1) {
|
||||
var i = 0;
|
||||
//文章目录
|
||||
var html = '';
|
||||
$(".post-content h2,.post-content h3").each(function () {
|
||||
var tagName = $(this)[0].tagName.toLowerCase();
|
||||
console.log();
|
||||
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: '质量',
|
||||
if (set.is_single == 1 || set.is_page == 1) {
|
||||
if (set.corepress_post_meta.catalog == 1) {
|
||||
var i = 0;
|
||||
//文章目录
|
||||
var html = '';
|
||||
$(".post-content h2,.post-content h3").each(function () {
|
||||
var tagName = $(this)[0].tagName.toLowerCase();
|
||||
console.log();
|
||||
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: '质量',
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
//图片延迟加载
|
||||
$("img").lazyload({effect: "fadeIn", container: $("html,body,#app")});
|
||||
window.onload = function() {
|
||||
$(window).resize()
|
||||
};
|
||||
if (set.module.imglazyload == 1) {
|
||||
endloadhtml();
|
||||
}
|
||||
}
|
||||
//图片延迟加载
|
||||
$("img").lazyload({effect: "fadeIn", container: $("html,body,#app")});
|
||||
window.onload = function () {
|
||||
$(window).resize()
|
||||
};
|
||||
if (set.module.imglazyload == 1) {
|
||||
endloadhtml();
|
||||
}
|
||||
|
||||
//顶部加载
|
||||
if (set.theme.loadbar == 1) {
|
||||
NProgress.done();
|
||||
}
|
||||
//友链图标
|
||||
if (set.is_home == true) {
|
||||
if (set.index.linksicon == 1) {
|
||||
//顶部加载
|
||||
if (set.theme.loadbar == 1) {
|
||||
NProgress.done();
|
||||
}
|
||||
//友链图标
|
||||
if (set.is_home == true) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function endloadhtml() {
|
||||
$("img.frinds-links-icon").lazyload({effect: "fadeIn"});
|
||||
$("img.frinds-links-icon").lazyload({effect: "fadeIn"});
|
||||
}
|
||||
|
||||
$(window).resize(function () {
|
||||
set_catalog_position();
|
||||
set_catalog_position();
|
||||
});
|
||||
$(document).scroll(function () {
|
||||
if ($('#post-catalog').css('visibility') != 'visible') {
|
||||
return;
|
||||
}
|
||||
$(".post-content h2[catalog],.post-content h3[catalog]").each(function () {
|
||||
var el_y = this.getBoundingClientRect().y;
|
||||
if (el_y < 100 && el_y > 0) {
|
||||
var name = $(this).attr('catalog');
|
||||
set_catalog_css();
|
||||
$('p[catalog=' + name + ']').addClass('catalog-hover');
|
||||
if ($('#post-catalog').css('visibility') != 'visible') {
|
||||
return;
|
||||
}
|
||||
$(".post-content h2[catalog],.post-content h3[catalog]").each(function () {
|
||||
var el_y = this.getBoundingClientRect().y;
|
||||
if (el_y < 100 && el_y > 0) {
|
||||
var name = $(this).attr('catalog');
|
||||
set_catalog_css();
|
||||
$('p[catalog=' + name + ']').addClass('catalog-hover');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function close_show(type) {
|
||||
if (type == 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')
|
||||
}
|
||||
if (type == 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() {
|
||||
$('p[catalog]').removeClass('catalog-hover');
|
||||
$('p[catalog]').removeClass('catalog-hover');
|
||||
}
|
||||
|
||||
function set_catalog_position() {
|
||||
|
||||
if (set.is_page == true || set.is_single == true) {
|
||||
if (set.theme.sidebar_position == 1) {
|
||||
if ($('.post-info').length == 0 || $('.post-content-body').length == 0) {
|
||||
return;
|
||||
}
|
||||
var title_x = $('.post-info').offset().left;
|
||||
$('#post-catalog').css('left', title_x - 200 + 'px');
|
||||
if (set.is_page == true || set.is_single == true) {
|
||||
if (set.theme.sidebar_position == 1) {
|
||||
if ($('.post-info').length == 0 || $('.post-content-body').length == 0) {
|
||||
return;
|
||||
}
|
||||
var title_x = $('.post-info').offset().left;
|
||||
$('#post-catalog').css('left', title_x - 200 + 'px');
|
||||
|
||||
var post_body_x = $('.post-content-body').offset().left;
|
||||
$('#post-catalog-bar').css('left', post_body_x - $("#post-catalog-bar").innerWidth() + 'px');
|
||||
} else {
|
||||
var title_x = $('.post-info').offset().left;
|
||||
title_x = title_x + $('.post-info')[0].getBoundingClientRect().width
|
||||
$('#post-catalog').css('left', title_x + 40 + 'px');
|
||||
var post_body_x = $('.post-content-body').offset().left + $('.post-content-body').innerWidth();
|
||||
$('#post-catalog-bar').css('left', post_body_x + 'px');
|
||||
$('#post-catalog-bar').removeClass('post-catalog-bar-left-minborder');
|
||||
$('#post-catalog-bar').addClass('post-catalog-bar-right-minborder');
|
||||
}
|
||||
}
|
||||
var post_body_x = $('.post-content-body').offset().left;
|
||||
$('#post-catalog-bar').css('left', post_body_x - $("#post-catalog-bar").innerWidth() + 'px');
|
||||
} else {
|
||||
var title_x = $('.post-info').offset().left;
|
||||
title_x = title_x + $('.post-info')[0].getBoundingClientRect().width
|
||||
$('#post-catalog').css('left', title_x + 40 + 'px');
|
||||
var post_body_x = $('.post-content-body').offset().left + $('.post-content-body').innerWidth();
|
||||
$('#post-catalog-bar').css('left', post_body_x + 'px');
|
||||
$('#post-catalog-bar').removeClass('post-catalog-bar-left-minborder');
|
||||
$('#post-catalog-bar').addClass('post-catalog-bar-right-minborder');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function go_catalog(catalogname, tagName) {
|
||||
var _scrolltop = $(tagName + '[catalog=' + catalogname + ']').offset().top;
|
||||
$('html, body').animate({
|
||||
scrollTop: _scrolltop - 60
|
||||
}, 500
|
||||
);
|
||||
var _scrolltop = $(tagName + '[catalog=' + catalogname + ']').offset().top;
|
||||
$('html, body').animate({
|
||||
scrollTop: _scrolltop - 60
|
||||
}, 500
|
||||
);
|
||||
}
|
||||
|
||||
function widget_sentence_load(type, el) {
|
||||
$.get(set.ajaxurl, {action: 'corepress_get_widget_sentence', type}, function (data) {
|
||||
var obj = JSON.parse(data);
|
||||
if (obj.code == 200) {
|
||||
$(el).html('<p>' + obj.data + '</p>');
|
||||
} else {
|
||||
$(el).html('<p>句子加载失败</p>');
|
||||
}
|
||||
})
|
||||
$.get(set.ajaxurl, {action: 'corepress_get_widget_sentence', type}, function (data) {
|
||||
var obj = JSON.parse(data);
|
||||
if (obj.code == 200) {
|
||||
$(el).html('<p>' + obj.data + '</p>');
|
||||
} else {
|
||||
$(el).html('<p>句子加载失败</p>');
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -2,7 +2,7 @@ $(document).click(function (e) {
|
|||
$('.post-pop-plane').removeClass("post-pop-plane-show");
|
||||
e.stopPropagation();
|
||||
});
|
||||
$(".post-info-switch-sidebar").click(function() {
|
||||
$(".post-info-switch-sidebar").click(function () {
|
||||
$(".sidebar").toggleClass("sidebar-display");
|
||||
$(".post-main").toggleClass("post-main-full");
|
||||
$(this).toggleClass("post-info-switch-sidebar-show")
|
||||
|
|
|
|||
|
|
@ -6,38 +6,44 @@ function getQueryVariable(a) {
|
|||
}
|
||||
return !1
|
||||
}
|
||||
|
||||
function htmlEncodeByRegExp(a) {
|
||||
return $("\x3cdiv/\x3e").text(a).html()
|
||||
}
|
||||
|
||||
function htmlDecodeByRegExp(a) {
|
||||
$("\x3cdiv/\x3e").html(a).text()
|
||||
}
|
||||
|
||||
function isElementInViewport(a) {
|
||||
a = a.getBoundingClientRect();
|
||||
return 0 <= a.top && 0 <= a.left && a.bottom <= (window.innerHeight || document.documentElement.clientHeight) && a.right <= (window.innerWidth || document.documentElement.clientWidth)
|
||||
}
|
||||
|
||||
function replaceTag(a) {
|
||||
return a.replace("\x26amp;", "")
|
||||
}
|
||||
|
||||
function addarelt(a, c) {
|
||||
var b = '\x3ci class\x3d"fas fa-info-circle" style\x3d"color: #515a6e"\x3e\x3c/i\x3e';
|
||||
"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');
|
||||
$("body").append('\x3cdiv class\x3d"corepress-alert"\x3e\x3cdiv class\x3d"corepress-alert-main"\x3e' + b + a + "\x3c/div\x3e\x3c/div\x3e");
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$(".corepress-alert-main").addClass("corepress-alert-main-show")
|
||||
}, 20);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$(".corepress-alert-main:first").removeClass("corepress-alert-main-show")
|
||||
}, 3E3);
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$(".corepress-alert:first").remove()
|
||||
}, 3500)
|
||||
}
|
||||
|
||||
function JScopyText(a) {
|
||||
copynotmsg = 1;
|
||||
$("body").append('\x3cdiv id\x3d"tem-copy" style\x3d"visibility: hidden"\x3e\x3c/div\x3e');
|
||||
var c = new ClipboardJS("#tem-copy",{
|
||||
text: function() {
|
||||
var c = new ClipboardJS("#tem-copy", {
|
||||
text: function () {
|
||||
return a
|
||||
}
|
||||
});
|
||||
|
|
@ -45,16 +51,20 @@ function JScopyText(a) {
|
|||
c.destroy();
|
||||
$("#tem-copy").remove()
|
||||
}
|
||||
|
||||
function isChinese(a) {
|
||||
return /.*[\u4e00-\u9fa5]+.*$/.test(a) ? !0 : !1
|
||||
}
|
||||
|
||||
function haveNumandLetter(a) {
|
||||
var c = /[a-z]/i;
|
||||
return /[0-9]/.test(a) && c.test(a) ? !0 : !1
|
||||
}
|
||||
|
||||
function isEmail(a) {
|
||||
return 1 != /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/.test(a) ? !1 : !0
|
||||
}
|
||||
|
||||
function cp_setCookie(a, c, b) {
|
||||
b = b || 0;
|
||||
var d = "";
|
||||
|
|
@ -63,6 +73,7 @@ function cp_setCookie(a, c, 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++) {
|
||||
|
|
@ -72,15 +83,19 @@ function cp_getCookie(a) {
|
|||
}
|
||||
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;
|
||||
|
|
@ -88,6 +103,7 @@ function removedarkcss() {
|
|||
$("#darkModeicon").addClass("fal fa-moon");
|
||||
$(".header-logo img").attr("src", set.logourl)
|
||||
}
|
||||
|
||||
function loaddarkcodecss() {
|
||||
var a = document.createElement("link");
|
||||
a.type = "text/css";
|
||||
|
|
@ -96,9 +112,11 @@ function loaddarkcodecss() {
|
|||
a.id = "darkcodecss";
|
||||
$("body").append(a)
|
||||
}
|
||||
|
||||
function removedarkcodecss() {
|
||||
$("#darkcodecss").remove()
|
||||
}
|
||||
|
||||
function loaddarkcss() {
|
||||
var a = document.createElement("link");
|
||||
a.type = "text/css";
|
||||
|
|
@ -111,33 +129,40 @@ function loaddarkcss() {
|
|||
$("#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() {
|
||||
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",
|
||||
|
|
@ -148,7 +173,7 @@ function loadlazyimg() {
|
|||
event: "load",
|
||||
container: $("html,body,#app")
|
||||
}),
|
||||
setTimeout(function() {
|
||||
setTimeout(function () {
|
||||
$("img.thumbnail").trigger("load")
|
||||
}, 1E3)))
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue