This commit is contained in:
杜恒 2021-04-22 15:36:33 +08:00
parent 88030a0b16
commit 593e236a02
16 changed files with 446 additions and 277 deletions

File diff suppressed because one or more lines are too long

View File

@ -2261,6 +2261,61 @@
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
} }
&-tabs {
display: block;
width: 100%;
overflow: hidden;
background: var(--background);
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
border: 1px solid var(--classC);
border-radius: 4px;
.heads {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
display: flex;
background: var(--classD);
.item {
position: relative;
padding: 0 15px;
line-height: 40px;
height: 40px;
color: var(--minor);
cursor: pointer;
transition: color 0.5s;
white-space: nowrap;
font-size: 14px;
&::after {
content: '';
position: absolute;
background: var(--theme);
bottom: 0;
left: 15px;
right: 15px;
height: 2px;
opacity: 0;
border-radius: 2px;
transform: scaleX(0.5);
transition: opacity 0.25s, transform 0.25s;
}
&.active {
color: var(--theme);
&::after {
opacity: 1;
transform: scaleX(1);
}
}
}
}
.bodys {
.item {
padding: 15px;
*:last-child {
margin-bottom: 0 !important;
}
}
}
}
/* 以下未测试 */ /* 以下未测试 */
&-protected { &-protected {

View File

@ -1,242 +1,243 @@
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
$('.joe_detail__article p:empty').remove();
$('.joe_detail__article p:empty').remove(); class JoeMtitle extends HTMLElement {
constructor() {
class JoeMtitle extends HTMLElement { super();
constructor() { this.innerHTML = `
super();
this.innerHTML = `
<span class="joe_detail__article-mtitle"> <span class="joe_detail__article-mtitle">
<span class="text"> <span class="text">
${this.getAttribute('title') || '默认标题'} ${this.getAttribute('title') || '默认标题'}
</span> </span>
</span>`; </span>
} `;
} }
window.customElements.define('joe-mtitle', JoeMtitle); }
class JoeDplayer extends HTMLElement { window.customElements.define('joe-mtitle', JoeMtitle);
constructor() { class JoeDplayer extends HTMLElement {
super(); constructor() {
this.options = { super();
src: this.getAttribute('src'), this.options = {
player: this.getAttribute('player') src: this.getAttribute('src'),
}; player: this.getAttribute('player')
this.render(); };
} this.render();
render() { }
if (this.options.src) this.innerHTML = `<iframe allowfullscreen="true" class="joe_detail__article-player" src="${this.options.player + this.options.src}"></iframe>`; render() {
else this.innerHTML = '播放地址未填写!'; if (this.options.src) this.innerHTML = `<iframe allowfullscreen="true" class="joe_detail__article-player" src="${this.options.player + this.options.src}"></iframe>`;
} else this.innerHTML = '播放地址未填写!';
} }
window.customElements.define('joe-dplayer', JoeDplayer); }
class JoeBilibili extends HTMLElement { window.customElements.define('joe-dplayer', JoeDplayer);
constructor() { class JoeBilibili extends HTMLElement {
super(); constructor() {
this.bvid = this.getAttribute('bvid'); super();
this.render(); this.bvid = this.getAttribute('bvid');
} this.render();
render() { }
if (this.bvid) this.innerHTML = `<iframe allowfullscreen="true" class="joe_detail__article-player" src="//player.bilibili.com/player.html?bvid=${this.bvid}"></iframe>`; render() {
else this.innerHTML = 'Bvid未填写'; if (this.bvid) this.innerHTML = `<iframe allowfullscreen="true" class="joe_detail__article-player" src="//player.bilibili.com/player.html?bvid=${this.bvid}"></iframe>`;
} else this.innerHTML = 'Bvid未填写';
} }
window.customElements.define('joe-bilibili', JoeBilibili); }
class JoeMp3 extends HTMLElement { window.customElements.define('joe-bilibili', JoeBilibili);
constructor() { class JoeMp3 extends HTMLElement {
super(); constructor() {
this.options = { super();
name: this.getAttribute('name'), this.options = {
url: this.getAttribute('url'), name: this.getAttribute('name'),
theme: this.getAttribute('theme') || '#1989fa', url: this.getAttribute('url'),
cover: this.getAttribute('cover'), theme: this.getAttribute('theme') || '#1989fa',
autoplay: this.getAttribute('autoplay') ? true : false cover: this.getAttribute('cover'),
}; autoplay: this.getAttribute('autoplay') ? true : false
this.render(); };
} this.render();
render() { }
if (!this.options.url) return (this.innerHTML = '音频地址未填写!'); render() {
this.innerHTML = '<span style="display: block"></span>'; if (!this.options.url) return (this.innerHTML = '音频地址未填写!');
new APlayer({ this.innerHTML = '<span style="display: block"></span>';
container: this.querySelector('span'), new APlayer({
theme: this.options.theme, container: this.querySelector('span'),
autoplay: this.options.autoplay, theme: this.options.theme,
audio: [ autoplay: this.options.autoplay,
{ audio: [
url: this.options.url, {
name: this.options.name, url: this.options.url,
cover: this.options.cover name: this.options.name,
} cover: this.options.cover
] }
}); ]
} });
} }
window.customElements.define('joe-mp3', JoeMp3); }
class JoeMusic extends HTMLElement { window.customElements.define('joe-mp3', JoeMp3);
constructor() { class JoeMusic extends HTMLElement {
super(); constructor() {
this.options = { super();
id: this.getAttribute('id'), this.options = {
color: this.getAttribute('color') || '#1989fa', id: this.getAttribute('id'),
autoplay: this.getAttribute('autoplay') ? true : false color: this.getAttribute('color') || '#1989fa',
}; autoplay: this.getAttribute('autoplay') ? true : false
this.render(); };
} this.render();
render() { }
if (!this.options.id) return (this.innerHTML = '网易云歌曲ID未填写'); render() {
this.innerHTML = '<span style="display: block"></span>'; if (!this.options.id) return (this.innerHTML = '网易云歌曲ID未填写');
fetch('https://api.i-meto.com/meting/api?server=netease&type=song&id=' + this.options.id).then(async response => { this.innerHTML = '<span style="display: block"></span>';
const audio = await response.json(); fetch('https://api.i-meto.com/meting/api?server=netease&type=song&id=' + this.options.id).then(async response => {
new APlayer({ const audio = await response.json();
container: this.querySelector('span'), new APlayer({
lrcType: 3, container: this.querySelector('span'),
theme: this.options.color, lrcType: 3,
autoplay: this.options.autoplay, theme: this.options.color,
audio autoplay: this.options.autoplay,
}); audio
}); });
} });
} }
window.customElements.define('joe-music', JoeMusic); }
class JoeMlist extends HTMLElement { window.customElements.define('joe-music', JoeMusic);
constructor() { class JoeMlist extends HTMLElement {
super(); constructor() {
this.options = { super();
id: this.getAttribute('id'), this.options = {
color: this.getAttribute('color') || '#1989fa', id: this.getAttribute('id'),
autoplay: this.getAttribute('autoplay') ? true : false color: this.getAttribute('color') || '#1989fa',
}; autoplay: this.getAttribute('autoplay') ? true : false
this.render(); };
} this.render();
render() { }
if (!this.options.id) return (this.innerHTML = '网易云歌单ID未填写'); render() {
this.innerHTML = '<span style="display: block"></span>'; if (!this.options.id) return (this.innerHTML = '网易云歌单ID未填写');
fetch('https://api.i-meto.com/meting/api?server=netease&type=playlist&id=' + this.options.id).then(async response => { this.innerHTML = '<span style="display: block"></span>';
const audio = await response.json(); fetch('https://api.i-meto.com/meting/api?server=netease&type=playlist&id=' + this.options.id).then(async response => {
new APlayer({ const audio = await response.json();
container: this.querySelector('span'), new APlayer({
lrcType: 3, container: this.querySelector('span'),
theme: this.options.color, lrcType: 3,
autoplay: this.options.autoplay, theme: this.options.color,
audio autoplay: this.options.autoplay,
}); audio
}); });
} });
} }
window.customElements.define('joe-mlist', JoeMlist); }
class JoeAbtn extends HTMLElement { window.customElements.define('joe-mlist', JoeMlist);
constructor() { class JoeAbtn extends HTMLElement {
super(); constructor() {
this.options = { super();
icon: this.getAttribute('icon') || '', this.options = {
color: this.getAttribute('color') || '#ff6800', icon: this.getAttribute('icon') || '',
href: this.getAttribute('href') || '#', color: this.getAttribute('color') || '#ff6800',
radius: this.getAttribute('radius') || '17.5px', href: this.getAttribute('href') || '#',
content: this.getAttribute('content') || '多彩按钮' radius: this.getAttribute('radius') || '17.5px',
}; content: this.getAttribute('content') || '多彩按钮'
this.innerHTML = ` };
this.innerHTML = `
<a class="joe_detail__article-abtn" style="background: ${this.options.color}; border-radius: ${this.options.radius}" href="${this.options.href}" target="_blank" rel="noopener noreferrer nofollow"> <a class="joe_detail__article-abtn" style="background: ${this.options.color}; border-radius: ${this.options.radius}" href="${this.options.href}" target="_blank" rel="noopener noreferrer nofollow">
<span class="icon"><i class="${this.options.icon} fa"></i></span><span class="content">${this.options.content}</span> <span class="icon"><i class="${this.options.icon} fa"></i></span><span class="content">${this.options.content}</span>
</a> </a>
`; `;
} }
} }
window.customElements.define('joe-abtn', JoeAbtn); window.customElements.define('joe-abtn', JoeAbtn);
class JoeAnote extends HTMLElement { class JoeAnote extends HTMLElement {
constructor() { constructor() {
super(); super();
this.options = { this.options = {
icon: this.getAttribute('icon') || 'fa-download', icon: this.getAttribute('icon') || 'fa-download',
href: this.getAttribute('href') || '#', href: this.getAttribute('href') || '#',
type: /^secondary$|^success$|^warning$|^error$|^info$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'secondary', type: /^secondary$|^success$|^warning$|^error$|^info$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'secondary',
content: this.getAttribute('content') || '标签按钮' content: this.getAttribute('content') || '标签按钮'
}; };
this.innerHTML = ` this.innerHTML = `
<a class="joe_detail__article-anote ${this.options.type}" href="${this.options.href}" target="_blank" rel="noopener noreferrer nofollow"> <a class="joe_detail__article-anote ${this.options.type}" href="${this.options.href}" target="_blank" rel="noopener noreferrer nofollow">
<span class="icon"><i class="fa ${this.options.icon}"></i></span><span class="content">${this.options.content}</span> <span class="icon"><i class="fa ${this.options.icon}"></i></span><span class="content">${this.options.content}</span>
</a> </a>
`; `;
} }
} }
window.customElements.define('joe-anote', JoeAnote); window.customElements.define('joe-anote', JoeAnote);
class JoeDotted extends HTMLElement { class JoeDotted extends HTMLElement {
constructor() { constructor() {
super(); super();
this.startColor = this.getAttribute('startColor') || '#ff6c6c'; this.startColor = this.getAttribute('startColor') || '#ff6c6c';
this.endColor = this.getAttribute('endColor') || '#1989fa'; this.endColor = this.getAttribute('endColor') || '#1989fa';
this.innerHTML = ` this.innerHTML = `
<span class="joe_detail__article-dotted" style="background-image: repeating-linear-gradient(-45deg, ${this.startColor} 0, ${this.startColor} 20%, transparent 0, transparent 25%, ${this.endColor} 0, ${this.endColor} 45%, transparent 0, transparent 50%)"></span> <span class="joe_detail__article-dotted" style="background-image: repeating-linear-gradient(-45deg, ${this.startColor} 0, ${this.startColor} 20%, transparent 0, transparent 25%, ${this.endColor} 0, ${this.endColor} 45%, transparent 0, transparent 50%)"></span>
`; `;
} }
} }
window.customElements.define('joe-dotted', JoeDotted); window.customElements.define('joe-dotted', JoeDotted);
class JoeHide extends HTMLElement { class JoeHide extends HTMLElement {
constructor() { constructor() {
super(); super();
this.render(); this.render();
} }
render() { render() {
this.innerHTML = '<span class="joe_detail__article-hide">此处内容作者设置了 <i>回复</i> 可见</span>'; this.innerHTML = '<span class="joe_detail__article-hide">此处内容作者设置了 <i>回复</i> 可见</span>';
this.$button = this.querySelector('i'); this.$button = this.querySelector('i');
const $comment = document.querySelector('.joe_comment'); const $comment = document.querySelector('.joe_comment');
const $header = document.querySelector('.joe_header'); const $header = document.querySelector('.joe_header');
if (!$comment || !$header) return; if (!$comment || !$header) return;
this.$button.addEventListener('click', () => { this.$button.addEventListener('click', () => {
const top = $comment.offsetTop - $header.offsetHeight - 15; const top = $comment.offsetTop - $header.offsetHeight - 15;
window.scrollTo({ top, behavior: 'smooth' }); window.scrollTo({ top, behavior: 'smooth' });
}); });
} }
} }
window.customElements.define('joe-hide', JoeHide); window.customElements.define('joe-hide', JoeHide);
class JoeCardDefault extends HTMLElement { class JoeCardDefault extends HTMLElement {
constructor() { constructor() {
super(); super();
const _temp = this.querySelector('._temp'); const _temp = this.querySelector('._temp');
this.options = { this.options = {
width: this.getAttribute('width') || '100%', width: this.getAttribute('width') || '100%',
label: this.getAttribute('label') || '卡片标题', label: this.getAttribute('label') || '卡片标题',
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '卡片内容' content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '卡片内容'
}; };
const htmlStr = ` const htmlStr = `
<span class="joe_detail__article-card_default" style="width: ${this.options.width}"> <span class="joe_detail__article-card_default" style="width: ${this.options.width}">
<span class="title">${this.options.label}</span> <span class="title">${this.options.label}</span>
<span class="content">${this.options.content}</span> <span class="content">${this.options.content}</span>
</span> </span>
`; `;
if (this.querySelector('._content')) { if (this.querySelector('._content')) {
this.querySelector('._content').innerHTML = htmlStr; this.querySelector('._content').innerHTML = htmlStr;
} else { } else {
const div = document.createElement('div'); const span = document.createElement('span');
div.className = '_content'; span.style.display = 'block';
div.innerHTML = htmlStr; span.className = '_content';
this.appendChild(div); span.innerHTML = htmlStr;
} this.appendChild(span);
} }
} }
window.customElements.define('joe-card-default', JoeCardDefault); }
class JoeMessage extends HTMLElement { window.customElements.define('joe-card-default', JoeCardDefault);
constructor() { class JoeMessage extends HTMLElement {
super(); constructor() {
this.options = { super();
type: /^success$|^info$|^warning$|^error$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'info', this.options = {
content: this.getAttribute('content') || '消息内容' type: /^success$|^info$|^warning$|^error$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'info',
}; content: this.getAttribute('content') || '消息内容'
this.innerHTML = ` };
this.innerHTML = `
<span class="joe_detail__article-message ${this.options.type}"> <span class="joe_detail__article-message ${this.options.type}">
<span class="icon"></span> <span class="icon"></span>
<span class="content">${this.options.content}</span> <span class="content">${this.options.content}</span>
</span> </span>
`; `;
} }
} }
window.customElements.define('joe-message', JoeMessage); window.customElements.define('joe-message', JoeMessage);
class JoeProgress extends HTMLElement { class JoeProgress extends HTMLElement {
constructor() { constructor() {
super(); super();
this.options = { this.options = {
percentage: /^\d{1,3}%$/.test(this.getAttribute('percentage')) ? this.getAttribute('percentage') : '50%', percentage: /^\d{1,3}%$/.test(this.getAttribute('percentage')) ? this.getAttribute('percentage') : '50%',
color: this.getAttribute('color') || '#ff6c6c' color: this.getAttribute('color') || '#ff6c6c'
}; };
this.innerHTML = ` this.innerHTML = `
<span class="joe_detail__article-progress"> <span class="joe_detail__article-progress">
<span class="strip"> <span class="strip">
<span class="percent" style="width: ${this.options.percentage}; background: ${this.options.color};"></span> <span class="percent" style="width: ${this.options.percentage}; background: ${this.options.color};"></span>
@ -244,60 +245,102 @@ document.addEventListener('DOMContentLoaded', () => {
<span class="percentage">${this.options.percentage}</span> <span class="percentage">${this.options.percentage}</span>
</span> </span>
`; `;
} }
} }
window.customElements.define('joe-progress', JoeProgress); window.customElements.define('joe-progress', JoeProgress);
class JoeCallout extends HTMLElement { class JoeCallout extends HTMLElement {
constructor() { constructor() {
super(); super();
const _temp = this.querySelector('._temp'); const _temp = this.querySelector('._temp');
this.options = { this.options = {
color: this.getAttribute('color') || '#f0ad4e', color: this.getAttribute('color') || '#f0ad4e',
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '标注内容' content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '标注内容'
}; };
const htmlStr = ` const htmlStr = `
<span class="joe_detail__article-callout" style="border-left-color: ${this.options.color};"> <span class="joe_detail__article-callout" style="border-left-color: ${this.options.color};">
${this.options.content} ${this.options.content}
</span> </span>
`; `;
if (this.querySelector('._content')) { if (this.querySelector('._content')) {
this.querySelector('._content').innerHTML = htmlStr; this.querySelector('._content').innerHTML = htmlStr;
} else { } else {
const div = document.createElement('div'); const span = document.createElement('span');
div.className = '_content'; span.style.display = 'block';
div.innerHTML = htmlStr; span.className = '_content';
this.appendChild(div); span.innerHTML = htmlStr;
} this.appendChild(span);
} }
} }
window.customElements.define('joe-callout', JoeCallout); }
window.customElements.define('joe-callout', JoeCallout);
class JoeTabs extends HTMLElement {
constructor() {
super();
const _temp = this.querySelector('._temp');
let _innerHTML = _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '');
let navs = '';
let contents = '';
_innerHTML.replace(/{tabs-pane([^}]*)}([\s\S]*?){\/tabs-pane}/g, function ($0, $1, $2) {
navs += `<div class="item" ${$1}></div>`;
contents += `<div style="display: none" class="item" ${$1}>${$2.trim().replace(/^(<br>)|(<br>)$/g, '')}</div>`;
});
let htmlStr = `
<span class="joe_detail__article-tabs">
<div class="heads">${navs}</div>
<div class="bodys">${contents}</div>
</span>
`;
if (this.querySelector('._content')) {
this.querySelector('._content').innerHTML = htmlStr;
} else {
const span = document.createElement('span');
span.className = '_content';
span.style.display = 'block';
span.innerHTML = htmlStr;
this.appendChild(span);
}
this.querySelectorAll('.heads .item').forEach((item, index) => {
const label = item.getAttribute('label');
item.innerHTML = label;
item.addEventListener('click', () => {
this.querySelectorAll('.heads .item').forEach(_item => _item.classList.remove('active'));
this.querySelectorAll('.bodys .item').forEach(_item => (_item.style.display = 'none'));
if (this.querySelector(`.bodys .item[label="${label}"]`)) {
this.querySelector(`.bodys .item[label="${label}"]`).style.display = 'block';
}
item.classList.add('active');
});
if (index === 0) item.click();
});
}
}
window.customElements.define('joe-tabs', JoeTabs);
$('.joe_detail__article p:empty').remove();
/*
/*
------------------------以下未测试------------------------------------------ ------------------------以下未测试------------------------------------------
*/ */
/* 点击复制 */ /* 点击复制 */
class JoeCopy extends HTMLElement { class JoeCopy extends HTMLElement {
constructor() { constructor() {
super(); super();
this.options = { this.options = {
text: this.getAttribute('text') || '默认文本', text: this.getAttribulte('text') || '默认文本',
content: this.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '点击复制' content: this.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '点击复制'
}; };
this.render(); this.render();
} }
get template() { get template() {
return `<span class="joe_detail__article-copy">${this.options.content}</span>`; return `<span class="joe_detail__article-copy">${this.options.content}</span>`;
} }
render() { render() {
this.innerHTML = this.template; this.innerHTML = this.template;
this.event(); this.event();
} }
event() { event() {
this.$copy = this.querySelector('.joe_detail__article-copy'); this.$copy = this.querySelector('.joe_detail__article-copy');
new ClipboardJS(this.$copy, { text: () => this.options.text }).on('success', () => Qmsg.success('复制成功!')); new ClipboardJS(this.$copy, { text: () => this.options.text }).on('success', () => Qmsg.success('复制成功!'));
} }
} }
window.customElements.define('joe-copy', JoeCopy); window.customElements.define('joe-copy', JoeCopy);
}); });

File diff suppressed because one or more lines are too long

View File

@ -50,7 +50,7 @@ class Editor
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/prismjs@1.23.0/themes/prism-tomorrow.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=2021042210') ?>"> <link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=2021042215') ?>">
<script> <script>
window.JoeConfig = { window.JoeConfig = {
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>', uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
@ -65,9 +65,9 @@ class Editor
</script> </script>
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.2.4/plugin/prism/prism.min.js"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=2021042210') ?>"></script> <script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=2021042215') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=2021042210') ?>"></script> <script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=2021042215') ?>"></script>
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=2021042210') ?>"></script> <script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=2021042215') ?>"></script>
<?php <?php
} }
} }

View File

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

View File

@ -58,6 +58,9 @@ function _parseContent($post, $login)
if (strpos($content, '{callout') !== false) { if (strpos($content, '{callout') !== false) {
$content = preg_replace('/{callout([^}]*)}([\s\S]*?){\/callout}/', '<section style="margin-bottom: 15px"><joe-callout $1><span class="_temp" style="display: none">$2</span></joe-callout></section>', $content); $content = preg_replace('/{callout([^}]*)}([\s\S]*?){\/callout}/', '<section style="margin-bottom: 15px"><joe-callout $1><span class="_temp" style="display: none">$2</span></joe-callout></section>', $content);
} }
if (strpos($content, '{tabs') !== false) {
$content = preg_replace('/{tabs}([\s\S]*?){\/tabs}/', '<section style="margin-bottom: 15px"><joe-tabs><span class="_temp" style="display: none">$1</span></joe-tabs></section>', $content);
}

View File

@ -1,6 +1,6 @@
{ {
"name": "typecho-joe-next", "name": "typecho-joe-next",
"version": "6.5.5", "version": "6.5.6",
"description": "A Theme Of Typecho", "description": "A Theme Of Typecho",
"main": "index.php", "main": "index.php",
"keywords": [ "keywords": [

View File

@ -18,7 +18,7 @@
<?php endif; ?> <?php endif; ?>
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.mode.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.normalize.min.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=2021042208'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css?v=2021042215'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.responsive.min.css'); ?>">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/qmsg/qmsg.css"> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/qmsg/qmsg.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" />
@ -40,6 +40,6 @@
<?php if ($this->options->JCursorEffects && $this->options->JCursorEffects !== 'off') : ?> <?php if ($this->options->JCursorEffects && $this->options->JCursorEffects !== 'off') : ?>
<script src="<?php $this->options->themeUrl('assets/cursor/' . $this->options->JCursorEffects); ?>" async></script> <script src="<?php $this->options->themeUrl('assets/cursor/' . $this->options->JCursorEffects); ?>" async></script>
<?php endif; ?> <?php endif; ?>
<script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=2021042208'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js?v=2021042215'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=2021042208'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=2021042215'); ?>"></script>
<?php $this->options->JCustomHeadEnd() ?> <?php $this->options->JCustomHeadEnd() ?>

File diff suppressed because one or more lines are too long

View File

@ -940,6 +940,60 @@ body.fullscreen {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
} }
.joe_detail__article-tabs {
display: block;
width: 100%;
overflow: hidden;
background: #fff;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
border: 1px solid #ebeef5;
border-radius: 4px;
.heads {
width: 100%;
overflow-x: auto;
overflow-y: hidden;
display: flex;
background: #f2f6fc;
.item {
position: relative;
padding: 0 15px;
line-height: 40px;
height: 40px;
color: #909399;
cursor: pointer;
transition: color 0.5s;
white-space: nowrap;
&::after {
content: '';
position: absolute;
background: #409eff;
bottom: 0;
left: 15px;
right: 15px;
height: 2px;
opacity: 0;
border-radius: 2px;
transform: scaleX(0.5);
transition: opacity 0.25s, transform 0.25s;
}
&.active {
color: #409eff;
&::after {
opacity: 1;
transform: scaleX(1);
}
}
}
}
.bodys {
.item {
padding: 15px;
*:last-child {
margin-bottom: 0 !important;
}
}
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
.cm-modal__wrapper { .cm-modal__wrapper {

View File

@ -720,4 +720,9 @@ export default class JoeAction {
} }
}); });
} }
handleTabs(cm) {
const str = `${this._getLineCh(cm) ? '\n\n' : '\n'}{tabs}\n{tabs-pane label="标签一"}\n 标签一内容\n{/tabs-pane}\n{tabs-pane label="标签二"}\n 标签二内容\n{/tabs-pane}\n{/tabs}\n\n`;
this._replaceSelection(cm, str);
cm.focus();
}
} }

View File

@ -32,6 +32,7 @@ export default function createPreviewHtml(str) {
str = str.replace(/{hide[^}]*}([\s\S]*?){\/hide}/g, '<joe-hide></joe-hide>'); str = str.replace(/{hide[^}]*}([\s\S]*?){\/hide}/g, '<joe-hide></joe-hide>');
str = str.replace(/{card-default([^}]*)}([\s\S]*?){\/card-default}/g, '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>'); str = str.replace(/{card-default([^}]*)}([\s\S]*?){\/card-default}/g, '<section style="margin-bottom: 15px"><joe-card-default $1><span class="_temp" style="display: none">$2</span></joe-card-default></section>');
str = str.replace(/{callout([^}]*)}([\s\S]*?){\/callout}/g, '<section style="margin-bottom: 15px"><joe-callout $1><span class="_temp" style="display: none">$2</span></joe-callout></section>'); str = str.replace(/{callout([^}]*)}([\s\S]*?){\/callout}/g, '<section style="margin-bottom: 15px"><joe-callout $1><span class="_temp" style="display: none">$2</span></joe-callout></section>');
str = str.replace(/{tabs}([\s\S]*?){\/tabs}/g, '<section style="margin-bottom: 15px"><joe-tabs><span class="_temp" style="display: none">$1</span></joe-tabs></section>');
$('.cm-preview-content').html(str); $('.cm-preview-content').html(str);
$('.cm-preview-content p:empty').remove(); $('.cm-preview-content p:empty').remove();

View File

@ -185,6 +185,11 @@ export default [
title: '外部音乐', title: '外部音乐',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M736 249.6c-12.8-6.4-32-6.4-44.8 6.4-12.8 12.8-6.4 32 6.4 44.8C761.6 352 800 428.8 800 512c0 76.8-32 153.6-89.6 204.8-12.8 12.8-12.8 32 0 44.8 12.8 12.8 32 12.8 44.8 0C825.6 697.6 864 608 864 512c-6.4-102.4-51.2-198.4-128-262.4z"/><path d="M640 345.6c-12.8-6.4-32-6.4-44.8 6.4-12.8 12.8-6.4 32 6.4 44.8 38.4 25.6 57.6 70.4 57.6 115.2s-19.2 83.2-44.8 108.8c-12.8 12.8-12.8 32 0 44.8 12.8 12.8 32 12.8 44.8 0 44.8-38.4 64-96 64-153.6-6.4-64-38.4-128-83.2-166.4zM499.2 211.2L288 345.6H185.6c-12.8 0-19.2 6.4-19.2 19.2v313.6c0 12.8 12.8 25.6 19.2 25.6H288l211.2 115.2H512c12.8 0 19.2-6.4 19.2-19.2V230.4c0-6.4 0-6.4-6.4-12.8 0-6.4-19.2-12.8-25.6-6.4z"/></svg>' innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M736 249.6c-12.8-6.4-32-6.4-44.8 6.4-12.8 12.8-6.4 32 6.4 44.8C761.6 352 800 428.8 800 512c0 76.8-32 153.6-89.6 204.8-12.8 12.8-12.8 32 0 44.8 12.8 12.8 32 12.8 44.8 0C825.6 697.6 864 608 864 512c-6.4-102.4-51.2-198.4-128-262.4z"/><path d="M640 345.6c-12.8-6.4-32-6.4-44.8 6.4-12.8 12.8-6.4 32 6.4 44.8 38.4 25.6 57.6 70.4 57.6 115.2s-19.2 83.2-44.8 108.8c-12.8 12.8-12.8 32 0 44.8 12.8 12.8 32 12.8 44.8 0 44.8-38.4 64-96 64-153.6-6.4-64-38.4-128-83.2-166.4zM499.2 211.2L288 345.6H185.6c-12.8 0-19.2 6.4-19.2 19.2v313.6c0 12.8 12.8 25.6 19.2 25.6H288l211.2 115.2H512c12.8 0 19.2-6.4 19.2-19.2V230.4c0-6.4 0-6.4-6.4-12.8 0-6.4-19.2-12.8-25.6-6.4z"/></svg>'
}, },
{
type: 'tabs',
title: '标签页',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M904 788c4.31 0 7.853 2.735 8 6.12v63.548c0 3.412-3.455 6.216-7.732 6.33L904 864H120c-4.31 0-7.853-2.735-8-6.12v-63.548c0-3.412 3.455-6.216 7.732-6.33L120 788h784zm0-192c4.31 0 7.853 2.735 8 6.12v63.548c0 3.412-3.455 6.216-7.732 6.33L904 672H120c-4.31 0-7.853-2.735-8-6.12v-63.548c0-3.412 3.455-6.216 7.732-6.33L120 596h784zm-8-436c8.837 0 16 7.163 16 16v288c0 8.837-7.163 16-16 16H608c-8.837 0-16-7.163-16-16V176c0-8.837 7.163-16 16-16h288zm-384 0c8.695 0 15.828 7.03 16 15.686V464c0 8.695-7.03 15.828-15.686 16H128c-8.695 0-15.828-7.03-16-15.686V176c0-8.695 7.03-15.828 15.686-16H512zm-56 72H184v176h272V232z"/></svg>'
},
/* --------------------------- 短代码结束 --------------------------- */ /* --------------------------- 短代码结束 --------------------------- */
{ {
type: 'clean', type: 'clean',

File diff suppressed because one or more lines are too long

View File

@ -312,6 +312,9 @@ class Joe extends JoeAction {
case 'mp3': case 'mp3':
super.handleMp3(this.cm); super.handleMp3(this.cm);
break; break;
case 'tabs':
super.handleTabs(this.cm);
break;
case 'preview': case 'preview':
el.toggleClass('active'); el.toggleClass('active');
if (el.hasClass('active')) window.JoeConfig.canPreview = true; if (el.hasClass('active')) window.JoeConfig.canPreview = true;