This commit is contained in:
杜恒 2021-02-19 15:08:07 +08:00
parent 072a2f6faa
commit 81b8d46129
20 changed files with 3988 additions and 3432 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,16 @@
/* 搜索页面需要用到的JS */ /* 搜索页面需要用到的JS */
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', function () {
/* 激活列表特效 */ /* 激活列表特效 */
{ {
const wow = $('.joe_archive__list').attr('data-wow') var wow = $('.joe_archive__list').attr('data-wow');
if (wow !== 'off' && wow) if (wow !== 'off' && wow)
new WOW({ new WOW({
boxClass: 'wow', boxClass: 'wow',
animateClass: `animated ${wow}`, animateClass: 'animated '.concat(wow),
offset: 0, offset: 0,
mobile: true, mobile: true,
live: true, live: true,
scrollContainer: null scrollContainer: null
}).init() }).init();
} }
}) });

View File

@ -1,140 +1,140 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
/* 公共修改地址栏URL函数 */ /* 公共修改地址栏URL函数 */
const changeURLArg = (url, arg, arg_val) => { const changeURLArg = (url, arg, arg_val) => {
let pattern = arg + '=([^&]*)' let pattern = arg + '=([^&]*)';
let replaceText = arg + '=' + arg_val let replaceText = arg + '=' + arg_val;
if (url.match(pattern)) { if (url.match(pattern)) {
let tmp = '/(' + arg + '=)([^&]*)/gi' let tmp = '/(' + arg + '=)([^&]*)/gi';
return url.replace(eval(tmp), replaceText) return url.replace(eval(tmp), replaceText);
} else { } else {
if (url.match('[?]')) { if (url.match('[?]')) {
return url + '&' + replaceText return url + '&' + replaceText;
} else { } else {
return url + '?' + replaceText return url + '?' + replaceText;
} }
} }
return url + '\n' + arg + '\n' + arg_val return url + '\n' + arg + '\n' + arg_val;
} };
/* 初始化昼夜模式 */ /* 初始化昼夜模式 */
{ {
if (localStorage.getItem('data-night')) { if (localStorage.getItem('data-night')) {
$('.joe_action_item.mode .icon-1').addClass('active') $('.joe_action_item.mode .icon-1').addClass('active');
$('.joe_action_item.mode .icon-2').removeClass('active') $('.joe_action_item.mode .icon-2').removeClass('active');
} else { } else {
$('html').removeAttr('data-night') $('html').removeAttr('data-night');
$('.joe_action_item.mode .icon-1').removeClass('active') $('.joe_action_item.mode .icon-1').removeClass('active');
$('.joe_action_item.mode .icon-2').addClass('active') $('.joe_action_item.mode .icon-2').addClass('active');
} }
$('.joe_action_item.mode').on('click', () => { $('.joe_action_item.mode').on('click', () => {
if (localStorage.getItem('data-night')) { if (localStorage.getItem('data-night')) {
$('.joe_action_item.mode .icon-1').removeClass('active') $('.joe_action_item.mode .icon-1').removeClass('active');
$('.joe_action_item.mode .icon-2').addClass('active') $('.joe_action_item.mode .icon-2').addClass('active');
$('html').removeAttr('data-night') $('html').removeAttr('data-night');
localStorage.removeItem('data-night') localStorage.removeItem('data-night');
} else { } else {
$('.joe_action_item.mode .icon-1').addClass('active') $('.joe_action_item.mode .icon-1').addClass('active');
$('.joe_action_item.mode .icon-2').removeClass('active') $('.joe_action_item.mode .icon-2').removeClass('active');
$('html').attr('data-night', 'night') $('html').attr('data-night', 'night');
localStorage.setItem('data-night', 'night') localStorage.setItem('data-night', 'night');
} }
}) });
} }
/* 动态背景 */ /* 动态背景 */
{ {
if (!Joe.IS_MOBILE && Joe.DYNAMIC_BACKGROUND !== 'off' && Joe.DYNAMIC_BACKGROUND && !Joe.WALLPAPER_BACKGROUND_PC) { if (!Joe.IS_MOBILE && Joe.DYNAMIC_BACKGROUND !== 'off' && Joe.DYNAMIC_BACKGROUND && !Joe.WALLPAPER_BACKGROUND_PC) {
$.getScript(`https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/backdrop/${Joe.DYNAMIC_BACKGROUND}`) $.getScript(`https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/assets/backdrop/${Joe.DYNAMIC_BACKGROUND}`);
} }
} }
/* 搜索框弹窗 */ /* 搜索框弹窗 */
{ {
$('.joe_header__above-search .input').on('click', e => { $('.joe_header__above-search .input').on('click', e => {
e.stopPropagation() e.stopPropagation();
$('.joe_header__above-search .result').addClass('active') $('.joe_header__above-search .result').addClass('active');
}) });
$(document).on('click', function () { $(document).on('click', function () {
$('.joe_header__above-search .result').removeClass('active') $('.joe_header__above-search .result').removeClass('active');
}) });
$(document).on('scroll', function () { $(document).on('scroll', function () {
$('.joe_header__above-search .result').removeClass('active') $('.joe_header__above-search .result').removeClass('active');
}) });
} }
/* 激活全局下拉框功能 */ /* 激活全局下拉框功能 */
{ {
$('.joe_dropdown').each(function (index, item) { $('.joe_dropdown').each(function (index, item) {
const menu = $(this).find('.joe_dropdown__menu') const menu = $(this).find('.joe_dropdown__menu');
const trigger = $(item).attr('trigger') || 'click' const trigger = $(item).attr('trigger') || 'click';
const placement = $(item).attr('placement') || $(this).height() || 0 const placement = $(item).attr('placement') || $(this).height() || 0;
menu.css('top', placement) menu.css('top', placement);
if (trigger === 'hover') { if (trigger === 'hover') {
$(this).hover( $(this).hover(
() => $(this).addClass('active'), () => $(this).addClass('active'),
() => $(this).removeClass('active') () => $(this).removeClass('active')
) );
} else { } else {
$(this).on('click', function (e) { $(this).on('click', function (e) {
$(this).toggleClass('active') $(this).toggleClass('active');
$(document).one('click', () => $(this).removeClass('active')) $(document).one('click', () => $(this).removeClass('active'));
e.stopPropagation() e.stopPropagation();
}) });
menu.on('click', e => e.stopPropagation()) menu.on('click', e => e.stopPropagation());
} }
}) });
} }
/* 激活全局返回顶部功能 */ /* 激活全局返回顶部功能 */
{ {
const handleScroll = () => ((document.documentElement.scrollTop || document.body.scrollTop) > 300 ? $('.joe_action_item.scroll').addClass('active') : $('.joe_action_item.scroll').removeClass('active')) const handleScroll = () => ((document.documentElement.scrollTop || document.body.scrollTop) > 300 ? $('.joe_action_item.scroll').addClass('active') : $('.joe_action_item.scroll').removeClass('active'));
handleScroll() handleScroll();
$(window).on('scroll', () => handleScroll()) $(window).on('scroll', () => handleScroll());
$('.joe_action_item.scroll').on('click', () => window.scrollTo({ top: 0, behavior: 'smooth' })) $('.joe_action_item.scroll').on('click', () => window.scrollTo({ top: 0, behavior: 'smooth' }));
} }
/* 激活侧边栏人生倒计时功能 */ /* 激活侧边栏人生倒计时功能 */
{ {
if ($('.joe_aside__item.timelife').length !== 0) { if ($('.joe_aside__item.timelife').length !== 0) {
let timelife = [ let timelife = [
{ title: '今日已经过去', endTitle: '小时', num: 0, percent: '0%' }, { title: '今日已经过去', endTitle: '小时', num: 0, percent: '0%' },
{ title: '这周已经过去', endTitle: '天', num: 0, percent: '0%' }, { title: '这周已经过去', endTitle: '天', num: 0, percent: '0%' },
{ title: '本月已经过去', endTitle: '天', num: 0, percent: '0%' }, { title: '本月已经过去', endTitle: '天', num: 0, percent: '0%' },
{ title: '今年已经过去', endTitle: '个月', num: 0, percent: '0%' } { title: '今年已经过去', endTitle: '个月', num: 0, percent: '0%' }
] ];
{ {
let nowDate = +new Date() let nowDate = +new Date();
let todayStartDate = new Date(new Date().toLocaleDateString()).getTime() let todayStartDate = new Date(new Date().toLocaleDateString()).getTime();
let todayPassHours = (nowDate - todayStartDate) / 1000 / 60 / 60 let todayPassHours = (nowDate - todayStartDate) / 1000 / 60 / 60;
let todayPassHoursPercent = (todayPassHours / 24) * 100 let todayPassHoursPercent = (todayPassHours / 24) * 100;
timelife[0].num = parseInt(todayPassHours) timelife[0].num = parseInt(todayPassHours);
timelife[0].percent = parseInt(todayPassHoursPercent) + '%' timelife[0].percent = parseInt(todayPassHoursPercent) + '%';
} }
{ {
let weeks = { 0: 7, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6 } let weeks = { 0: 7, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6 };
let weekDay = weeks[new Date().getDay()] let weekDay = weeks[new Date().getDay()];
let weekDayPassPercent = (weekDay / 7) * 100 let weekDayPassPercent = (weekDay / 7) * 100;
timelife[1].num = parseInt(weekDay) timelife[1].num = parseInt(weekDay);
timelife[1].percent = parseInt(weekDayPassPercent) + '%' timelife[1].percent = parseInt(weekDayPassPercent) + '%';
} }
{ {
let year = new Date().getFullYear() let year = new Date().getFullYear();
let date = new Date().getDate() let date = new Date().getDate();
let month = new Date().getMonth() + 1 let month = new Date().getMonth() + 1;
let monthAll = new Date(year, month, 0).getDate() let monthAll = new Date(year, month, 0).getDate();
let monthPassPercent = (date / monthAll) * 100 let monthPassPercent = (date / monthAll) * 100;
timelife[2].num = date timelife[2].num = date;
timelife[2].percent = parseInt(monthPassPercent) + '%' timelife[2].percent = parseInt(monthPassPercent) + '%';
} }
{ {
let month = new Date().getMonth() + 1 let month = new Date().getMonth() + 1;
let yearPass = (month / 12) * 100 let yearPass = (month / 12) * 100;
timelife[3].num = month timelife[3].num = month;
timelife[3].percent = parseInt(yearPass) + '%' timelife[3].percent = parseInt(yearPass) + '%';
} }
let htmlStr = '' let htmlStr = '';
timelife.forEach((item, index) => { timelife.forEach((item, index) => {
htmlStr += ` htmlStr += `
<div class="item"> <div class="item">
<div class="title"> <div class="title">
${item.title} ${item.title}
@ -147,309 +147,316 @@ document.addEventListener('DOMContentLoaded', () => {
</div> </div>
<div class="progress-percentage">${item.percent}</div> <div class="progress-percentage">${item.percent}</div>
</div> </div>
</div>` </div>`;
}) });
$('.joe_aside__item.timelife .joe_aside__item-contain').html(htmlStr) $('.joe_aside__item.timelife .joe_aside__item-contain').html(htmlStr);
} }
} }
/* 激活侧边栏天气功能 */ /* 激活侧边栏天气功能 */
{ {
if ($('.joe_aside__item.weather').length !== 0) { if ($('.joe_aside__item.weather').length !== 0) {
const key = $('.joe_aside__item.weather').attr('data-key') const key = $('.joe_aside__item.weather').attr('data-key');
const style = $('.joe_aside__item.weather').attr('data-style') const style = $('.joe_aside__item.weather').attr('data-style');
const aqiColor = { 1: 'FFFFFF', 2: '4A4A4A', 3: 'FFFFFF' } const aqiColor = { 1: 'FFFFFF', 2: '4A4A4A', 3: 'FFFFFF' };
window.WIDGET = { CONFIG: { layout: 2, width: '220', height: '270', background: style, dataColor: aqiColor[style], language: 'zh', key: key } } window.WIDGET = { CONFIG: { layout: 2, width: '220', height: '270', background: style, dataColor: aqiColor[style], language: 'zh', key: key } };
} }
} }
/* 激活侧边栏排行榜功能 */ /* 激活侧边栏排行榜功能 */
{ {
if ($('.joe_aside__item.ranking').length !== 0) { if ($('.joe_aside__item.ranking').length !== 0) {
$.ajax({ $.ajax({
url: Joe.BASE_API, url: Joe.BASE_API,
type: 'POST', type: 'POST',
data: { routeType: 'aside_ranking' }, data: { routeType: 'aside_ranking' },
success(res) { success(res) {
$('.joe_aside__item.ranking .joe_aside__item-title .text').html(res.title) $('.joe_aside__item.ranking .joe_aside__item-title .text').html(res.title);
let htmlStr = '' let htmlStr = '';
if (res.code === 1) { if (res.code === 1) {
res.data.forEach((item, index) => { res.data.forEach((item, index) => {
htmlStr += ` htmlStr += `
<li class="item"> <li class="item">
<span class="sort">${index + 1}</span> <span class="sort">${index + 1}</span>
<a class="link" href="${item.url}" title="${item.title}" target="_blank" rel="noopener noreferrer nofollow">${item.title}</a> <a class="link" href="${item.url}" title="${item.title}" target="_blank" rel="noopener noreferrer nofollow">${item.title}</a>
</li> </li>
` `;
}) });
} else { } else {
htmlStr += `<li class="error">数据抓取异常!</li>` htmlStr += `<li class="error">数据抓取异常!</li>`;
} }
$('.joe_aside__item.ranking .joe_aside__item-contain').html(htmlStr) $('.joe_aside__item.ranking .joe_aside__item-contain').html(htmlStr);
} }
}) });
} }
} }
/* 设置侧边栏最后一个元素的高度 */ /* 设置侧边栏最后一个元素的高度 */
{ {
$('.joe_aside__item:last-child').css('top', $('.joe_header').height() + 15) $('.joe_aside__item:last-child').css('top', $('.joe_header').height() + 15);
} }
/* 激活Live2d人物 */ /* 激活Live2d人物 */
{ {
if (Joe.LIVE2D !== 'off' && Joe.LIVE2D) { if (Joe.LIVE2D !== 'off' && Joe.LIVE2D) {
$.getScript('https://cdn.jsdelivr.net/npm/live2d-widget@3.1.4/lib/L2Dwidget.min.js', () => { $.getScript('https://cdn.jsdelivr.net/npm/live2d-widget@3.1.4/lib/L2Dwidget.min.js', () => {
L2Dwidget.init({ L2Dwidget.init({
model: { jsonPath: Joe.LIVE2D, scale: 1 }, model: { jsonPath: Joe.LIVE2D, scale: 1 },
mobile: { show: false }, mobile: { show: false },
display: { position: 'right', width: 160, height: 200, hOffset: 70, vOffset: 0 } display: { position: 'right', width: 160, height: 200, hOffset: 70, vOffset: 0 }
}) });
}) });
} }
} }
/* 计算页面滚动多少 */ /* 计算页面滚动多少 */
{ {
const calcProgress = () => { const calcProgress = () => {
let scrollTop = $(window).scrollTop() let scrollTop = $(window).scrollTop();
let documentHeight = $(document).height() let documentHeight = $(document).height();
let windowHeight = $(window).height() let windowHeight = $(window).height();
let progress = parseInt((scrollTop / (documentHeight - windowHeight)) * 100) let progress = parseInt((scrollTop / (documentHeight - windowHeight)) * 100);
if (progress <= 0) progress = 0 if (progress <= 0) progress = 0;
if (progress >= 100) progress = 100 if (progress >= 100) progress = 100;
$('.joe_header__below-progress').css('width', progress + '%') $('.joe_header__below-progress').css('width', progress + '%');
} };
calcProgress() calcProgress();
$(window).on('scroll', () => calcProgress()) $(window).on('scroll', () => calcProgress());
} }
/* 判断页面上是否有侧边栏 */ /* 判断页面上是否有侧边栏 */
{ {
const getAside = () => { const getAside = () => {
if ($('.joe_aside').length === 0) { if ($('.joe_aside').length === 0) {
$('body').addClass('noaside') $('body').addClass('noaside');
} else { } else {
$('body').removeClass('noaside') $('body').removeClass('noaside');
} }
} };
getAside() getAside();
$(window).on('resize', () => getAside()) $(window).on('resize', () => getAside());
} }
/* 评论框点击切换画图模式和文本模式 */ /* 评论框点击切换画图模式和文本模式 */
{ {
$('.joe_comment__respond-type .item').on('click', function () { $('.joe_comment__respond-type .item').on('click', function () {
$(this).addClass('active').siblings().removeClass('active') $(this).addClass('active').siblings().removeClass('active');
if ($(this).attr('data-type') === 'draw') { if ($(this).attr('data-type') === 'draw') {
$('.joe_comment__respond-form .body .draw').show().siblings().hide() $('.joe_comment__respond-form .body .draw').show().siblings().hide();
$('#joe_comment_draw').prop('width', $('.joe_comment__respond-form .body').width()) $('#joe_comment_draw').prop('width', $('.joe_comment__respond-form .body').width());
/* 设置表单格式为画图模式 */ /* 设置表单格式为画图模式 */
$('.joe_comment__respond-form').attr('data-type', 'draw') $('.joe_comment__respond-form').attr('data-type', 'draw');
} else { } else {
$('.joe_comment__respond-form .body .text').show().siblings().hide() $('.joe_comment__respond-form .body .text').show().siblings().hide();
/* 设置表单格式为文字模式 */ /* 设置表单格式为文字模式 */
$('.joe_comment__respond-form').attr('data-type', 'text') $('.joe_comment__respond-form').attr('data-type', 'text');
} }
}) });
} }
/* 激活画图功能 */ /* 激活画图功能 */
{ {
if ($('#joe_comment_draw').length !== 0) { if ($('#joe_comment_draw').length !== 0) {
/* 激活画板 */ /* 激活画板 */
window.sketchpad = new Sketchpad({ element: '#joe_comment_draw', height: 300, penSize: 5, color: '303133' }) window.sketchpad = new Sketchpad({ element: '#joe_comment_draw', height: 300, penSize: 5, color: '303133' });
/* 撤销上一步 */ /* 撤销上一步 */
$('.joe_comment__respond-form .body .draw .icon-undo').on('click', () => window.sketchpad.undo()) $('.joe_comment__respond-form .body .draw .icon-undo').on('click', () => window.sketchpad.undo());
/* 动画预览 */ /* 动画预览 */
$('.joe_comment__respond-form .body .draw .icon-animate').on('click', () => window.sketchpad.animate(10)) $('.joe_comment__respond-form .body .draw .icon-animate').on('click', () => window.sketchpad.animate(10));
/* 更改画板的线宽 */ /* 更改画板的线宽 */
$('.joe_comment__respond-form .body .draw .line li').on('click', function () { $('.joe_comment__respond-form .body .draw .line li').on('click', function () {
window.sketchpad.penSize = $(this).attr('data-line') window.sketchpad.penSize = $(this).attr('data-line');
$(this).addClass('active').siblings().removeClass('active') $(this).addClass('active').siblings().removeClass('active');
}) });
/* 更改画板的颜色 */ /* 更改画板的颜色 */
$('.joe_comment__respond-form .body .draw .color li').on('click', function () { $('.joe_comment__respond-form .body .draw .color li').on('click', function () {
window.sketchpad.color = $(this).attr('data-color') window.sketchpad.color = $(this).attr('data-color');
$(this).addClass('active').siblings().removeClass('active') $(this).addClass('active').siblings().removeClass('active');
}) });
} }
} }
/* 重写评论功能 */ /* 重写评论功能 */
{ {
const respond = $('.joe_comment__respond') const respond = $('.joe_comment__respond');
/* 重写回复功能 */ /* 重写回复功能 */
$('.joe_comment__reply').on('click', function () { $('.joe_comment__reply').on('click', function () {
/* 父级ID */ /* 父级ID */
const coid = $(this).attr('data-coid') const coid = $(this).attr('data-coid');
/* 当前的项 */ /* 当前的项 */
const item = $('#' + $(this).attr('data-id')) const item = $('#' + $(this).attr('data-id'));
/* 添加自定义属性表示父级ID */ /* 添加自定义属性表示父级ID */
respond.find('.joe_comment__respond-form').attr('data-coid', coid) respond.find('.joe_comment__respond-form').attr('data-coid', coid);
item.append(respond) item.append(respond);
$(".joe_comment__respond-type .item[data-type='text']").click() $(".joe_comment__respond-type .item[data-type='text']").click();
$('.joe_comment__cancle').show() $('.joe_comment__cancle').show();
window.scrollTo({ window.scrollTo({
top: item.offset().top - $('.joe_header').height() - 15, top: item.offset().top - $('.joe_header').height() - 15,
behavior: 'smooth' behavior: 'smooth'
}) });
}) });
/* 重写取消回复功能 */ /* 重写取消回复功能 */
$('.joe_comment__cancle').on('click', function () { $('.joe_comment__cancle').on('click', function () {
/* 移除自定义属性父级ID */ /* 移除自定义属性父级ID */
respond.find('.joe_comment__respond-form').removeAttr('data-coid') respond.find('.joe_comment__respond-form').removeAttr('data-coid');
$('.joe_comment__cancle').hide() $('.joe_comment__cancle').hide();
$('.joe_comment__title').after(respond) $('.joe_comment__title').after(respond);
$(".joe_comment__respond-type .item[data-type='text']").click() $(".joe_comment__respond-type .item[data-type='text']").click();
window.scrollTo({ window.scrollTo({
top: $('.joe_comment').offset().top - $('.joe_header').height() - 15, top: $('.joe_comment').offset().top - $('.joe_header').height() - 15,
behavior: 'smooth' behavior: 'smooth'
}) });
}) });
} }
/* 激活评论提交 */ /* 激活评论提交 */
{ {
let isSubmit = false let isSubmit = false;
$('.joe_comment__respond-form').on('submit', function (e) { $('.joe_comment__respond-form').on('submit', function (e) {
e.preventDefault() e.preventDefault();
const url = $('.joe_comment__respond-form').attr('action') const url = $('.joe_comment__respond-form').attr('action');
const type = $('.joe_comment__respond-form').attr('data-type') const type = $('.joe_comment__respond-form').attr('data-type');
const parent = $('.joe_comment__respond-form').attr('data-coid') const parent = $('.joe_comment__respond-form').attr('data-coid');
const author = $(".joe_comment__respond-form .head input[name='author']").val() const author = $(".joe_comment__respond-form .head input[name='author']").val();
const mail = $(".joe_comment__respond-form .head input[name='mail']").val() const mail = $(".joe_comment__respond-form .head input[name='mail']").val();
let text = $(".joe_comment__respond-form .body textarea[name='text']").val() let text = $(".joe_comment__respond-form .body textarea[name='text']").val();
if (author.trim() === '') return Qmsg.info('请输入昵称!') if (author.trim() === '') return Qmsg.info('请输入昵称!');
if (!/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(mail)) return Qmsg.info('请输入正确的邮箱!') if (!/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/.test(mail)) return Qmsg.info('请输入正确的邮箱!');
if (type === 'text' && text.trim() === '') return Qmsg.info('请输入评论内容!') if (type === 'text' && text.trim() === '') return Qmsg.info('请输入评论内容!');
if (type === 'draw') { if (type === 'draw') {
const txt = $('#joe_comment_draw')[0].toDataURL('image/webp', 0.1) const txt = $('#joe_comment_draw')[0].toDataURL('image/webp', 0.1);
text = '{!{' + txt + '}!} ' text = '{!{' + txt + '}!} ';
} }
if (isSubmit) return if (isSubmit) return;
isSubmit = true isSubmit = true;
$.ajax({ $.ajax({
url, url,
type: 'POST', type: 'POST',
data: { author, mail, text, parent }, data: { author, mail, text, parent },
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;
} else { } else {
window.location.href = changeURLArg(location.href, 'scroll', 'joe_comment') window.location.href = changeURLArg(location.href, 'scroll', 'joe_comment');
} }
} }
}) });
}) });
} }
/* 切换标签显示不同的标题 */ /* 切换标签显示不同的标题 */
{ {
if (Joe.DOCUMENT_TITLE) { if (Joe.DOCUMENT_TITLE) {
const TITLE = document.title const TITLE = document.title;
document.addEventListener('visibilitychange', () => { document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'hidden') { if (document.visibilityState === 'hidden') {
document.title = Joe.DOCUMENT_TITLE document.title = Joe.DOCUMENT_TITLE;
} else { } else {
document.title = TITLE document.title = TITLE;
} }
}) });
} }
} }
/* 小屏幕伸缩侧边栏 */ /* 小屏幕伸缩侧边栏 */
{ {
$('.joe_header__above-slideicon').on('click', function () { $('.joe_header__above-slideicon').on('click', function () {
/* 关闭搜索框 */ /* 关闭搜索框 */
$('.joe_header__searchout').removeClass('active') $('.joe_header__searchout').removeClass('active');
/* 处理开启关闭状态 */ /* 处理开启关闭状态 */
if ($('.joe_header__slideout').hasClass('active')) { if ($('.joe_header__slideout').hasClass('active')) {
$('body').css('overflow', '') $('body').css('overflow', '');
$('.joe_header__mask').removeClass('active slideout') $('.joe_header__mask').removeClass('active slideout');
$('.joe_header__slideout').removeClass('active') $('.joe_header__slideout').removeClass('active');
} else { } else {
$('body').css('overflow', 'hidden') $('body').css('overflow', 'hidden');
$('.joe_header__mask').addClass('active slideout') $('.joe_header__mask').addClass('active slideout');
$('.joe_header__slideout').addClass('active') $('.joe_header__slideout').addClass('active');
} }
}) });
} }
/* 小屏幕搜索框 */ /* 小屏幕搜索框 */
{ {
$('.joe_header__above-searchicon').on('click', function () { $('.joe_header__above-searchicon').on('click', function () {
/* 关闭侧边栏 */ /* 关闭侧边栏 */
$('.joe_header__slideout').removeClass('active') $('.joe_header__slideout').removeClass('active');
/* 处理开启关闭状态 */ /* 处理开启关闭状态 */
if ($('.joe_header__searchout').hasClass('active')) { if ($('.joe_header__searchout').hasClass('active')) {
$('body').css('overflow', '') $('body').css('overflow', '');
$('.joe_header__mask').removeClass('active slideout') $('.joe_header__mask').removeClass('active slideout');
$('.joe_header__searchout').removeClass('active') $('.joe_header__searchout').removeClass('active');
} else { } else {
$('body').css('overflow', 'hidden') $('body').css('overflow', 'hidden');
$('.joe_header__mask').addClass('active') $('.joe_header__mask').addClass('active');
$('.joe_header__searchout').addClass('active') $('.joe_header__searchout').addClass('active');
} }
}) });
} }
/* 点击遮罩层关闭 */ /* 点击遮罩层关闭 */
{ {
$('.joe_header__mask').on('click', function () { $('.joe_header__mask').on('click', function () {
$('body').css('overflow', '') $('body').css('overflow', '');
$('.joe_header__mask').removeClass('active slideout') $('.joe_header__mask').removeClass('active slideout');
$('.joe_header__searchout').removeClass('active') $('.joe_header__searchout').removeClass('active');
$('.joe_header__slideout').removeClass('active') $('.joe_header__slideout').removeClass('active');
}) });
} }
/* 移动端侧边栏菜单手风琴 */ /* 移动端侧边栏菜单手风琴 */
{ {
$('.joe_header__slideout-menu .current').parents('.panel-body').show().siblings('.panel').addClass('in') $('.joe_header__slideout-menu .current').parents('.panel-body').show().siblings('.panel').addClass('in');
$('.joe_header__slideout-menu .panel').on('click', function () { $('.joe_header__slideout-menu .panel').on('click', function () {
const panelBox = $(this).parent().parent() const panelBox = $(this).parent().parent();
/* 清除全部内容 */ /* 清除全部内容 */
panelBox.find('.panel').not($(this)).removeClass('in') panelBox.find('.panel').not($(this)).removeClass('in');
panelBox.find('.panel-body').not($(this).siblings('.panel-body')).stop().hide('fast') panelBox.find('.panel-body').not($(this).siblings('.panel-body')).stop().hide('fast');
/* 激活当前的内容 */ /* 激活当前的内容 */
$(this).toggleClass('in').siblings('.panel-body').stop().toggle('fast') $(this).toggleClass('in').siblings('.panel-body').stop().toggle('fast');
}) });
} }
/* 初始化网站运行时间 */ /* 初始化网站运行时间 */
{ {
const getRunTime = () => { const getRunTime = () => {
const birthDay = new Date(Joe.BIRTHDAY) const birthDay = new Date(Joe.BIRTHDAY);
const today = +new Date() const today = +new Date();
const timePast = today - birthDay.getTime() const timePast = today - birthDay.getTime();
let day = timePast / (1000 * 24 * 60 * 60) let day = timePast / (1000 * 24 * 60 * 60);
let dayPast = Math.floor(day) let dayPast = Math.floor(day);
let hour = (day - dayPast) * 24 let hour = (day - dayPast) * 24;
let hourPast = Math.floor(hour) let hourPast = Math.floor(hour);
let minute = (hour - hourPast) * 60 let minute = (hour - hourPast) * 60;
let minutePast = Math.floor(minute) let minutePast = Math.floor(minute);
let second = (minute - minutePast) * 60 let second = (minute - minutePast) * 60;
let secondPast = Math.floor(second) let secondPast = Math.floor(second);
day = String(dayPast).padStart(2, 0) day = String(dayPast).padStart(2, 0);
hour = String(hourPast).padStart(2, 0) hour = String(hourPast).padStart(2, 0);
minute = String(minutePast).padStart(2, 0) minute = String(minutePast).padStart(2, 0);
second = String(secondPast).padStart(2, 0) second = String(secondPast).padStart(2, 0);
$('.joe_run__day').html(day) $('.joe_run__day').html(day);
$('.joe_run__hour').html(hour) $('.joe_run__hour').html(hour);
$('.joe_run__minute').html(minute) $('.joe_run__minute').html(minute);
$('.joe_run__second').html(second) $('.joe_run__second').html(second);
} };
if (Joe.BIRTHDAY && /(\d{4})\/(\d{1,2})\/(\d{1,2}) (\d{1,2})\:(\d{1,2})\:(\d{1,2})/.test(Joe.BIRTHDAY)) { if (Joe.BIRTHDAY && /(\d{4})\/(\d{1,2})\/(\d{1,2}) (\d{1,2})\:(\d{1,2})\:(\d{1,2})/.test(Joe.BIRTHDAY)) {
getRunTime() getRunTime();
setInterval(getRunTime, 1000) setInterval(getRunTime, 1000);
} }
} }
})
/* 初始化表情功能 */
{
if ($('.joe_owo__contain').length > 0 && $('.joe_owo__target').length > 0) {
new JoeOwO();
}
}
});

84
assets/js/joe.owo.js Normal file
View File

@ -0,0 +1,84 @@
class JoeOwO {
constructor(options) {
const defaultOption = {
contain: '.joe_owo__contain',
target: '.joe_owo__target',
seat: 'OωO',
api: '/usr/themes/Joe/assets/json/joe.owo.json'
};
this.options = Object.assign(defaultOption, options);
$.ajax({
url: this.options.api,
type: 'get',
dataType: 'json',
success: res => this.initHtml(res)
});
}
/* 初始化 */
initHtml(res) {
let barStr = '';
let scrollStr = '';
for (let key in res) {
barStr += `<div class="item" data-index="${res[key].index}">${key}</div>`;
scrollStr += `
<ul class="scroll" data-index="${res[key].index}">
${res[key].container.map(_ => `<li class="item" data-text="${_.data}">${_.icon}</li>`).join('')}
</ul>
`;
}
$(this.options.contain).html(`
<div class="seat">${this.options.seat}</div>
<div class="box">
${scrollStr}
<div class="bar">${barStr}</div>
</div>
`);
this.initEvent();
}
initEvent() {
/* 容器 */
const contain = this.options.contain;
const height = $(contain).height();
/* 点击页面关闭 */
$(document).on('click', function () {
$(contain + ' .box').removeClass('show');
});
/* 点击占位符,显示表情弹窗 */
const seat = contain + ' .seat';
$(seat).on('click', function (e) {
e.stopPropagation();
$(this).siblings('.box').css('top', height).toggleClass('show');
});
/* 点击tab栏切换表情类型 */
const barItem = contain + ' .box .bar .item';
$(barItem).on('click', function (e) {
e.stopPropagation();
$(this).addClass('active').siblings().removeClass('active');
const scrollIndx = contain + ' .box .scroll[data-index="' + $(this).attr('data-index') + '"]';
$(scrollIndx).show().siblings('.scroll').hide();
});
/* 点击表情,向文本框插入内容 */
const items = contain + ' .scroll .item';
const textarea = $(this.options.target)[0];
$(items).on('click', function () {
const text = $(this).attr('data-text');
const cursorPos = textarea.selectionEnd;
const areaValue = textarea.value;
textarea.value = areaValue.slice(0, cursorPos) + text + areaValue.slice(cursorPos);
textarea.focus();
});
/* 默认激活第一个 */
$(barItem).first().click();
}
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = JoeOwO;
} else {
window.JoeOwO = JoeOwO;
}

258
assets/json/joe.owo.json Normal file
View File

@ -0,0 +1,258 @@
{
"泡泡": {
"type": "image",
"index": "0",
"container": [
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E591B5E591B5_2x.png\">", "data": "::(呵呵)", "text": "呵呵" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E59388E59388_2x.png\">", "data": "::(哈哈)", "text": "哈哈" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E59090E8888C_2x.png\">", "data": "::(吐舌)", "text": "吐舌" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5A4AAE5BC80E5BF83_2x.png\">", "data": "::(太开心)", "text": "太开心" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E7AC91E79CBC_2x.png\">", "data": "::(笑眼)", "text": "笑眼" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E88AB1E5BF83_2x.png\">", "data": "::(花心)", "text": "花心" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5B08FE4B996_2x.png\">", "data": "::(小乖)", "text": "小乖" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E4B996_2x.png\">", "data": "::(乖)", "text": "乖" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E68D82E598B4E7AC91_2x.png\">", "data": "::(捂嘴笑)", "text": "捂嘴笑" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6BB91E7A8BD_2x.png\">", "data": "::(滑稽)", "text": "滑稽" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E4BDA0E68782E79A84_2x.png\">", "data": "::(你懂的)", "text": "你懂的" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E4B88DE9AB98E585B4_2x.png\">", "data": "::(不高兴)", "text": "不高兴" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E68092_2x.png\">", "data": "::(怒)", "text": "怒" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6B197_2x.png\">", "data": "::(汗)", "text": "汗" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E9BB91E7BABF_2x.png\">", "data": "::(黑线)", "text": "黑线" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6B3AA_2x.png\">", "data": "::(泪)", "text": "泪" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E79C9FE6A392_2x.png\">", "data": "::(真棒)", "text": "真棒" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E596B7_2x.png\">", "data": "::(喷)", "text": "喷" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6838AE593AD_2x.png\">", "data": "::(惊哭)", "text": "惊哭" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E998B4E999A9_2x.png\">", "data": "::(阴险)", "text": "阴险" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E98499E8A786_2x.png\">", "data": "::(鄙视)", "text": "鄙视" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E985B7_2x.png\">", "data": "::(酷)", "text": "酷" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5958A_2x.png\">", "data": "::(啊)", "text": "啊" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E78B82E6B197_2x.png\">", "data": "::(狂汗)", "text": "狂汗" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/what_2x.png\">", "data": "::(what)", "text": "what" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E79691E997AE_2x.png\">", "data": "::(疑问)", "text": "疑问" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E985B8E788BD_2x.png\">", "data": "::(酸爽)", "text": "酸爽" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E59180E592A9E788B9_2x.png\">", "data": "::(呀咩爹)", "text": "呀咩爹" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5A794E5B188_2x.png\">", "data": "::(委屈)", "text": "委屈" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6838AE8AEB6_2x.png\">", "data": "::(惊讶)", "text": "惊讶" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E79DA1E8A789_2x.png\">", "data": "::(睡觉)", "text": "睡觉" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E7AC91E5B0BF_2x.png\">", "data": "::(笑尿)", "text": "笑尿" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E68C96E9BCBB_2x.png\">", "data": "::(挖鼻)", "text": "挖鼻" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E59090_2x.png\">", "data": "::(吐)", "text": "吐" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E78A80E588A9_2x.png\">", "data": "::(犀利)", "text": "犀利" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5B08FE7BAA2E884B8_2x.png\">", "data": "::(小红脸)", "text": "小红脸" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E68792E5BE97E79086_2x.png\">", "data": "::(懒得理)", "text": "懒得理" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E58B89E5BCBA_2x.png\">", "data": "::(勉强)", "text": "勉强" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E788B1E5BF83_2x.png\">", "data": "::(爱心)", "text": "爱心" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5BF83E7A28E_2x.png\">", "data": "::(心碎)", "text": "心碎" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E78EABE791B0_2x.png\">", "data": "::(玫瑰)", "text": "玫瑰" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E7A4BCE789A9_2x.png\">", "data": "::(礼物)", "text": "礼物" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5BDA9E899B9_2x.png\">", "data": "::(彩虹)", "text": "彩虹" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5A4AAE998B3_2x.png\">", "data": "::(太阳)", "text": "太阳" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6989FE6989FE69C88E4BAAE_2x.png\">", "data": "::(星星月亮)", "text": "星星月亮" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E992B1E5B881_2x.png\">", "data": "::(钱币)", "text": "钱币" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E88CB6E69DAF_2x.png\">", "data": "::(茶杯)", "text": "茶杯" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E89B8BE7B395_2x.png\">", "data": "::(蛋糕)", "text": "蛋糕" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5A4A7E68B87E68C87_2x.png\">", "data": "::(大拇指)", "text": "大拇指" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E8839CE588A9_2x.png\">", "data": "::(胜利)", "text": "胜利" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/haha_2x.png\">", "data": "::(haha)", "text": "haha" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/OK_2x.png\">", "data": "::(OK)", "text": "OK" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6B299E58F91_2x.png\">", "data": "::(沙发)", "text": "沙发" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E6898BE7BAB8_2x.png\">", "data": "::(手纸)", "text": "手纸" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E9A699E89589_2x.png\">", "data": "::(香蕉)", "text": "香蕉" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E4BEBFE4BEBF_2x.png\">", "data": "::(便便)", "text": "便便" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E88DAFE4B8B8_2x.png\">", "data": "::(药丸)", "text": "药丸" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E7BAA2E9A286E5B7BE_2x.png\">", "data": "::(红领巾)", "text": "红领巾" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E89CA1E7839B_2x.png\">", "data": "::(蜡烛)", "text": "蜡烛" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E99FB3E4B990_2x.png\">", "data": "::(音乐)", "text": "音乐" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E781AFE6B3A1_2x.png\">", "data": "::(灯泡)", "text": "灯泡" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5BC80E5BF83_2x.png\">", "data": "::(开心)", "text": "开心" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E992B1_2x.png\">", "data": "::(钱)", "text": "钱" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E592A6_2x.png\">", "data": "::(咦)", "text": "咦" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E591BC_2x.png\">", "data": "::(呼)", "text": "呼" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E586B7_2x.png\">", "data": "::(冷)", "text": "冷" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E7949FE6B094_2x.png\">", "data": "::(生气)", "text": "生气" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/paopao/E5BCB1_2x.png\">", "data": "::(弱)", "text": "弱" }
]
},
"阿鲁": {
"type": "image",
"index": "1",
"container": [
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E9AB98E585B4_2x.png\">", "data": ":@(高兴)", "text": "高兴" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E5B08FE68092_2x.png\">", "data": ":@(小怒)", "text": "小怒" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E884B8E7BAA2_2x.png\">", "data": ":@(脸红)", "text": "脸红" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E58685E4BCA4_2x.png\">", "data": ":@(内伤)", "text": "内伤" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E8A385E5A4A7E6ACBE_2x.png\">", "data": ":@(装大款)", "text": "装大款" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E8B59EE4B880E4B8AA_2x.png\">", "data": ":@(赞一个)", "text": "赞一个" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E5AEB3E7BE9E_2x.png\">", "data": ":@(害羞)", "text": "害羞" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E6B197_2x.png\">", "data": ":@(汗)", "text": "汗" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E59090E8A180E58092E59CB0_2x.png\">", "data": ":@(吐血倒地)", "text": "吐血倒地" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E6B7B1E6809D_2x.png\">", "data": ":@(深思)", "text": "深思" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4B88DE9AB98E585B4_2x.png\">", "data": ":@(不高兴)", "text": "不高兴" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E697A0E8AFAD_2x.png\">", "data": ":@(无语)", "text": "无语" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4BAB2E4BAB2_2x.png\">", "data": ":@(亲亲)", "text": "亲亲" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E58FA3E6B0B4_2x.png\">", "data": ":@(口水)", "text": "口水" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E5B0B4E5B0AC_2x.png\">", "data": ":@(尴尬)", "text": "尴尬" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4B8ADE68C87_2x.png\">", "data": ":@(中指)", "text": "中指" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E683B3E4B880E683B3_2x.png\">", "data": ":@(想一想)", "text": "想一想" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E593ADE6B3A3_2x.png\">", "data": ":@(哭泣)", "text": "哭泣" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4BEBFE4BEBF_2x.png\">", "data": ":@(便便)", "text": "便便" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E78CAEE88AB1_2x.png\">", "data": ":@(献花)", "text": "献花" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E79AB1E79C89_2x.png\">", "data": ":@(皱眉)", "text": "皱眉" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E582BBE7AC91_2x.png\">", "data": ":@(傻笑)", "text": "傻笑" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E78B82E6B197_2x.png\">", "data": ":@(狂汗)", "text": "狂汗" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E59090_2x.png\">", "data": ":@(吐)", "text": "吐" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E596B7E6B0B4_2x.png\">", "data": ":@(喷水)", "text": "喷水" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E79C8BE4B88DE8A781_2x.png\">", "data": ":@(看不见)", "text": "看不见" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E9BC93E68E8C_2x.png\">", "data": ":@(鼓掌)", "text": "鼓掌" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E998B4E69A97_2x.png\">", "data": ":@(阴暗)", "text": "阴暗" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E995BFE88D89_2x.png\">", "data": ":@(长草)", "text": "长草" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E78CAEE9BB84E7939C_2x.png\">", "data": ":@(献黄瓜)", "text": "献黄瓜" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E982AAE681B6_2x.png\">", "data": ":@(邪恶)", "text": "邪恶" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E69C9FE5BE85_2x.png\">", "data": ":@(期待)", "text": "期待" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E5BE97E6848F_2x.png\">", "data": ":@(得意)", "text": "得意" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E59090E8888C_2x.png\">", "data": ":@(吐舌)", "text": "吐舌" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E596B7E8A180_2x.png\">", "data": ":@(喷血)", "text": "喷血" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E697A0E68980E8B093_2x.png\">", "data": ":@(无所谓)", "text": "无所谓" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E8A782E5AF9F_2x.png\">", "data": ":@(观察)", "text": "观察" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E69A97E59CB0E8A782E5AF9F_2x.png\">", "data": ":@(暗地观察)", "text": "暗地观察" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E882BFE58C85_2x.png\">", "data": ":@(肿包)", "text": "肿包" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4B8ADE69EAA_2x.png\">", "data": ":@(中枪)", "text": "中枪" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E5A4A7E59BA7_2x.png\">", "data": ":@(大囧)", "text": "大囧" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E591B2E78999_2x.png\">", "data": ":@(呲牙)", "text": "呲牙" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E68AA0E9BCBB_2x.png\">", "data": ":@(抠鼻)", "text": "抠鼻" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4B88DE8AFB4E8AF9D_2x.png\">", "data": ":@(不说话)", "text": "不说话" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E592BDE6B094_2x.png\">", "data": ":@(咽气)", "text": "咽气" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E6ACA2E591BC_2x.png\">", "data": ":@(欢呼)", "text": "欢呼" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E99481E79C89_2x.png\">", "data": ":@(锁眉)", "text": "锁眉" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E89CA1E7839B_2x.png\">", "data": ":@(蜡烛)", "text": "蜡烛" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E59D90E7AD89_2x.png\">", "data": ":@(坐等)", "text": "坐等" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E587BBE68E8C_2x.png\">", "data": ":@(击掌)", "text": "击掌" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E6838AE5969C_2x.png\">", "data": ":@(惊喜)", "text": "惊喜" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E5969CE69E81E8808CE6B3A3_2x.png\">", "data": ":@(喜极而泣)", "text": "喜极而泣" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E68ABDE7839F_2x.png\">", "data": ":@(抽烟)", "text": "抽烟" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4B88DE587BAE68980E69699_2x.png\">", "data": ":@(不出所料)", "text": "不出所料" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E684A4E68092_2x.png\">", "data": ":@(愤怒)", "text": "愤怒" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E697A0E5A588_2x.png\">", "data": ":@(无奈)", "text": "无奈" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E9BB91E7BABF_2x.png\">", "data": ":@(黑线)", "text": "黑线" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E68A95E9998D_2x.png\">", "data": ":@(投降)", "text": "投降" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E79C8BE783ADE997B9_2x.png\">", "data": ":@(看热闹)", "text": "看热闹" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E68987E880B3E58589_2x.png\">", "data": ":@(扇耳光)", "text": "扇耳光" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E5B08FE79CBCE79D9B_2x.png\">", "data": ":@(小眼睛)", "text": "小眼睛" },
{ "icon": "<img alt=\"表情\" src=\"/usr/themes/Joe/assets/owo/aru/E4B8ADE58880_2x.png\">", "data": ":@(中刀)", "text": "中刀" }
]
},
"颜文字": {
"type": "emoticon",
"index": "2",
"container": [
{
"icon": "|´・ω・)",
"data": "|´・ω・)"
},
{
"icon": "ヾ(≧∇≦*)ゝ",
"data": "ヾ(≧∇≦*)ゝ"
},
{
"icon": "(☆ω☆)",
"data": "(☆ω☆)"
},
{
"icon": "(╯‵□′)╯︵┴─┴",
"data": "(╯‵□′)╯︵┴─┴"
},
{
"icon": " ̄﹃ ̄",
"data": " ̄﹃ ̄"
},
{
"icon": "(/ω\)",
"data": "(/ω\)"
},
{
"icon": "∠( ᐛ 」∠)_",
"data": "∠( ᐛ 」∠)_"
},
{
"icon": "(๑•̀ㅁ•́ฅ)",
"data": "(๑•̀ㅁ•́ฅ)"
},
{
"icon": "→_→",
"data": "→_→"
},
{
"icon": "୧(๑•̀⌄•́๑)૭",
"data": "୧(๑•̀⌄•́๑)૭"
},
{
"icon": "٩(ˊᗜˋ*)و",
"data": "٩(ˊᗜˋ*)و"
},
{
"icon": "(ノ°ο°)",
"data": "(ノ°ο°)"
},
{
"icon": "(´இ皿இ`)",
"data": "(´இ皿இ`)"
},
{
"icon": "⌇●﹏●⌇",
"data": "⌇●﹏●⌇"
},
{
"icon": "(ฅ´ω`ฅ)",
"data": "(ฅ´ω`ฅ)"
},
{
"icon": "(╯°A°)╯︵○○○",
"data": "(╯°A°)╯︵○○○"
},
{
"icon": "φ( ̄∇ ̄o)",
"data": "φ( ̄∇ ̄o)"
},
{
"icon": "ヾ(´・ ・`。)\"",
"data": "ヾ(´・ ・`。)\""
},
{
"icon": "( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃",
"data": "( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃"
},
{
"icon": "(ó﹏ò。)",
"data": "(ó﹏ò。)"
},
{
"icon": "Σ(っ °Д °;)っ",
"data": "Σ(っ °Д °;)っ"
},
{
"icon": "( ,,´・ω・)ノ\"(´っω・`。)",
"data": "( ,,´・ω・)ノ\"(´っω・`。)"
},
{
"icon": "╮(╯▽╰)╭ ",
"data": "╮(╯▽╰)╭ "
},
{
"icon": "o(*////▽////*)q ",
"data": "o(*////▽////*)q "
},
{
"icon": "",
"data": ""
},
{
"icon": "( ๑´•ω•) \"(ㆆᴗㆆ)",
"data": "( ๑´•ω•) \"(ㆆᴗㆆ)"
},
{
"icon": "(。•ˇ‸ˇ•。)",
"data": "(。•ˇ‸ˇ•。)"
}
]
}
}

View File

@ -9,9 +9,10 @@ class Editor
{ {
public static function edit() public static function edit()
{ {
echo "<link rel='stylesheet' href='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.css' . "'>"; echo "<link rel='stylesheet' href='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.css?v=666' . "'>";
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.extend.js' . "'></script>"; echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.owo.js?v=666' . "'></script>";
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.js' . "'></script>"; echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.extend.js?v=666' . "'></script>";
echo "<script src='" . Helper::options()->themeUrl . '/typecho/editor/joe.editor.js?v=666' . "'></script>";
} }
} }

View File

@ -3,7 +3,7 @@
/* 获取主题当前版本号 */ /* 获取主题当前版本号 */
function _getVersion() function _getVersion()
{ {
return "5.1.7"; return "5.1.9";
}; };
/* 判断是否是手机 */ /* 判断是否是手机 */

View File

@ -306,7 +306,7 @@ function themeConfig($form)
'author' => '作者栏', 'author' => '作者栏',
'timelife' => '计时栏', 'timelife' => '计时栏',
'weather' => '天气栏需先在下方填写KEY值', 'weather' => '天气栏需先在下方填写KEY值',
'hot' => '热门文章栏', 'hot' => '热门文章栏(首页时,热门文章和侧栏热门文章只会显示其中一个)',
'ranking' => '排行榜栏', 'ranking' => '排行榜栏',
'newreply' => '最新回复栏' 'newreply' => '最新回复栏'
), ),

View File

@ -39,7 +39,7 @@
<div class="joe_aside__item-contain"></div> <div class="joe_aside__item-contain"></div>
</section> </section>
<?php endif; ?> <?php endif; ?>
<?php if (in_array('hot', $this->options->JAside)) : ?> <?php if ($this->is('index') && $this->options->JIndex_Hot !== "on" || !$this->is('index') && in_array('hot', $this->options->JAside)) : ?>
<section class="joe_aside__item hot"> <section class="joe_aside__item hot">
<div class="joe_aside__item-title"> <div class="joe_aside__item-title">
<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18"> <svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="18" height="18">

View File

@ -30,7 +30,7 @@
</div> </div>
</div> </div>
<div class="body"> <div class="body">
<textarea class="text OwO-target" name="text" autocomplete="off" placeholder="说点什么吧,点击右上方切换成画图试试?"></textarea> <textarea class="text joe_owo__target" name="text" autocomplete="off" placeholder="说点什么吧,点击右上方切换成画图试试?"></textarea>
<div class="draw" style="display: none;"> <div class="draw" style="display: none;">
<ul class="line"> <ul class="line">
<li data-line="3"></li> <li data-line="3"></li>
@ -54,7 +54,7 @@
</div> </div>
</div> </div>
<div class="foot"> <div class="foot">
<div class="OwO"></div> <div class="owo joe_owo__contain"></div>
<div class="submit"> <div class="submit">
<span class="cancle joe_comment__cancle">取消</span> <span class="cancle joe_comment__cancle">取消</span>
<button type="submit">发表评论</button> <button type="submit">发表评论</button>

View File

@ -52,8 +52,8 @@
<!-- 全局公用CSS静态资源放在了CDN上如果你的服务器带宽不够请不要修改成本地cdn采用jsdelivr放心不会失效 --> <!-- 全局公用CSS静态资源放在了CDN上如果你的服务器带宽不够请不要修改成本地cdn采用jsdelivr放心不会失效 -->
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.css?v=3434'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.css?v=666'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.css?v=3434'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.css?v=666'); ?>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/qmsg/qmsg.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/qmsg/qmsg.css" />
<link rel="stylesheet" href="https://apip.weatherdt.com/standard/static/css/weather-standard.css"> <link rel="stylesheet" href="https://apip.weatherdt.com/standard/static/css/weather-standard.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
@ -66,7 +66,8 @@
<script src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/sketchpad/joe.sketchpad.js"></script> <script src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/sketchpad/joe.sketchpad.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/qmsg/qmsg.js"></script> <script src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/qmsg/qmsg.js"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.js?v=23123'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.owo.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.js?v=666'); ?>"></script>
<!-- 异步加载的JS --> <!-- 异步加载的JS -->
<script async src="https://apip.weatherdt.com/standard/static/js/weather-standard.js?v=2.0"></script> <script async src="https://apip.weatherdt.com/standard/static/js/weather-standard.js?v=2.0"></script>
<script async src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/smooth/joe.smooth.js"></script> <script async src="https://cdn.jsdelivr.net/gh/HaoOuBa/Joe@master/plugin/smooth/joe.smooth.js"></script>

View File

@ -1 +1 @@
.col-mb-12.col-tb-8.col-tb-offset-2{margin-left:0;width:100%}.joe_config{display:flex}.joe_config *{margin:0;padding:0;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent}.joe_config li{list-style:none}.joe_config__aside{position:-webkit-sticky;position:sticky;top:15px;width:200px;background:#fff;padding:10px;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:8px}.joe_config__aside .logo{color:#303133;font-weight:500;font-size:24px;text-align:center;margin-bottom:10px;border-bottom:1px solid #ebeef5;padding-bottom:10px}.joe_config__aside .tabs{margin-bottom:10px}.joe_config__aside .tabs .item{border-radius:20px;text-align:center;height:40px;line-height:40px;color:#606266;cursor:pointer;transition:background 0.35s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_config__aside .tabs .item:hover{background:#f2f6fc}.joe_config__aside .tabs .item.active{color:#409eff;font-weight:500}.joe_config__aside .backup input{width:170px;height:40px;line-height:40px;margin-bottom:10px;color:#fff;font-size:14px;border-radius:20px;transition:opacity 0.35s;border:none;cursor:pointer}.joe_config__aside .backup input:hover{opacity:0.85}.joe_config__aside .backup input:nth-child(1){background:#5cb85c}.joe_config__aside .backup input:nth-child(2){background:#f0ad4e}.joe_config__aside .backup input:nth-child(3){margin-bottom:0;background:#d9534f}.joe_config>form{position:relative;display:none;background:#fff;min-width:0;flex:1;margin-left:15px;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:8px}.joe_config>form .typecho-option{position:-webkit-sticky;position:sticky;bottom:0;display:flex;align-items:center;justify-content:center;margin:0;padding:15px;background:#fff;border-top:1px solid #ebebeb;border-radius:0 0 8px 8px}.joe_config>form .typecho-option button{width:170px;height:40px;background-color:#409eff;border-radius:20px}.joe_config>form .typecho-option button:hover{-webkit-animation:pulse 1s;animation:pulse 1s;box-shadow:0 0 0 20px rgba(255,255,255,0)}.joe_config>form .joe_content{display:none;padding:15px}.joe_config>form .joe_content li{border:1px solid #e9e9eb;padding:15px}.joe_config>form .joe_content li .typecho-label{display:block;border-left:4px solid #409eff;background:#ecf5ff;line-height:26px;margin-bottom:15px;padding:5px 15px;color:#409eff;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:0 4px 4px 0}.joe_config>form .joe_content li select{min-width:200px;height:34px;line-height:34px;border:1px solid #e9e9eb;color:#666;border-radius:4px;padding-left:5px}.joe_config>form .joe_content li .multiline{display:flex;align-items:center;color:#666}.joe_config>form .joe_content li .multiline input[type='checkbox']{margin-right:5px}.joe_config>form .joe_content li textarea,.joe_config>form .joe_content li input[type='text']{width:100%;padding:10px;color:#666;border:1px solid #e9e9eb;-webkit-appearance:none}.joe_config>form .joe_content li textarea{height:125px}.joe_config>form .joe_content li .description{background:#f8f8f8;color:#999;padding:10px 15px;margin-top:15px;line-height:26px;border-radius:4px;word-break:break-all}.joe_config__notice{display:none;margin-left:15px;background:#fff;padding:15px;flex:1;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:8px;line-height:28px;color:#606266}.joe_config__notice ol{padding:0 40px}.joe_config__notice ol li{list-style:decimal}@-webkit-keyframes pulse{0%{box-shadow:0 0 0 0 #409eff}}@keyframes pulse{0%{box-shadow:0 0 0 0 #409eff}}@media (max-width: 768px){.joe_config{display:block}.joe_config__aside{width:100%;margin-bottom:15px}.joe_config__aside .tabs{display:flex;flex-wrap:wrap;border-bottom:1px solid #ebeef5;padding-bottom:10px}.joe_config__aside .tabs .item{width:33.33333333%;height:36px;line-height:36px;border-radius:18px}.joe_config__aside .backup{display:flex;align-items:center;justify-content:space-between}.joe_config__aside .backup input{width:auto;flex:1;margin-bottom:0;height:36px;line-height:36px;border-radius:18px}.joe_config__aside .backup input:nth-child(2){margin:0 10px}.joe_config>form{margin-left:0}.joe_config>form .typecho-option{padding:10px 0}.joe_config>form .typecho-option button{width:150px;height:38px;border-radius:19px}.joe_config__notice{margin-left:0}} .col-mb-12.col-tb-8.col-tb-offset-2{margin-left:0;width:100%}.joe_config{display:flex}.joe_config *{margin:0;padding:0;box-sizing:border-box;outline:none;-webkit-tap-highlight-color:transparent}.joe_config li{list-style:none}.joe_config__aside{position:-webkit-sticky;position:sticky;top:15px;width:200px;background:#fff;padding:10px;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:8px}.joe_config__aside .logo{color:#303133;font-weight:500;font-size:24px;text-align:center;margin-bottom:10px;border-bottom:1px solid #ebeef5;padding-bottom:10px}.joe_config__aside .tabs{margin-bottom:10px}.joe_config__aside .tabs .item{border-radius:20px;text-align:center;height:40px;line-height:40px;color:#606266;cursor:pointer;transition:background 0.35s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_config__aside .tabs .item:hover{background:#f2f6fc}.joe_config__aside .tabs .item.active{color:#409eff;font-weight:500}.joe_config__aside .backup input{width:170px;height:40px;line-height:40px;margin-bottom:10px;color:#fff;font-size:14px;border-radius:20px;transition:opacity 0.35s;border:none;cursor:pointer}.joe_config__aside .backup input:hover{opacity:0.85}.joe_config__aside .backup input:nth-child(1){background:#5cb85c}.joe_config__aside .backup input:nth-child(2){background:#f0ad4e}.joe_config__aside .backup input:nth-child(3){margin-bottom:0;background:#d9534f}.joe_config>form{position:relative;display:none;background:#fff;min-width:0;flex:1;margin-left:15px;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:8px}.joe_config>form .typecho-option{position:-webkit-sticky;position:sticky;bottom:0;display:flex;align-items:center;justify-content:center;margin:0;padding:15px;background:#fff;border-top:1px solid #ebebeb;border-radius:0 0 8px 8px}.joe_config>form .typecho-option button{width:170px;height:40px;background-color:#409eff;border-radius:20px}.joe_config>form .typecho-option button:hover{-webkit-animation:pulse 1s;animation:pulse 1s;box-shadow:0 0 0 20px rgba(255,255,255,0)}.joe_config>form .joe_content{display:none;padding:15px}.joe_config>form .joe_content li{border:1px solid #e9e9eb;padding:15px}.joe_config>form .joe_content li .typecho-label{display:block;border-left:4px solid #409eff;background:#ecf5ff;line-height:26px;margin-bottom:15px;padding:5px 15px;color:#409eff;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border-radius:0 4px 4px 0}.joe_config>form .joe_content li select{min-width:200px;height:34px;line-height:34px;border:1px solid #e9e9eb;color:#666;border-radius:4px;padding-left:5px}.joe_config>form .joe_content li .multiline{display:flex;align-items:center;color:#666}.joe_config>form .joe_content li .multiline input[type='checkbox']{margin-right:5px}.joe_config>form .joe_content li textarea,.joe_config>form .joe_content li input[type='text']{width:100%;padding:10px;color:#666;border:1px solid #e9e9eb;-webkit-appearance:none}.joe_config>form .joe_content li textarea{height:125px}.joe_config>form .joe_content li .description{background:#f8f8f8;color:#999;padding:10px 15px;margin-top:15px;line-height:26px;border-radius:4px;word-break:break-all}.joe_config__notice{display:none;margin-left:15px;background:#fff;padding:15px;flex:1;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:8px;line-height:28px;color:#606266}.joe_config__notice ol{padding:0 40px;margin-bottom:15px}.joe_config__notice ol li{list-style:decimal}@-webkit-keyframes pulse{0%{box-shadow:0 0 0 0 #409eff}}@keyframes pulse{0%{box-shadow:0 0 0 0 #409eff}}@media (max-width: 768px){.joe_config{display:block}.joe_config__aside{width:100%;margin-bottom:15px}.joe_config__aside .tabs{display:flex;flex-wrap:wrap;border-bottom:1px solid #ebeef5;padding-bottom:10px}.joe_config__aside .tabs .item{width:33.33333333%;height:36px;line-height:36px;border-radius:18px}.joe_config__aside .backup{display:flex;align-items:center;justify-content:space-between}.joe_config__aside .backup input{width:auto;flex:1;margin-bottom:0;height:36px;line-height:36px;border-radius:18px}.joe_config__aside .backup input:nth-child(2){margin:0 10px}.joe_config>form{margin-left:0}.joe_config>form .typecho-option{padding:10px 0}.joe_config>form .typecho-option button{width:150px;height:38px;border-radius:19px}.joe_config__notice{margin-left:0}}

View File

@ -1 +1 @@
"use strict";document.addEventListener("DOMContentLoaded",function(){var a=document.querySelectorAll(".joe_config__aside .item"),b=document.querySelector(".joe_config__notice"),c=document.querySelector(".joe_config > form"),d=document.querySelectorAll(".joe_content");if(a.forEach(function(f){f.addEventListener("click",function(){a.forEach(function(h){h.classList.remove("active")}),f.classList.add("active");var g=f.getAttribute("data-current");sessionStorage.setItem("joe_config_current",g),"joe_notice"===g?(b.style.display="block",c.style.display="none"):(b.style.display="none",c.style.display="block"),d.forEach(function(h){h.style.display="none";var i=h.classList.contains(g);i&&(h.style.display="block")})})}),sessionStorage.getItem("joe_config_current")){var f=sessionStorage.getItem("joe_config_current");"joe_notice"===f?(b.style.display="block",c.style.display="none"):(c.style.display="block",b.style.display="none"),a.forEach(function(g){var h=g.getAttribute("data-current");h===f&&g.classList.add("active")}),d.forEach(function(g){g.classList.contains(f)&&(g.style.display="block")})}else a[0].classList.add("active"),b.style.display="block",c.style.display="none";var e=new XMLHttpRequest;e.onreadystatechange=function(){if(4===e.readyState)if(200<=e.status&&300>e.status||304===e.status){var f=JSON.parse(e.responseText);b.innerHTML=f.success?f.content:"\u8BF7\u6C42\u5931\u8D25\uFF01"}else b.innerHTML="\u8BF7\u6C42\u5931\u8D25\uFF01"},e.open("get","https://as.js.cn/qqshoucang.php?key=18e958d8c7fa5d435844f95c9f254fca",!0),e.send(null)}); document.addEventListener("DOMContentLoaded",function(){var e=document.querySelectorAll(".joe_config__aside .item"),t=document.querySelector(".joe_config__notice"),s=document.querySelector(".joe_config > form"),n=document.querySelectorAll(".joe_content");if(e.forEach(function(o){o.addEventListener("click",function(){e.forEach(function(e){e.classList.remove("active")}),o.classList.add("active");var c=o.getAttribute("data-current");sessionStorage.setItem("joe_config_current",c),"joe_notice"===c?(t.style.display="block",s.style.display="none"):(t.style.display="none",s.style.display="block"),n.forEach(function(e){e.style.display="none";var t=e.classList.contains(c);t&&(e.style.display="block")})})}),sessionStorage.getItem("joe_config_current")){var o=sessionStorage.getItem("joe_config_current");"joe_notice"===o?(t.style.display="block",s.style.display="none"):(s.style.display="block",t.style.display="none"),e.forEach(function(e){var t=e.getAttribute("data-current");t===o&&e.classList.add("active")}),n.forEach(function(e){e.classList.contains(o)&&(e.style.display="block")})}else e[0].classList.add("active"),t.style.display="block",s.style.display="none";var c=new XMLHttpRequest;c.onreadystatechange=function(){if(4===c.readyState)if(200<=c.status&&300>c.status||304===c.status){var e=JSON.parse(c.responseText);t.innerHTML=e.success?e.content:"请求失败!"}else t.innerHTML="请求失败!"},c.open("get","https://as.js.cn/qqshoucang.php?key=18e958d8c7fa5d435844f95c9f254fca",!0),c.send(null)});

View File

@ -186,6 +186,7 @@
color: #606266; color: #606266;
ol { ol {
padding: 0 40px; padding: 0 40px;
margin-bottom: 15px;
li { li {
list-style: decimal; list-style: decimal;
} }

View File

@ -1 +1 @@
table.typecho-list-table textarea[name='fields[thumb]'],table.typecho-list-table textarea[name='fields[abstract]'],table.typecho-list-table textarea[name='fields[description]'],table.typecho-list-table textarea[name='fields[video]']{width:100%;height:80px}table.typecho-list-table input[name='fields[keywords]']{width:100%}#wmd-button-row{height:auto}#wmd-button-row .wmd-button .icon{width:20px;height:20px;vertical-align:middle;fill:#9b9b9b} table.typecho-list-table textarea[name='fields[thumb]'],table.typecho-list-table textarea[name='fields[abstract]'],table.typecho-list-table textarea[name='fields[description]'],table.typecho-list-table textarea[name='fields[video]']{width:100%;height:80px}table.typecho-list-table input[name='fields[keywords]']{width:100%}#wmd-button-row{height:auto}#wmd-button-row .wmd-button .icon{width:20px;height:20px;vertical-align:middle;fill:#9b9b9b}.joe_owo__contain{position:relative}.joe_owo__contain *{box-sizing:border-box}.joe_owo__contain .seat{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.joe_owo__contain .box{position:absolute;left:0;width:300px;background:#fff;box-shadow:0px 0px 20px -5px rgba(158,158,158,0.22);border-radius:4px;overflow:hidden;visibility:hidden;-webkit-transform:scale(0.5);transform:scale(0.5);opacity:0;transition:visibility, 0.35s, opacity 0.35s, -webkit-transform 0.35s;transition:visibility, 0.35s, opacity 0.35s, transform 0.35s;transition:visibility, 0.35s, opacity 0.35s, transform 0.35s, -webkit-transform 0.35s}.joe_owo__contain .box.show{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.joe_owo__contain .box .scroll{display:none;max-height:200px;overflow-y:auto;-ms-scroll-chaining:none;overscroll-behavior:none;padding:5px}.joe_owo__contain .box .scroll::-webkit-scrollbar{width:8px;height:8px}.joe_owo__contain .box .scroll::-webkit-scrollbar-thumb{border-radius:4px;background:#c0c4cc}.joe_owo__contain .box .scroll::-webkit-scrollbar-track{background:transparent}.joe_owo__contain .box .scroll:nth-child(3) .item{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:50%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.joe_owo__contain .box .scroll .item{width:20%;display:inline-block;padding:5px;cursor:pointer;border-radius:4px;transition:background 0.25s;margin:0}.joe_owo__contain .box .scroll .item img{max-width:100%;max-height:100%}.joe_owo__contain .box .scroll .item:hover{background:#f2f6fc}.joe_owo__contain .box .bar{display:flex;align-items:center;border-top:1px solid #f2f6fc}.joe_owo__contain .box .bar .item{line-height:30px;padding:0 10px;cursor:pointer;color:var(--routine);transition:background 0.25s}.joe_owo__contain .box .bar .item.active{background:#f2f6fc}

View File

@ -3,7 +3,6 @@ $(function () {
$('#wmd-button-bar .wmd-edittab').remove(); $('#wmd-button-bar .wmd-edittab').remove();
$('#wmd-button-row .wmd-spacer').remove(); $('#wmd-button-row .wmd-spacer').remove();
$('#wmd-button-row #wmd-code-button').remove(); $('#wmd-button-row #wmd-code-button').remove();
/* 增加自定义功能 */ /* 增加自定义功能 */
const items = [ const items = [
{ {
@ -159,11 +158,19 @@ $(function () {
} }
return str; return str;
} }
/* 此处无需修改 */ /* 此处无需修改 */
items.forEach(_ => { items.forEach(_ => {
let item = $(`<li class="wmd-button" id="${_.id}" title="${_.title}">${_.svg}</li>`); let item = $(`<li class="wmd-button" id="${_.id}" title="${_.title}">${_.svg}</li>`);
item.on('mousedown', () => $('#text').insertContent(getInsertTextById(_.id))); item.on('mousedown', () => $('#text').insertContent(getInsertTextById(_.id)));
$('#wmd-button-row').append(item); $('#wmd-button-row').append(item);
}); });
$('#wmd-button-row').append(`
<li class="wmd-button joe_owo__contain" title="插入表情"></li>
`);
new JoeOwO({
target: '#text',
seat: '<svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"><path d="M512 160c194.4 0 352 157.6 352 352s-157.6 352-352 352S160 706.4 160 512 317.6 160 512 160z m0 64a288 288 0 1 0 0 576 288 288 0 0 0 0-576z m122.08 326.624l61.024 19.264a191.488 191.488 0 0 1-28.736 56.288A191.744 191.744 0 0 1 512 704a191.744 191.744 0 0 1-179.648-124.096l-3.456-10.016 61.024-19.264c4.256 13.44 10.72 26.112 19.136 37.44A127.744 127.744 0 0 0 512 640a127.744 127.744 0 0 0 119.264-81.408l2.816-8zM400 352a48 48 0 1 1 0 96 48 48 0 0 1 0-96z m224 0a48 48 0 1 1 0 96 48 48 0 0 1 0-96z" p-id="2401" fill="#9b9b9b"></path></svg>'
});
}); });

View File

@ -21,3 +21,91 @@ table.typecho-list-table {
} }
} }
} }
.joe_owo {
&__contain {
position: relative;
* {
box-sizing: border-box;
}
.seat {
user-select: none;
cursor: pointer;
}
.box {
position: absolute;
left: 0;
width: 300px;
background: #fff;
box-shadow: 0px 0px 20px -5px rgba(158, 158, 158, 0.22);
border-radius: 4px;
overflow: hidden;
visibility: hidden;
transform: scale(0.5);
opacity: 0;
transition: visibility, 0.35s, opacity 0.35s, transform 0.35s;
&.show {
visibility: visible;
transform: scale(1);
opacity: 1;
}
.scroll {
display: none;
max-height: 200px;
overflow-y: auto;
overscroll-behavior: none;
padding: 5px;
&::-webkit-scrollbar {
width: 8px;
height: 8px;
}
&::-webkit-scrollbar-thumb {
border-radius: 4px;
background: #c0c4cc;
}
&::-webkit-scrollbar-track {
background: transparent;
}
&:nth-child(3) .item {
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 50%;
user-select: none;
}
.item {
width: 20%;
display: inline-block;
padding: 5px;
cursor: pointer;
border-radius: 4px;
transition: background 0.25s;
margin: 0;
img {
max-width: 100%;
max-height: 100%;
}
&:hover {
background: #f2f6fc;
}
}
}
.bar {
display: flex;
align-items: center;
border-top: 1px solid #f2f6fc;
.item {
line-height: 30px;
padding: 0 10px;
cursor: pointer;
color: var(--routine);
transition: background 0.25s;
&.active {
background: #f2f6fc;
}
}
}
}
}
}

View File

@ -1,60 +1 @@
(function ($) { (function(e){e.fn.extend({insertContent:function(t,n){var a=e(this)[0];if(document.selection){this.focus();var s=document.selection.createRange();s.text=t,this.focus(),s.moveStart("character",-i);var c=s.text.length;if(2==arguments.length){var i=a.value.length;s.moveEnd("character",c+n),n<=0?s.moveStart("character",c-2*n-t.length):s.moveStart("character",c-n-t.length),s.select()}}else if(a.selectionStart||"0"==a.selectionStart){var o=a.selectionStart,r=a.selectionEnd,l=a.scrollTop;a.value=a.value.substring(0,o)+t+a.value.substring(r,a.value.length),this.focus(),a.selectionStart=o+t.length,a.selectionEnd=o+t.length,a.scrollTop=l,2==arguments.length&&(a.setSelectionRange(o-n,a.selectionEnd+n),this.focus())}else this.value+=t,this.focus()},selectionRange:function(e,t){var n="",a=this[0];if(void 0===e)n=/input|textarea/i.test(a.tagName)&&/firefox/i.test(navigator.userAgent)?a.value.substring(a.selectionStart,a.selectionEnd):document.selection?document.selection.createRange().text:document.getSelection().toString();else{if(!/input|textarea/.test(a.tagName.toLowerCase()))return!1;if(void 0===t&&(t=e),a.setSelectionRange)a.setSelectionRange(e,t),this.focus();else{var s=a.createTextRange();s.move("character",e),s.moveEnd("character",t-e),s.select()}}return void 0===e?n:this}})})(jQuery);
$.fn.extend({
insertContent: function (myValue, t) {
var $t = $(this)[0];
if (document.selection) {
this.focus();
var sel = document.selection.createRange();
sel.text = myValue;
this.focus();
sel.moveStart('character', -l);
var wee = sel.text.length;
if (arguments.length == 2) {
var l = $t.value.length;
sel.moveEnd('character', wee + t);
t <= 0 ? sel.moveStart('character', wee - 2 * t - myValue.length) : sel.moveStart('character', wee - t - myValue.length);
sel.select();
}
} else if ($t.selectionStart || $t.selectionStart == '0') {
var startPos = $t.selectionStart;
var endPos = $t.selectionEnd;
var scrollTop = $t.scrollTop;
$t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length);
this.focus();
$t.selectionStart = startPos + myValue.length;
$t.selectionEnd = startPos + myValue.length;
$t.scrollTop = scrollTop;
if (arguments.length == 2) {
$t.setSelectionRange(startPos - t, $t.selectionEnd + t);
this.focus();
}
} else {
this.value += myValue;
this.focus();
}
},
selectionRange: function (start, end) {
var str = '';
var thisSrc = this[0];
if (start === undefined) {
if (/input|textarea/i.test(thisSrc.tagName) && /firefox/i.test(navigator.userAgent)) str = thisSrc.value.substring(thisSrc.selectionStart, thisSrc.selectionEnd);
else if (document.selection) str = document.selection.createRange().text;
else str = document.getSelection().toString();
} else {
if (!/input|textarea/.test(thisSrc.tagName.toLowerCase())) return false;
end === undefined && (end = start);
if (thisSrc.setSelectionRange) {
thisSrc.setSelectionRange(start, end);
this.focus();
} else {
var range = thisSrc.createTextRange();
range.move('character', start);
range.moveEnd('character', end - start);
range.select();
}
}
if (start === undefined) return str;
else return this;
}
});
})(jQuery);

84
typecho/editor/joe.owo.js Normal file
View File

@ -0,0 +1,84 @@
class JoeOwO {
constructor(options) {
const defaultOption = {
contain: '.joe_owo__contain',
target: '.joe_owo__target',
seat: 'OωO',
api: '/usr/themes/Joe/assets/json/joe.owo.json'
};
this.options = Object.assign(defaultOption, options);
$.ajax({
url: this.options.api,
type: 'get',
dataType: 'json',
success: res => this.initHtml(res)
});
}
/* 初始化 */
initHtml(res) {
let barStr = '';
let scrollStr = '';
for (let key in res) {
barStr += `<div class="item" data-index="${res[key].index}">${key}</div>`;
scrollStr += `
<ul class="scroll" data-index="${res[key].index}">
${res[key].container.map(_ => `<li class="item" data-text="${_.data}">${_.icon}</li>`).join('')}
</ul>
`;
}
$(this.options.contain).html(`
<div class="seat">${this.options.seat}</div>
<div class="box">
${scrollStr}
<div class="bar">${barStr}</div>
</div>
`);
this.initEvent();
}
initEvent() {
/* 容器 */
const contain = this.options.contain;
const height = $(contain).height();
/* 点击页面关闭 */
$(document).on('click', function () {
$(contain + ' .box').removeClass('show');
});
/* 点击占位符,显示表情弹窗 */
const seat = contain + ' .seat';
$(seat).on('click', function (e) {
e.stopPropagation();
$(this).siblings('.box').css('top', height).toggleClass('show');
});
/* 点击tab栏切换表情类型 */
const barItem = contain + ' .box .bar .item';
$(barItem).on('click', function (e) {
e.stopPropagation();
$(this).addClass('active').siblings().removeClass('active');
const scrollIndx = contain + ' .box .scroll[data-index="' + $(this).attr('data-index') + '"]';
$(scrollIndx).show().siblings('.scroll').hide();
});
/* 点击表情,向文本框插入内容 */
const items = contain + ' .scroll .item';
const textarea = $(this.options.target)[0];
$(items).on('click', function () {
const text = $(this).attr('data-text');
const cursorPos = textarea.selectionEnd;
const areaValue = textarea.value;
textarea.value = areaValue.slice(0, cursorPos) + text + areaValue.slice(cursorPos);
textarea.focus();
});
/* 默认激活第一个 */
$(barItem).first().click();
}
}
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
module.exports = JoeOwO;
} else {
window.JoeOwO = JoeOwO;
}