更新
This commit is contained in:
parent
b86610a133
commit
4190ddca3a
File diff suppressed because one or more lines are too long
@ -1786,6 +1786,8 @@
|
|||||||
.contain {
|
.contain {
|
||||||
position: relative;
|
position: relative;
|
||||||
box-shadow: var(--box-shadow);
|
box-shadow: var(--box-shadow);
|
||||||
|
border-radius: 20px;
|
||||||
|
overflow: hidden;
|
||||||
.icon {
|
.icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 50%;
|
top: 50%;
|
||||||
@ -1793,26 +1795,21 @@
|
|||||||
left: 15px;
|
left: 15px;
|
||||||
}
|
}
|
||||||
.password {
|
.password {
|
||||||
width: 300px;
|
width: 250px;
|
||||||
height: 44px;
|
height: 40px;
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: var(--radius-inner);
|
|
||||||
color: var(--routine);
|
color: var(--routine);
|
||||||
padding-left: 50px;
|
padding-left: 50px;
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
}
|
}
|
||||||
.submit {
|
.submit {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 50%;
|
||||||
right: 0;
|
right: 15px;
|
||||||
height: 44px;
|
transform: translateY(-50%);
|
||||||
line-height: 44px;
|
|
||||||
width: 44px;
|
|
||||||
cursor: pointer;
|
|
||||||
text-align: center;
|
|
||||||
font-size: 13px;
|
|
||||||
color: var(--main);
|
color: var(--main);
|
||||||
user-select: none;
|
border: none;
|
||||||
|
background: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -335,6 +335,7 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
url,
|
url,
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: { author, mail, text, parent },
|
data: { author, mail, text, parent },
|
||||||
|
datatype: 'text',
|
||||||
success(res) {
|
success(res) {
|
||||||
let arr = [],
|
let arr = [],
|
||||||
str = '';
|
str = '';
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
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');
|
||||||
|
|
||||||
/* 获取本篇文章百度收录情况 */
|
/* 获取本篇文章百度收录情况 */
|
||||||
{
|
{
|
||||||
@ -13,12 +13,12 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
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,
|
||||||
@ -30,168 +30,200 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
},
|
},
|
||||||
success(res) {
|
success(res) {
|
||||||
if (res.error) {
|
if (res.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);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活复制功能 */
|
/* 激活复制功能 */
|
||||||
{
|
{
|
||||||
new ClipboardJS('.joe_detail__article-copy').on('success', () => Qmsg.success('复制成功!'))
|
new ClipboardJS('.joe_detail__article-copy').on('success', () => Qmsg.success('复制成功!'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 激活图片预览功能 */
|
/* 激活图片预览功能 */
|
||||||
{
|
{
|
||||||
$('.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',
|
||||||
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',
|
||||||
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'));
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 密码保护文章,输入密码访问 */
|
/* 密码保护文章,输入密码访问 */
|
||||||
{
|
{
|
||||||
$('.joe_detail__article-protected').on('submit', function (e) {})
|
let isSubmit = false;
|
||||||
|
$('.joe_detail__article-protected').on('submit', function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
const url = $(this).attr('action');
|
||||||
|
const protectPassword = $(this).find('input[type="password"]').val();
|
||||||
|
if (protectPassword.trim() === '') return Qmsg.info('请输入访问密码!');
|
||||||
|
if (isSubmit) return;
|
||||||
|
isSubmit = true;
|
||||||
|
$.ajax({
|
||||||
|
url,
|
||||||
|
type: 'POST',
|
||||||
|
data: {
|
||||||
|
cid,
|
||||||
|
protectPassword
|
||||||
|
},
|
||||||
|
datatype: 'text',
|
||||||
|
success(res) {
|
||||||
|
let arr = [],
|
||||||
|
str = '';
|
||||||
|
arr = $(res).contents();
|
||||||
|
Array.from(arr).forEach(_ => {
|
||||||
|
if (_.parentNode.className === 'container') str = _;
|
||||||
|
});
|
||||||
|
if (!/Joe/.test(res)) {
|
||||||
|
Qmsg.warning(str.textContent.trim() || '');
|
||||||
|
isSubmit = false;
|
||||||
|
$('.joe_comment__respond-form .foot .submit button').html('发表评论');
|
||||||
|
} else {
|
||||||
|
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 () {
|
||||||
/* 激活点击回复可见的回复按钮,页面滚动到评论区 */
|
/* 激活点击回复可见的回复按钮,页面滚动到评论区 */
|
||||||
{
|
{
|
||||||
$('.joe_detail__article-hide i').on('click', function () {
|
$('.joe_detail__article-hide i').on('click', function () {
|
||||||
const top = $('.joe_comment').offset().top - $('.joe_header').height() - 15
|
const top = $('.joe_comment').offset().top - $('.joe_header').height() - 15;
|
||||||
window.scrollTo({ top, behavior: 'smooth' })
|
window.scrollTo({ top, behavior: 'smooth' });
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
/* 判断地址栏是否有锚点链接,有则跳转到对应位置 */
|
/* 判断地址栏是否有锚点链接,有则跳转到对应位置 */
|
||||||
{
|
{
|
||||||
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' });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
/* 获取主题当前版本号 */
|
/* 获取主题当前版本号 */
|
||||||
function _getVersion()
|
function _getVersion()
|
||||||
{
|
{
|
||||||
return "5.4.4";
|
return "5.4.5";
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 判断是否是手机 */
|
/* 判断是否是手机 */
|
||||||
|
Loading…
Reference in New Issue
Block a user