更新
This commit is contained in:
parent
62fa44bf86
commit
f38d55b36c
@ -1,139 +1,139 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const encryption = str => window.btoa(unescape(encodeURIComponent(str)));
|
const encryption = str => window.btoa(unescape(encodeURIComponent(str)));
|
||||||
const decrypt = str => decodeURIComponent(escape(window.atob(str)));
|
const decrypt = str => decodeURIComponent(escape(window.atob(str)));
|
||||||
|
|
||||||
/* 当前页的CID */
|
/* 当前页的CID */
|
||||||
const cid = $('.joe_detail').attr('data-cid');
|
const cid = $('.joe_detail').attr('data-cid');
|
||||||
|
|
||||||
/* 获取本篇文章百度收录情况 */
|
/* 获取本篇文章百度收录情况 */
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Joe.BASE_API,
|
url: Joe.BASE_API,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { routeType: 'baidu_record', site: window.location.href },
|
data: { routeType: 'baidu_record', site: window.location.href },
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.data && res.data === '已收录') {
|
if (res.data && res.data === '已收录') {
|
||||||
$('#Joe_Baidu_Record').css('color', '#67C23A');
|
$('#Joe_Baidu_Record').css('color', '#67C23A');
|
||||||
$('#Joe_Baidu_Record').html('已收录');
|
$('#Joe_Baidu_Record').html('已收录');
|
||||||
} else {
|
} else {
|
||||||
/* 如果填写了Token,则自动推送给百度 */
|
/* 如果填写了Token,则自动推送给百度 */
|
||||||
if (Joe.BAIDU_PUSH) {
|
if (Joe.BAIDU_PUSH) {
|
||||||
$('#Joe_Baidu_Record').html('<span style="color: #E6A23C">未收录,推送中...</span>');
|
$('#Joe_Baidu_Record').html('<span style="color: #E6A23C">未收录,推送中...</span>');
|
||||||
const _timer = setTimeout(function () {
|
const _timer = setTimeout(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Joe.BASE_API,
|
url: Joe.BASE_API,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {
|
data: {
|
||||||
routeType: 'baidu_push',
|
routeType: 'baidu_push',
|
||||||
domain: encodeURI(window.location.hostname),
|
domain: window.location.protocol + '//' + window.location.hostname,
|
||||||
url: encodeURI(window.location.href)
|
url: encodeURI(window.location.protocol + '//' + window.location.hostname + window.location.pathname)
|
||||||
},
|
},
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.error) {
|
if (res.data.error) {
|
||||||
$('#Joe_Baidu_Record').html('<span style="color: #F56C6C">推送失败,请检查!</span>');
|
$('#Joe_Baidu_Record').html('<span style="color: #F56C6C">推送失败,请检查!</span>');
|
||||||
} else {
|
} else {
|
||||||
$('#Joe_Baidu_Record').html('<span style="color: #67C23A">推送成功!</span>');
|
$('#Joe_Baidu_Record').html('<span style="color: #67C23A">推送成功!</span>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
clearTimeout(_timer);
|
clearTimeout(_timer);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
const url = `https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;
|
const url = `https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;
|
||||||
$('#Joe_Baidu_Record').html(`<a target="_blank" href="${url}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`);
|
$('#Joe_Baidu_Record').html(`<a target="_blank" href="${url}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活浏览功能 */
|
/* 激活浏览功能 */
|
||||||
{
|
{
|
||||||
let viewsArr = localStorage.getItem(encryption('views')) ? JSON.parse(decrypt(localStorage.getItem(encryption('views')))) : [];
|
let viewsArr = localStorage.getItem(encryption('views')) ? JSON.parse(decrypt(localStorage.getItem(encryption('views')))) : [];
|
||||||
const flag = viewsArr.includes(cid);
|
const flag = viewsArr.includes(cid);
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Joe.BASE_API,
|
url: Joe.BASE_API,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { routeType: 'handle_views', cid },
|
data: { routeType: 'handle_views', cid },
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.code !== 1) return;
|
if (res.code !== 1) return;
|
||||||
$('#Joe_Article_Views').html(`${res.data.views} 阅读`);
|
$('#Joe_Article_Views').html(`${res.data.views} 阅读`);
|
||||||
viewsArr.push(cid);
|
viewsArr.push(cid);
|
||||||
const name = encryption('views');
|
const name = encryption('views');
|
||||||
const val = encryption(JSON.stringify(viewsArr));
|
const val = encryption(JSON.stringify(viewsArr));
|
||||||
localStorage.setItem(name, val);
|
localStorage.setItem(name, val);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活随机样式 */
|
/* 激活随机样式 */
|
||||||
{
|
{
|
||||||
let _index = 100;
|
let _index = 100;
|
||||||
const colors = ['#F8D800', '#0396FF', '#EA5455', '#7367F0', '#32CCBC', '#F6416C', '#28C76F', '#9F44D3', '#F55555', '#736EFE', '#E96D71', '#DE4313', '#D939CD', '#4C83FF', '#F072B6', '#C346C2', '#5961F9', '#FD6585', '#465EFB', '#FFC600', '#FA742B', '#5151E5', '#BB4E75', '#FF52E5', '#49C628', '#00EAFF', '#F067B4', '#F067B4', '#ff9a9e', '#00f2fe', '#4facfe', '#f093fb', '#6fa3ef', '#bc99c4', '#46c47c', '#f9bb3c', '#e8583d', '#f68e5f'];
|
const colors = ['#F8D800', '#0396FF', '#EA5455', '#7367F0', '#32CCBC', '#F6416C', '#28C76F', '#9F44D3', '#F55555', '#736EFE', '#E96D71', '#DE4313', '#D939CD', '#4C83FF', '#F072B6', '#C346C2', '#5961F9', '#FD6585', '#465EFB', '#FFC600', '#FA742B', '#5151E5', '#BB4E75', '#FF52E5', '#49C628', '#00EAFF', '#F067B4', '#F067B4', '#ff9a9e', '#00f2fe', '#4facfe', '#f093fb', '#6fa3ef', '#bc99c4', '#46c47c', '#f9bb3c', '#e8583d', '#f68e5f'];
|
||||||
const random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
|
const random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;
|
||||||
const maxWidth = $('.joe_detail__leaving-list').width();
|
const maxWidth = $('.joe_detail__leaving-list').width();
|
||||||
const maxHeight = $('.joe_detail__leaving-list').height();
|
const maxHeight = $('.joe_detail__leaving-list').height();
|
||||||
const radius1 = ['20px 300px', '20px 400px', '20px 500px', '30px 300px', '30px 400px', '30px 500px', '40px 300px', '40px 400px', '40px 500px'];
|
const radius1 = ['20px 300px', '20px 400px', '20px 500px', '30px 300px', '30px 400px', '30px 500px', '40px 300px', '40px 400px', '40px 500px'];
|
||||||
const radius2 = ['300px 20px', '400px 20px', '500px 20px', '300px 30px', '400px 30px', '500px 30px', '300px 40px', '400px 40px', '500px 40px'];
|
const radius2 = ['300px 20px', '400px 20px', '500px 20px', '300px 30px', '400px 30px', '500px 30px', '300px 40px', '400px 40px', '500px 40px'];
|
||||||
$('.joe_detail__leaving-list .item').each((index, item) => {
|
$('.joe_detail__leaving-list .item').each((index, item) => {
|
||||||
const zIndex = random(1, 99);
|
const zIndex = random(1, 99);
|
||||||
const background = colors[random(0, colors.length - 1)];
|
const background = colors[random(0, colors.length - 1)];
|
||||||
const width = Math.ceil($(item).width());
|
const width = Math.ceil($(item).width());
|
||||||
const height = Math.ceil($(item).height());
|
const height = Math.ceil($(item).height());
|
||||||
const top = random(0, maxHeight - height);
|
const top = random(0, maxHeight - height);
|
||||||
const left = random(0, maxWidth - width);
|
const left = random(0, maxWidth - width);
|
||||||
$(item).css({
|
$(item).css({
|
||||||
display: 'block',
|
display: 'block',
|
||||||
zIndex,
|
zIndex,
|
||||||
background,
|
background,
|
||||||
top,
|
top,
|
||||||
left,
|
left,
|
||||||
borderTopLeftRadius: radius2[random(0, radius2.length - 1)],
|
borderTopLeftRadius: radius2[random(0, radius2.length - 1)],
|
||||||
borderTopRightRadius: radius1[random(0, radius1.length - 1)],
|
borderTopRightRadius: radius1[random(0, radius1.length - 1)],
|
||||||
borderBottomLeftRadius: radius1[random(0, radius1.length - 1)],
|
borderBottomLeftRadius: radius1[random(0, radius1.length - 1)],
|
||||||
borderBottomRightRadius: radius1[random(0, radius1.length - 1)]
|
borderBottomRightRadius: radius1[random(0, radius1.length - 1)]
|
||||||
});
|
});
|
||||||
$(item).draggabilly({ containment: true });
|
$(item).draggabilly({ containment: true });
|
||||||
$(item).on('dragStart', e => {
|
$(item).on('dragStart', e => {
|
||||||
_index++;
|
_index++;
|
||||||
$(item).css({ zIndex: _index });
|
$(item).css({ zIndex: _index });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 格式化分页的hash值 */
|
/* 格式化分页的hash值 */
|
||||||
{
|
{
|
||||||
$('.joe_comment .joe_pagination a').each((index, item) => {
|
$('.joe_comment .joe_pagination a').each((index, item) => {
|
||||||
const href = $(item).attr('href');
|
const href = $(item).attr('href');
|
||||||
if (href && href.includes('#')) {
|
if (href && href.includes('#')) {
|
||||||
$(item).attr('href', href.replace('#comments', '?scroll=joe_comment'));
|
$(item).attr('href', href.replace('#comments', '?scroll=joe_comment'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 写在load事件里,为了解决图片未加载完成,滚动距离获取会不准确的问题 */
|
/* 写在load事件里,为了解决图片未加载完成,滚动距离获取会不准确的问题 */
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
/* 判断地址栏是否有锚点链接,有则跳转到对应位置 */
|
/* 判断地址栏是否有锚点链接,有则跳转到对应位置 */
|
||||||
{
|
{
|
||||||
const scroll = new URLSearchParams(location.search).get('scroll');
|
const scroll = new URLSearchParams(location.search).get('scroll');
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
const height = $('.joe_header').height();
|
const height = $('.joe_header').height();
|
||||||
let elementEL = null;
|
let elementEL = null;
|
||||||
if ($('#' + scroll).length > 0) {
|
if ($('#' + scroll).length > 0) {
|
||||||
elementEL = $('#' + scroll);
|
elementEL = $('#' + scroll);
|
||||||
} else {
|
} else {
|
||||||
elementEL = $('.' + scroll);
|
elementEL = $('.' + scroll);
|
||||||
}
|
}
|
||||||
if (elementEL && elementEL.length > 0) {
|
if (elementEL && elementEL.length > 0) {
|
||||||
const top = elementEL.offset().top - height - 15;
|
const top = elementEL.offset().top - height - 15;
|
||||||
window.scrollTo({ top, behavior: 'smooth' });
|
window.scrollTo({ top, behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
2
assets/js/joe.leaving.min.js
vendored
2
assets/js/joe.leaving.min.js
vendored
@ -1 +1 @@
|
|||||||
document.addEventListener("DOMContentLoaded",()=>{const e=e=>window.btoa(unescape(encodeURIComponent(e))),o=e=>decodeURIComponent(escape(window.atob(e))),t=$(".joe_detail").attr("data-cid");$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_record",site:window.location.href},success(e){if(e.data&&"已收录"===e.data)$("#Joe_Baidu_Record").css("color","#67C23A"),$("#Joe_Baidu_Record").html("已收录");else if(Joe.BAIDU_PUSH){$("#Joe_Baidu_Record").html('<span style="color: #E6A23C">未收录,推送中...</span>');const e=setTimeout(function(){$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_push",domain:encodeURI(window.location.hostname),url:encodeURI(window.location.href)},success(e){e.error?$("#Joe_Baidu_Record").html('<span style="color: #F56C6C">推送失败,请检查!</span>'):$("#Joe_Baidu_Record").html('<span style="color: #67C23A">推送成功!</span>')}}),clearTimeout(e)},1e3)}else{const e=`https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;$("#Joe_Baidu_Record").html(`<a target="_blank" href="${e}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`)}}});{let a=localStorage.getItem(e("views"))?JSON.parse(o(localStorage.getItem(e("views")))):[];const n=a.includes(t);n||$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"handle_views",cid:t},success(o){if(1!==o.code)return;$("#Joe_Article_Views").html(`${o.data.views} 阅读`),a.push(t);const n=e("views"),i=e(JSON.stringify(a));localStorage.setItem(n,i)}})}{let e=100;const o=["#F8D800","#0396FF","#EA5455","#7367F0","#32CCBC","#F6416C","#28C76F","#9F44D3","#F55555","#736EFE","#E96D71","#DE4313","#D939CD","#4C83FF","#F072B6","#C346C2","#5961F9","#FD6585","#465EFB","#FFC600","#FA742B","#5151E5","#BB4E75","#FF52E5","#49C628","#00EAFF","#F067B4","#F067B4","#ff9a9e","#00f2fe","#4facfe","#f093fb","#6fa3ef","#bc99c4","#46c47c","#f9bb3c","#e8583d","#f68e5f"],t=(e,o)=>Math.floor(Math.random()*(o-e+1))+e,a=$(".joe_detail__leaving-list").width(),n=$(".joe_detail__leaving-list").height(),i=["20px 300px","20px 400px","20px 500px","30px 300px","30px 400px","30px 500px","40px 300px","40px 400px","40px 500px"],l=["300px 20px","400px 20px","500px 20px","300px 30px","400px 30px","500px 30px","300px 40px","400px 40px","500px 40px"];$(".joe_detail__leaving-list .item").each((c,s)=>{const d=t(1,99),r=o[t(0,o.length-1)],p=Math.ceil($(s).width()),h=Math.ceil($(s).height()),x=t(0,n-h),u=t(0,a-p);$(s).css({display:"block",zIndex:d,background:r,top:x,left:u,borderTopLeftRadius:l[t(0,l.length-1)],borderTopRightRadius:i[t(0,i.length-1)],borderBottomLeftRadius:i[t(0,i.length-1)],borderBottomRightRadius:i[t(0,i.length-1)]}),$(s).draggabilly({containment:!0}),$(s).on("dragStart",o=>{e++,$(s).css({zIndex:e})})})}$(".joe_comment .joe_pagination a").each((e,o)=>{const t=$(o).attr("href");t&&t.includes("#")&&$(o).attr("href",t.replace("#comments","?scroll=joe_comment"))})}),window.addEventListener("load",function(){{const e=new URLSearchParams(location.search).get("scroll");if(e){const o=$(".joe_header").height();let t=null;if(t=$("#"+e).length>0?$("#"+e):$("."+e),t&&t.length>0){const e=t.offset().top-o-15;window.scrollTo({top:e,behavior:"smooth"})}}}});
|
document.addEventListener("DOMContentLoaded",()=>{const e=e=>window.btoa(unescape(encodeURIComponent(e))),o=e=>decodeURIComponent(escape(window.atob(e))),t=$(".joe_detail").attr("data-cid");$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_record",site:window.location.href},success(e){if(e.data&&"已收录"===e.data)$("#Joe_Baidu_Record").css("color","#67C23A"),$("#Joe_Baidu_Record").html("已收录");else if(Joe.BAIDU_PUSH){$("#Joe_Baidu_Record").html('<span style="color: #E6A23C">未收录,推送中...</span>');const e=setTimeout(function(){$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_push",domain:window.location.protocol+"//"+window.location.hostname,url:encodeURI(window.location.protocol+"//"+window.location.hostname+window.location.pathname)},success(e){e.data.error?$("#Joe_Baidu_Record").html('<span style="color: #F56C6C">推送失败,请检查!</span>'):$("#Joe_Baidu_Record").html('<span style="color: #67C23A">推送成功!</span>')}}),clearTimeout(e)},1e3)}else{const e=`https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;$("#Joe_Baidu_Record").html(`<a target="_blank" href="${e}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`)}}});{let a=localStorage.getItem(e("views"))?JSON.parse(o(localStorage.getItem(e("views")))):[];const n=a.includes(t);n||$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"handle_views",cid:t},success(o){if(1!==o.code)return;$("#Joe_Article_Views").html(`${o.data.views} 阅读`),a.push(t);const n=e("views"),i=e(JSON.stringify(a));localStorage.setItem(n,i)}})}{let e=100;const o=["#F8D800","#0396FF","#EA5455","#7367F0","#32CCBC","#F6416C","#28C76F","#9F44D3","#F55555","#736EFE","#E96D71","#DE4313","#D939CD","#4C83FF","#F072B6","#C346C2","#5961F9","#FD6585","#465EFB","#FFC600","#FA742B","#5151E5","#BB4E75","#FF52E5","#49C628","#00EAFF","#F067B4","#F067B4","#ff9a9e","#00f2fe","#4facfe","#f093fb","#6fa3ef","#bc99c4","#46c47c","#f9bb3c","#e8583d","#f68e5f"],t=(e,o)=>Math.floor(Math.random()*(o-e+1))+e,a=$(".joe_detail__leaving-list").width(),n=$(".joe_detail__leaving-list").height(),i=["20px 300px","20px 400px","20px 500px","30px 300px","30px 400px","30px 500px","40px 300px","40px 400px","40px 500px"],l=["300px 20px","400px 20px","500px 20px","300px 30px","400px 30px","500px 30px","300px 40px","400px 40px","500px 40px"];$(".joe_detail__leaving-list .item").each((c,d)=>{const s=t(1,99),r=o[t(0,o.length-1)],p=Math.ceil($(d).width()),h=Math.ceil($(d).height()),x=t(0,n-h),u=t(0,a-p);$(d).css({display:"block",zIndex:s,background:r,top:x,left:u,borderTopLeftRadius:l[t(0,l.length-1)],borderTopRightRadius:i[t(0,i.length-1)],borderBottomLeftRadius:i[t(0,i.length-1)],borderBottomRightRadius:i[t(0,i.length-1)]}),$(d).draggabilly({containment:!0}),$(d).on("dragStart",o=>{e++,$(d).css({zIndex:e})})})}$(".joe_comment .joe_pagination a").each((e,o)=>{const t=$(o).attr("href");t&&t.includes("#")&&$(o).attr("href",t.replace("#comments","?scroll=joe_comment"))})}),window.addEventListener("load",function(){{const e=new URLSearchParams(location.search).get("scroll");if(e){const o=$(".joe_header").height();let t=null;if(t=$("#"+e).length>0?$("#"+e):$("."+e),t&&t.length>0){const e=t.offset().top-o-15;window.scrollTo({top:e,behavior:"smooth"})}}}});
|
@ -1,221 +1,221 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
const encryption = str => window.btoa(unescape(encodeURIComponent(str)));
|
const encryption = str => window.btoa(unescape(encodeURIComponent(str)));
|
||||||
const decrypt = str => decodeURIComponent(escape(window.atob(str)));
|
const decrypt = str => decodeURIComponent(escape(window.atob(str)));
|
||||||
|
|
||||||
/* 当前页的CID */
|
/* 当前页的CID */
|
||||||
const cid = $('.joe_detail').attr('data-cid');
|
const cid = $('.joe_detail').attr('data-cid');
|
||||||
|
|
||||||
/* 获取本篇文章百度收录情况 */
|
/* 获取本篇文章百度收录情况 */
|
||||||
{
|
{
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Joe.BASE_API,
|
url: Joe.BASE_API,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { routeType: 'baidu_record', site: window.location.href },
|
data: { routeType: 'baidu_record', site: window.location.href },
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.data && res.data === '已收录') {
|
if (res.data && res.data === '已收录') {
|
||||||
$('#Joe_Baidu_Record').css('color', '#67C23A');
|
$('#Joe_Baidu_Record').css('color', '#67C23A');
|
||||||
$('#Joe_Baidu_Record').html('已收录');
|
$('#Joe_Baidu_Record').html('已收录');
|
||||||
} else {
|
} else {
|
||||||
/* 如果填写了Token,则自动推送给百度 */
|
/* 如果填写了Token,则自动推送给百度 */
|
||||||
if (Joe.BAIDU_PUSH) {
|
if (Joe.BAIDU_PUSH) {
|
||||||
$('#Joe_Baidu_Record').html('<span style="color: #E6A23C">未收录,推送中...</span>');
|
$('#Joe_Baidu_Record').html('<span style="color: #E6A23C">未收录,推送中...</span>');
|
||||||
const _timer = setTimeout(function () {
|
const _timer = setTimeout(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Joe.BASE_API,
|
url: Joe.BASE_API,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {
|
data: {
|
||||||
routeType: 'baidu_push',
|
routeType: 'baidu_push',
|
||||||
domain: encodeURI(window.location.hostname),
|
domain: window.location.protocol + '//' + window.location.hostname,
|
||||||
url: encodeURI(window.location.href)
|
url: encodeURI(window.location.protocol + '//' + window.location.hostname + window.location.pathname)
|
||||||
},
|
},
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.error) {
|
if (res.data.error) {
|
||||||
$('#Joe_Baidu_Record').html('<span style="color: #F56C6C">推送失败,请检查!</span>');
|
$('#Joe_Baidu_Record').html('<span style="color: #F56C6C">推送失败,请检查!</span>');
|
||||||
} else {
|
} else {
|
||||||
$('#Joe_Baidu_Record').html('<span style="color: #67C23A">推送成功!</span>');
|
$('#Joe_Baidu_Record').html('<span style="color: #67C23A">推送成功!</span>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
clearTimeout(_timer);
|
clearTimeout(_timer);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} else {
|
} else {
|
||||||
const url = `https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;
|
const url = `https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;
|
||||||
$('#Joe_Baidu_Record').html(`<a target="_blank" href="${url}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`);
|
$('#Joe_Baidu_Record').html(`<a target="_blank" href="${url}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活代码高亮 */
|
/* 激活代码高亮 */
|
||||||
{
|
{
|
||||||
Prism.highlightAll();
|
Prism.highlightAll();
|
||||||
$("pre[class*='language-']").each(function (index, item) {
|
$("pre[class*='language-']").each(function (index, item) {
|
||||||
let text = $(item).find("code[class*='language-']").text();
|
let text = $(item).find("code[class*='language-']").text();
|
||||||
let span = $(`<span class="copy"><i class="fa fa-clone"></i></span>`);
|
let span = $(`<span class="copy"><i class="fa fa-clone"></i></span>`);
|
||||||
new ClipboardJS(span[0], { text: () => text }).on('success', () => Qmsg.success('复制成功!'));
|
new ClipboardJS(span[0], { text: () => text }).on('success', () => Qmsg.success('复制成功!'));
|
||||||
$(item).append(span);
|
$(item).append(span);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活图片预览功能 */
|
/* 激活图片预览功能 */
|
||||||
{
|
{
|
||||||
$('.joe_detail__article img:not(img.owo_image)').each(function () {
|
$('.joe_detail__article img:not(img.owo_image)').each(function () {
|
||||||
$(this).wrap($(`<span data-fancybox="Joe" href="${$(this).attr('src')}"></span>`));
|
$(this).wrap($(`<span data-fancybox="Joe" href="${$(this).attr('src')}"></span>`));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 设置文章内的链接为新窗口打开 */
|
/* 设置文章内的链接为新窗口打开 */
|
||||||
{
|
{
|
||||||
$('.joe_detail__article a:not(.joe_detail__article-anote)').each(function () {
|
$('.joe_detail__article a:not(.joe_detail__article-anote)').each(function () {
|
||||||
$(this).attr({ target: '_blank', rel: 'noopener noreferrer nofollow' });
|
$(this).attr({ target: '_blank', rel: 'noopener noreferrer nofollow' });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活浏览功能 */
|
/* 激活浏览功能 */
|
||||||
{
|
{
|
||||||
let viewsArr = localStorage.getItem(encryption('views')) ? JSON.parse(decrypt(localStorage.getItem(encryption('views')))) : [];
|
let viewsArr = localStorage.getItem(encryption('views')) ? JSON.parse(decrypt(localStorage.getItem(encryption('views')))) : [];
|
||||||
const flag = viewsArr.includes(cid);
|
const flag = viewsArr.includes(cid);
|
||||||
if (!flag) {
|
if (!flag) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Joe.BASE_API,
|
url: Joe.BASE_API,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { routeType: 'handle_views', cid },
|
data: { routeType: 'handle_views', cid },
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.code !== 1) return;
|
if (res.code !== 1) return;
|
||||||
$('#Joe_Article_Views').html(`${res.data.views} 阅读`);
|
$('#Joe_Article_Views').html(`${res.data.views} 阅读`);
|
||||||
viewsArr.push(cid);
|
viewsArr.push(cid);
|
||||||
const name = encryption('views');
|
const name = encryption('views');
|
||||||
const val = encryption(JSON.stringify(viewsArr));
|
const val = encryption(JSON.stringify(viewsArr));
|
||||||
localStorage.setItem(name, val);
|
localStorage.setItem(name, val);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活文章点赞功能 */
|
/* 激活文章点赞功能 */
|
||||||
{
|
{
|
||||||
let agreeArr = localStorage.getItem(encryption('agree')) ? JSON.parse(decrypt(localStorage.getItem(encryption('agree')))) : [];
|
let agreeArr = localStorage.getItem(encryption('agree')) ? JSON.parse(decrypt(localStorage.getItem(encryption('agree')))) : [];
|
||||||
if (agreeArr.includes(cid)) $('.joe_detail__agree .icon-1').addClass('active');
|
if (agreeArr.includes(cid)) $('.joe_detail__agree .icon-1').addClass('active');
|
||||||
else $('.joe_detail__agree .icon-2').addClass('active');
|
else $('.joe_detail__agree .icon-2').addClass('active');
|
||||||
let _loading = false;
|
let _loading = false;
|
||||||
$('.joe_detail__agree .icon').on('click', function () {
|
$('.joe_detail__agree .icon').on('click', function () {
|
||||||
if (_loading) return;
|
if (_loading) return;
|
||||||
_loading = true;
|
_loading = true;
|
||||||
agreeArr = localStorage.getItem(encryption('agree')) ? JSON.parse(decrypt(localStorage.getItem(encryption('agree')))) : [];
|
agreeArr = localStorage.getItem(encryption('agree')) ? JSON.parse(decrypt(localStorage.getItem(encryption('agree')))) : [];
|
||||||
let flag = agreeArr.includes(cid);
|
let flag = agreeArr.includes(cid);
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: Joe.BASE_API,
|
url: Joe.BASE_API,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: { routeType: 'handle_agree', cid, type: flag ? 'disagree' : 'agree' },
|
data: { routeType: 'handle_agree', cid, type: flag ? 'disagree' : 'agree' },
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.code !== 1) return;
|
if (res.code !== 1) return;
|
||||||
$('.joe_detail__agree .text').html(res.data.agree);
|
$('.joe_detail__agree .text').html(res.data.agree);
|
||||||
if (flag) {
|
if (flag) {
|
||||||
const index = agreeArr.findIndex(_ => _ === cid);
|
const index = agreeArr.findIndex(_ => _ === cid);
|
||||||
agreeArr.splice(index, 1);
|
agreeArr.splice(index, 1);
|
||||||
$('.joe_detail__agree .icon-1').removeClass('active');
|
$('.joe_detail__agree .icon-1').removeClass('active');
|
||||||
$('.joe_detail__agree .icon-2').addClass('active');
|
$('.joe_detail__agree .icon-2').addClass('active');
|
||||||
$('.joe_detail__agree .icon').removeClass('active');
|
$('.joe_detail__agree .icon').removeClass('active');
|
||||||
} else {
|
} else {
|
||||||
agreeArr.push(cid);
|
agreeArr.push(cid);
|
||||||
$('.joe_detail__agree .icon-2').removeClass('active');
|
$('.joe_detail__agree .icon-2').removeClass('active');
|
||||||
$('.joe_detail__agree .icon-1').addClass('active');
|
$('.joe_detail__agree .icon-1').addClass('active');
|
||||||
$('.joe_detail__agree .icon').addClass('active');
|
$('.joe_detail__agree .icon').addClass('active');
|
||||||
}
|
}
|
||||||
const name = encryption('agree');
|
const name = encryption('agree');
|
||||||
const val = encryption(JSON.stringify(agreeArr));
|
const val = encryption(JSON.stringify(agreeArr));
|
||||||
localStorage.setItem(name, val);
|
localStorage.setItem(name, val);
|
||||||
},
|
},
|
||||||
complete() {
|
complete() {
|
||||||
_loading = false;
|
_loading = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 格式化分页的hash值 */
|
/* 格式化分页的hash值 */
|
||||||
{
|
{
|
||||||
$('.joe_comment .joe_pagination a').each((index, item) => {
|
$('.joe_comment .joe_pagination a').each((index, item) => {
|
||||||
const href = $(item).attr('href');
|
const href = $(item).attr('href');
|
||||||
if (href && href.includes('#')) {
|
if (href && href.includes('#')) {
|
||||||
$(item).attr('href', href.replace('#comments', '?scroll=joe_comment'));
|
$(item).attr('href', href.replace('#comments', '?scroll=joe_comment'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 密码保护文章,输入密码访问 */
|
/* 密码保护文章,输入密码访问 */
|
||||||
{
|
{
|
||||||
let isSubmit = false;
|
let isSubmit = false;
|
||||||
$('.joe_detail__article-protected').on('submit', function (e) {
|
$('.joe_detail__article-protected').on('submit', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const url = $(this).attr('action') + '&time=' + +new Date();
|
const url = $(this).attr('action') + '&time=' + +new Date();
|
||||||
const protectPassword = $(this).find('input[type="password"]').val();
|
const protectPassword = $(this).find('input[type="password"]').val();
|
||||||
if (protectPassword.trim() === '') return Qmsg.info('请输入访问密码!');
|
if (protectPassword.trim() === '') return Qmsg.info('请输入访问密码!');
|
||||||
if (isSubmit) return;
|
if (isSubmit) return;
|
||||||
isSubmit = true;
|
isSubmit = true;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url,
|
url,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: {
|
data: {
|
||||||
cid,
|
cid,
|
||||||
protectPassword
|
protectPassword
|
||||||
},
|
},
|
||||||
dataType: 'text',
|
dataType: 'text',
|
||||||
success(res) {
|
success(res) {
|
||||||
let arr = [],
|
let arr = [],
|
||||||
str = '';
|
str = '';
|
||||||
arr = $(res).contents();
|
arr = $(res).contents();
|
||||||
Array.from(arr).forEach(_ => {
|
Array.from(arr).forEach(_ => {
|
||||||
if (_.parentNode.className === 'container') str = _;
|
if (_.parentNode.className === 'container') str = _;
|
||||||
});
|
});
|
||||||
if (!/Joe/.test(res)) {
|
if (!/Joe/.test(res)) {
|
||||||
Qmsg.warning(str.textContent.trim() || '');
|
Qmsg.warning(str.textContent.trim() || '');
|
||||||
isSubmit = false;
|
isSubmit = false;
|
||||||
$('.joe_comment__respond-form .foot .submit button').html('发表评论');
|
$('.joe_comment__respond-form .foot .submit button').html('发表评论');
|
||||||
} else {
|
} else {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活文章视频模块 */
|
/* 激活文章视频模块 */
|
||||||
{
|
{
|
||||||
if ($('.joe_detail__article-video').length > 0) {
|
if ($('.joe_detail__article-video').length > 0) {
|
||||||
const player = $('.joe_detail__article-video .play iframe').attr('data-player');
|
const player = $('.joe_detail__article-video .play iframe').attr('data-player');
|
||||||
$('.joe_detail__article-video .episodes .item').on('click', function () {
|
$('.joe_detail__article-video .episodes .item').on('click', function () {
|
||||||
$(this).addClass('active').siblings().removeClass('active');
|
$(this).addClass('active').siblings().removeClass('active');
|
||||||
const url = $(this).attr('data-src');
|
const url = $(this).attr('data-src');
|
||||||
$('.joe_detail__article-video .play iframe').attr({ src: player + url });
|
$('.joe_detail__article-video .play iframe').attr({ src: player + url });
|
||||||
});
|
});
|
||||||
$('.joe_detail__article-video .episodes .item').first().click();
|
$('.joe_detail__article-video .episodes .item').first().click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/* 写在load事件里,为了解决图片未加载完成,滚动距离获取会不准确的问题 */
|
/* 写在load事件里,为了解决图片未加载完成,滚动距离获取会不准确的问题 */
|
||||||
window.addEventListener('load', function () {
|
window.addEventListener('load', function () {
|
||||||
/* 判断地址栏是否有锚点链接,有则跳转到对应位置 */
|
/* 判断地址栏是否有锚点链接,有则跳转到对应位置 */
|
||||||
{
|
{
|
||||||
const scroll = new URLSearchParams(location.search).get('scroll');
|
const scroll = new URLSearchParams(location.search).get('scroll');
|
||||||
if (scroll) {
|
if (scroll) {
|
||||||
const height = $('.joe_header').height();
|
const height = $('.joe_header').height();
|
||||||
let elementEL = null;
|
let elementEL = null;
|
||||||
if ($('#' + scroll).length > 0) {
|
if ($('#' + scroll).length > 0) {
|
||||||
elementEL = $('#' + scroll);
|
elementEL = $('#' + scroll);
|
||||||
} else {
|
} else {
|
||||||
elementEL = $('.' + scroll);
|
elementEL = $('.' + scroll);
|
||||||
}
|
}
|
||||||
if (elementEL && elementEL.length > 0) {
|
if (elementEL && elementEL.length > 0) {
|
||||||
const top = elementEL.offset().top - height - 15;
|
const top = elementEL.offset().top - height - 15;
|
||||||
window.scrollTo({ top, behavior: 'smooth' });
|
window.scrollTo({ top, behavior: 'smooth' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
2
assets/js/joe.post_page.min.js
vendored
2
assets/js/joe.post_page.min.js
vendored
@ -1 +1 @@
|
|||||||
document.addEventListener("DOMContentLoaded",()=>{const e=e=>window.btoa(unescape(encodeURIComponent(e))),t=e=>decodeURIComponent(escape(window.atob(e))),a=$(".joe_detail").attr("data-cid");$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_record",site:window.location.href},success(e){if(e.data&&"已收录"===e.data)$("#Joe_Baidu_Record").css("color","#67C23A"),$("#Joe_Baidu_Record").html("已收录");else if(Joe.BAIDU_PUSH){$("#Joe_Baidu_Record").html('<span style="color: #E6A23C">未收录,推送中...</span>');const e=setTimeout(function(){$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_push",domain:encodeURI(window.location.hostname),url:encodeURI(window.location.href)},success(e){e.error?$("#Joe_Baidu_Record").html('<span style="color: #F56C6C">推送失败,请检查!</span>'):$("#Joe_Baidu_Record").html('<span style="color: #67C23A">推送成功!</span>')}}),clearTimeout(e)},1e3)}else{const e=`https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;$("#Joe_Baidu_Record").html(`<a target="_blank" href="${e}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`)}}}),Prism.highlightAll(),$("pre[class*='language-']").each(function(e,t){let a=$(t).find("code[class*='language-']").text(),o=$('<span class="copy"><i class="fa fa-clone"></i></span>');new ClipboardJS(o[0],{text:()=>a}).on("success",()=>Qmsg.success("复制成功!")),$(t).append(o)}),$(".joe_detail__article img:not(img.owo_image)").each(function(){$(this).wrap($(`<span data-fancybox="Joe" href="${$(this).attr("src")}"></span>`))}),$(".joe_detail__article a:not(.joe_detail__article-anote)").each(function(){$(this).attr({target:"_blank",rel:"noopener noreferrer nofollow"})});{let o=localStorage.getItem(e("views"))?JSON.parse(t(localStorage.getItem(e("views")))):[];const i=o.includes(a);i||$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"handle_views",cid:a},success(t){if(1!==t.code)return;$("#Joe_Article_Views").html(`${t.data.views} 阅读`),o.push(a);const i=e("views"),s=e(JSON.stringify(o));localStorage.setItem(i,s)}})}{let o=localStorage.getItem(e("agree"))?JSON.parse(t(localStorage.getItem(e("agree")))):[];o.includes(a)?$(".joe_detail__agree .icon-1").addClass("active"):$(".joe_detail__agree .icon-2").addClass("active");let i=!1;$(".joe_detail__agree .icon").on("click",function(){if(i)return;i=!0,o=localStorage.getItem(e("agree"))?JSON.parse(t(localStorage.getItem(e("agree")))):[];let s=o.includes(a);$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"handle_agree",cid:a,type:s?"disagree":"agree"},success(t){if(1!==t.code)return;if($(".joe_detail__agree .text").html(t.data.agree),s){const e=o.findIndex(e=>e===a);o.splice(e,1),$(".joe_detail__agree .icon-1").removeClass("active"),$(".joe_detail__agree .icon-2").addClass("active"),$(".joe_detail__agree .icon").removeClass("active")}else o.push(a),$(".joe_detail__agree .icon-2").removeClass("active"),$(".joe_detail__agree .icon-1").addClass("active"),$(".joe_detail__agree .icon").addClass("active");const i=e("agree"),n=e(JSON.stringify(o));localStorage.setItem(i,n)},complete(){i=!1}})})}$(".joe_comment .joe_pagination a").each((e,t)=>{const a=$(t).attr("href");a&&a.includes("#")&&$(t).attr("href",a.replace("#comments","?scroll=joe_comment"))});{let e=!1;$(".joe_detail__article-protected").on("submit",function(t){t.preventDefault();const o=$(this).attr("action")+"&time="+ +new Date,i=$(this).find('input[type="password"]').val();if(""===i.trim())return Qmsg.info("请输入访问密码!");e||(e=!0,$.ajax({url:o,type:"POST",data:{cid:a,protectPassword:i},dataType:"text",success(t){let a=[],o="";a=$(t).contents(),Array.from(a).forEach(e=>{"container"===e.parentNode.className&&(o=e)}),/Joe/.test(t)?location.reload():(Qmsg.warning(o.textContent.trim()||""),e=!1,$(".joe_comment__respond-form .foot .submit button").html("发表评论"))}}))})}if($(".joe_detail__article-video").length>0){const e=$(".joe_detail__article-video .play iframe").attr("data-player");$(".joe_detail__article-video .episodes .item").on("click",function(){$(this).addClass("active").siblings().removeClass("active");const t=$(this).attr("data-src");$(".joe_detail__article-video .play iframe").attr({src:e+t})}),$(".joe_detail__article-video .episodes .item").first().click()}}),window.addEventListener("load",function(){{const e=new URLSearchParams(location.search).get("scroll");if(e){const t=$(".joe_header").height();let a=null;if(a=$("#"+e).length>0?$("#"+e):$("."+e),a&&a.length>0){const e=a.offset().top-t-15;window.scrollTo({top:e,behavior:"smooth"})}}}});
|
document.addEventListener("DOMContentLoaded",()=>{const e=e=>window.btoa(unescape(encodeURIComponent(e))),t=e=>decodeURIComponent(escape(window.atob(e))),a=$(".joe_detail").attr("data-cid");$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_record",site:window.location.href},success(e){if(e.data&&"已收录"===e.data)$("#Joe_Baidu_Record").css("color","#67C23A"),$("#Joe_Baidu_Record").html("已收录");else if(Joe.BAIDU_PUSH){$("#Joe_Baidu_Record").html('<span style="color: #E6A23C">未收录,推送中...</span>');const e=setTimeout(function(){$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"baidu_push",domain:window.location.protocol+"//"+window.location.hostname,url:encodeURI(window.location.protocol+"//"+window.location.hostname+window.location.pathname)},success(e){e.data.error?$("#Joe_Baidu_Record").html('<span style="color: #F56C6C">推送失败,请检查!</span>'):$("#Joe_Baidu_Record").html('<span style="color: #67C23A">推送成功!</span>')}}),clearTimeout(e)},1e3)}else{const e=`https://ziyuan.baidu.com/linksubmit/url?sitename=${encodeURI(window.location.href)}`;$("#Joe_Baidu_Record").html(`<a target="_blank" href="${e}" rel="noopener noreferrer nofollow" style="color: #F56C6C">未收录,提交收录</a>`)}}}),Prism.highlightAll(),$("pre[class*='language-']").each(function(e,t){let a=$(t).find("code[class*='language-']").text(),o=$('<span class="copy"><i class="fa fa-clone"></i></span>');new ClipboardJS(o[0],{text:()=>a}).on("success",()=>Qmsg.success("复制成功!")),$(t).append(o)}),$(".joe_detail__article img:not(img.owo_image)").each(function(){$(this).wrap($(`<span data-fancybox="Joe" href="${$(this).attr("src")}"></span>`))}),$(".joe_detail__article a:not(.joe_detail__article-anote)").each(function(){$(this).attr({target:"_blank",rel:"noopener noreferrer nofollow"})});{let o=localStorage.getItem(e("views"))?JSON.parse(t(localStorage.getItem(e("views")))):[];const i=o.includes(a);i||$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"handle_views",cid:a},success(t){if(1!==t.code)return;$("#Joe_Article_Views").html(`${t.data.views} 阅读`),o.push(a);const i=e("views"),n=e(JSON.stringify(o));localStorage.setItem(i,n)}})}{let o=localStorage.getItem(e("agree"))?JSON.parse(t(localStorage.getItem(e("agree")))):[];o.includes(a)?$(".joe_detail__agree .icon-1").addClass("active"):$(".joe_detail__agree .icon-2").addClass("active");let i=!1;$(".joe_detail__agree .icon").on("click",function(){if(i)return;i=!0,o=localStorage.getItem(e("agree"))?JSON.parse(t(localStorage.getItem(e("agree")))):[];let n=o.includes(a);$.ajax({url:Joe.BASE_API,type:"POST",dataType:"json",data:{routeType:"handle_agree",cid:a,type:n?"disagree":"agree"},success(t){if(1!==t.code)return;if($(".joe_detail__agree .text").html(t.data.agree),n){const e=o.findIndex(e=>e===a);o.splice(e,1),$(".joe_detail__agree .icon-1").removeClass("active"),$(".joe_detail__agree .icon-2").addClass("active"),$(".joe_detail__agree .icon").removeClass("active")}else o.push(a),$(".joe_detail__agree .icon-2").removeClass("active"),$(".joe_detail__agree .icon-1").addClass("active"),$(".joe_detail__agree .icon").addClass("active");const i=e("agree"),s=e(JSON.stringify(o));localStorage.setItem(i,s)},complete(){i=!1}})})}$(".joe_comment .joe_pagination a").each((e,t)=>{const a=$(t).attr("href");a&&a.includes("#")&&$(t).attr("href",a.replace("#comments","?scroll=joe_comment"))});{let e=!1;$(".joe_detail__article-protected").on("submit",function(t){t.preventDefault();const o=$(this).attr("action")+"&time="+ +new Date,i=$(this).find('input[type="password"]').val();if(""===i.trim())return Qmsg.info("请输入访问密码!");e||(e=!0,$.ajax({url:o,type:"POST",data:{cid:a,protectPassword:i},dataType:"text",success(t){let a=[],o="";a=$(t).contents(),Array.from(a).forEach(e=>{"container"===e.parentNode.className&&(o=e)}),/Joe/.test(t)?location.reload():(Qmsg.warning(o.textContent.trim()||""),e=!1,$(".joe_comment__respond-form .foot .submit button").html("发表评论"))}}))})}if($(".joe_detail__article-video").length>0){const e=$(".joe_detail__article-video .play iframe").attr("data-player");$(".joe_detail__article-video .episodes .item").on("click",function(){$(this).addClass("active").siblings().removeClass("active");const t=$(this).attr("data-src");$(".joe_detail__article-video .play iframe").attr({src:e+t})}),$(".joe_detail__article-video .episodes .item").first().click()}}),window.addEventListener("load",function(){{const e=new URLSearchParams(location.search).get("scroll");if(e){const t=$(".joe_header").height();let a=null;if(a=$("#"+e).length>0?$("#"+e):$("."+e),a&&a.length>0){const e=a.offset().top-t-15;window.scrollTo({top:e,behavior:"smooth"})}}}});
|
@ -2,7 +2,7 @@
|
|||||||
/* 获取主题当前版本号 */
|
/* 获取主题当前版本号 */
|
||||||
function _getVersion()
|
function _getVersion()
|
||||||
{
|
{
|
||||||
return "6.7.9";
|
return "6.8.0";
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 判断是否是手机 */
|
/* 判断是否是手机 */
|
||||||
|
@ -192,11 +192,11 @@ function _pushRecord($self)
|
|||||||
header("HTTP/1.1 200 OK");
|
header("HTTP/1.1 200 OK");
|
||||||
header('Access-Control-Allow-Origin:*');
|
header('Access-Control-Allow-Origin:*');
|
||||||
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
header("Access-Control-Allow-Headers:Origin, X-Requested-With, Content-Type, Accept");
|
||||||
|
$token = Helper::options()->JBaiduToken;
|
||||||
$domain = $self->request->domain;
|
$domain = $self->request->domain;
|
||||||
$url = $self->request->url;
|
$url = $self->request->url;
|
||||||
$token = Helper::options()->JBaiduToken;
|
|
||||||
$urls = explode(",", $url);
|
$urls = explode(",", $url);
|
||||||
$api = 'http://data.zz.baidu.com/urls?site=' . $domain . '&token=' . $token;
|
$api = "http://data.zz.baidu.com/urls?site={$domain}&token={$token}";
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
$options = array(
|
$options = array(
|
||||||
CURLOPT_URL => $api,
|
CURLOPT_URL => $api,
|
||||||
@ -207,7 +207,12 @@ function _pushRecord($self)
|
|||||||
);
|
);
|
||||||
curl_setopt_array($ch, $options);
|
curl_setopt_array($ch, $options);
|
||||||
$result = curl_exec($ch);
|
$result = curl_exec($ch);
|
||||||
$self->response->throwJson(json_decode($result));
|
curl_close($ch);
|
||||||
|
$self->response->throwJson(array(
|
||||||
|
'domain' => $domain,
|
||||||
|
'url' => $url,
|
||||||
|
'data' => json_decode($result, TRUE)
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 获取壁纸分类 已测试 √ */
|
/* 获取壁纸分类 已测试 √ */
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
||||||
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js'); ?>"></script>
|
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js?v=20210430'); ?>"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<?php $this->need('public/include.php'); ?>
|
<?php $this->need('public/include.php'); ?>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/draggabilly@2.3.0/dist/draggabilly.pkgd.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/draggabilly@2.3.0/dist/draggabilly.pkgd.js"></script>
|
||||||
<script src="<?php $this->options->themeUrl('assets/js/joe.leaving.min.js'); ?>"></script>
|
<script src="<?php $this->options->themeUrl('assets/js/joe.leaving.min.js?v=20210430'); ?>"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "typecho-joe-next",
|
"name": "typecho-joe-next",
|
||||||
"version": "6.7.9",
|
"version": "6.8.0",
|
||||||
"description": "A Theme Of Typecho",
|
"description": "A Theme Of Typecho",
|
||||||
"main": "index.php",
|
"main": "index.php",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
2
page.php
2
page.php
@ -7,7 +7,7 @@
|
|||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
||||||
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js'); ?>"></script>
|
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js?v=20210430'); ?>"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
2
post.php
2
post.php
@ -7,7 +7,7 @@
|
|||||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
|
||||||
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.post.min.css'); ?>">
|
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.post.min.css'); ?>">
|
||||||
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js'); ?>"></script>
|
<script src="<?php $this->options->themeUrl('assets/js/joe.post_page.min.js?v=20210430'); ?>"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
Loading…
Reference in New Issue
Block a user