更新
This commit is contained in:
parent
88030a0b16
commit
593e236a02
2
assets/css/joe.global.min.css
vendored
2
assets/css/joe.global.min.css
vendored
File diff suppressed because one or more lines are too long
@ -2261,6 +2261,61 @@
|
||||
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 {
|
||||
|
@ -1,242 +1,243 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
$('.joe_detail__article p:empty').remove();
|
||||
|
||||
$('.joe_detail__article p:empty').remove();
|
||||
|
||||
class JoeMtitle extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.innerHTML = `
|
||||
class JoeMtitle extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.innerHTML = `
|
||||
<span class="joe_detail__article-mtitle">
|
||||
<span class="text">
|
||||
${this.getAttribute('title') || '默认标题'}
|
||||
</span>
|
||||
</span>`;
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-mtitle', JoeMtitle);
|
||||
class JoeDplayer extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
src: this.getAttribute('src'),
|
||||
player: this.getAttribute('player')
|
||||
};
|
||||
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>`;
|
||||
else this.innerHTML = '播放地址未填写!';
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-dplayer', JoeDplayer);
|
||||
class JoeBilibili extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
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>`;
|
||||
else this.innerHTML = 'Bvid未填写!';
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-bilibili', JoeBilibili);
|
||||
class JoeMp3 extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
name: this.getAttribute('name'),
|
||||
url: this.getAttribute('url'),
|
||||
theme: this.getAttribute('theme') || '#1989fa',
|
||||
cover: this.getAttribute('cover'),
|
||||
autoplay: this.getAttribute('autoplay') ? true : false
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
if (!this.options.url) return (this.innerHTML = '音频地址未填写!');
|
||||
this.innerHTML = '<span style="display: block"></span>';
|
||||
new APlayer({
|
||||
container: this.querySelector('span'),
|
||||
theme: this.options.theme,
|
||||
autoplay: this.options.autoplay,
|
||||
audio: [
|
||||
{
|
||||
url: this.options.url,
|
||||
name: this.options.name,
|
||||
cover: this.options.cover
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-mp3', JoeMp3);
|
||||
class JoeMusic extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
id: this.getAttribute('id'),
|
||||
color: this.getAttribute('color') || '#1989fa',
|
||||
autoplay: this.getAttribute('autoplay') ? true : false
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
if (!this.options.id) return (this.innerHTML = '网易云歌曲ID未填写!');
|
||||
this.innerHTML = '<span style="display: block"></span>';
|
||||
fetch('https://api.i-meto.com/meting/api?server=netease&type=song&id=' + this.options.id).then(async response => {
|
||||
const audio = await response.json();
|
||||
new APlayer({
|
||||
container: this.querySelector('span'),
|
||||
lrcType: 3,
|
||||
theme: this.options.color,
|
||||
autoplay: this.options.autoplay,
|
||||
audio
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-music', JoeMusic);
|
||||
class JoeMlist extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
id: this.getAttribute('id'),
|
||||
color: this.getAttribute('color') || '#1989fa',
|
||||
autoplay: this.getAttribute('autoplay') ? true : false
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
if (!this.options.id) return (this.innerHTML = '网易云歌单ID未填写!');
|
||||
this.innerHTML = '<span style="display: block"></span>';
|
||||
fetch('https://api.i-meto.com/meting/api?server=netease&type=playlist&id=' + this.options.id).then(async response => {
|
||||
const audio = await response.json();
|
||||
new APlayer({
|
||||
container: this.querySelector('span'),
|
||||
lrcType: 3,
|
||||
theme: this.options.color,
|
||||
autoplay: this.options.autoplay,
|
||||
audio
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-mlist', JoeMlist);
|
||||
class JoeAbtn extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
icon: this.getAttribute('icon') || '',
|
||||
color: this.getAttribute('color') || '#ff6800',
|
||||
href: this.getAttribute('href') || '#',
|
||||
radius: this.getAttribute('radius') || '17.5px',
|
||||
content: this.getAttribute('content') || '多彩按钮'
|
||||
};
|
||||
this.innerHTML = `
|
||||
</span>
|
||||
`;
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-mtitle', JoeMtitle);
|
||||
class JoeDplayer extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
src: this.getAttribute('src'),
|
||||
player: this.getAttribute('player')
|
||||
};
|
||||
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>`;
|
||||
else this.innerHTML = '播放地址未填写!';
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-dplayer', JoeDplayer);
|
||||
class JoeBilibili extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
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>`;
|
||||
else this.innerHTML = 'Bvid未填写!';
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-bilibili', JoeBilibili);
|
||||
class JoeMp3 extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
name: this.getAttribute('name'),
|
||||
url: this.getAttribute('url'),
|
||||
theme: this.getAttribute('theme') || '#1989fa',
|
||||
cover: this.getAttribute('cover'),
|
||||
autoplay: this.getAttribute('autoplay') ? true : false
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
if (!this.options.url) return (this.innerHTML = '音频地址未填写!');
|
||||
this.innerHTML = '<span style="display: block"></span>';
|
||||
new APlayer({
|
||||
container: this.querySelector('span'),
|
||||
theme: this.options.theme,
|
||||
autoplay: this.options.autoplay,
|
||||
audio: [
|
||||
{
|
||||
url: this.options.url,
|
||||
name: this.options.name,
|
||||
cover: this.options.cover
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-mp3', JoeMp3);
|
||||
class JoeMusic extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
id: this.getAttribute('id'),
|
||||
color: this.getAttribute('color') || '#1989fa',
|
||||
autoplay: this.getAttribute('autoplay') ? true : false
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
if (!this.options.id) return (this.innerHTML = '网易云歌曲ID未填写!');
|
||||
this.innerHTML = '<span style="display: block"></span>';
|
||||
fetch('https://api.i-meto.com/meting/api?server=netease&type=song&id=' + this.options.id).then(async response => {
|
||||
const audio = await response.json();
|
||||
new APlayer({
|
||||
container: this.querySelector('span'),
|
||||
lrcType: 3,
|
||||
theme: this.options.color,
|
||||
autoplay: this.options.autoplay,
|
||||
audio
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-music', JoeMusic);
|
||||
class JoeMlist extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
id: this.getAttribute('id'),
|
||||
color: this.getAttribute('color') || '#1989fa',
|
||||
autoplay: this.getAttribute('autoplay') ? true : false
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
if (!this.options.id) return (this.innerHTML = '网易云歌单ID未填写!');
|
||||
this.innerHTML = '<span style="display: block"></span>';
|
||||
fetch('https://api.i-meto.com/meting/api?server=netease&type=playlist&id=' + this.options.id).then(async response => {
|
||||
const audio = await response.json();
|
||||
new APlayer({
|
||||
container: this.querySelector('span'),
|
||||
lrcType: 3,
|
||||
theme: this.options.color,
|
||||
autoplay: this.options.autoplay,
|
||||
audio
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-mlist', JoeMlist);
|
||||
class JoeAbtn extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
icon: this.getAttribute('icon') || '',
|
||||
color: this.getAttribute('color') || '#ff6800',
|
||||
href: this.getAttribute('href') || '#',
|
||||
radius: this.getAttribute('radius') || '17.5px',
|
||||
content: this.getAttribute('content') || '多彩按钮'
|
||||
};
|
||||
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">
|
||||
<span class="icon"><i class="${this.options.icon} fa"></i></span><span class="content">${this.options.content}</span>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-abtn', JoeAbtn);
|
||||
class JoeAnote extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
icon: this.getAttribute('icon') || 'fa-download',
|
||||
href: this.getAttribute('href') || '#',
|
||||
type: /^secondary$|^success$|^warning$|^error$|^info$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'secondary',
|
||||
content: this.getAttribute('content') || '标签按钮'
|
||||
};
|
||||
this.innerHTML = `
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-abtn', JoeAbtn);
|
||||
class JoeAnote extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
icon: this.getAttribute('icon') || 'fa-download',
|
||||
href: this.getAttribute('href') || '#',
|
||||
type: /^secondary$|^success$|^warning$|^error$|^info$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'secondary',
|
||||
content: this.getAttribute('content') || '标签按钮'
|
||||
};
|
||||
this.innerHTML = `
|
||||
<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>
|
||||
</a>
|
||||
`;
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-anote', JoeAnote);
|
||||
class JoeDotted extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.startColor = this.getAttribute('startColor') || '#ff6c6c';
|
||||
this.endColor = this.getAttribute('endColor') || '#1989fa';
|
||||
this.innerHTML = `
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-anote', JoeAnote);
|
||||
class JoeDotted extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.startColor = this.getAttribute('startColor') || '#ff6c6c';
|
||||
this.endColor = this.getAttribute('endColor') || '#1989fa';
|
||||
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>
|
||||
`;
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-dotted', JoeDotted);
|
||||
class JoeHide extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
this.innerHTML = '<span class="joe_detail__article-hide">此处内容作者设置了 <i>回复</i> 可见</span>';
|
||||
this.$button = this.querySelector('i');
|
||||
const $comment = document.querySelector('.joe_comment');
|
||||
const $header = document.querySelector('.joe_header');
|
||||
if (!$comment || !$header) return;
|
||||
this.$button.addEventListener('click', () => {
|
||||
const top = $comment.offsetTop - $header.offsetHeight - 15;
|
||||
window.scrollTo({ top, behavior: 'smooth' });
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-hide', JoeHide);
|
||||
class JoeCardDefault extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
const _temp = this.querySelector('._temp');
|
||||
this.options = {
|
||||
width: this.getAttribute('width') || '100%',
|
||||
label: this.getAttribute('label') || '卡片标题',
|
||||
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '卡片内容'
|
||||
};
|
||||
const htmlStr = `
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-dotted', JoeDotted);
|
||||
class JoeHide extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.render();
|
||||
}
|
||||
render() {
|
||||
this.innerHTML = '<span class="joe_detail__article-hide">此处内容作者设置了 <i>回复</i> 可见</span>';
|
||||
this.$button = this.querySelector('i');
|
||||
const $comment = document.querySelector('.joe_comment');
|
||||
const $header = document.querySelector('.joe_header');
|
||||
if (!$comment || !$header) return;
|
||||
this.$button.addEventListener('click', () => {
|
||||
const top = $comment.offsetTop - $header.offsetHeight - 15;
|
||||
window.scrollTo({ top, behavior: 'smooth' });
|
||||
});
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-hide', JoeHide);
|
||||
class JoeCardDefault extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
const _temp = this.querySelector('._temp');
|
||||
this.options = {
|
||||
width: this.getAttribute('width') || '100%',
|
||||
label: this.getAttribute('label') || '卡片标题',
|
||||
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '卡片内容'
|
||||
};
|
||||
const htmlStr = `
|
||||
<span class="joe_detail__article-card_default" style="width: ${this.options.width}">
|
||||
<span class="title">${this.options.label}</span>
|
||||
<span class="content">${this.options.content}</span>
|
||||
</span>
|
||||
`;
|
||||
if (this.querySelector('._content')) {
|
||||
this.querySelector('._content').innerHTML = htmlStr;
|
||||
} else {
|
||||
const div = document.createElement('div');
|
||||
div.className = '_content';
|
||||
div.innerHTML = htmlStr;
|
||||
this.appendChild(div);
|
||||
}
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-card-default', JoeCardDefault);
|
||||
class JoeMessage extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
type: /^success$|^info$|^warning$|^error$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'info',
|
||||
content: this.getAttribute('content') || '消息内容'
|
||||
};
|
||||
this.innerHTML = `
|
||||
if (this.querySelector('._content')) {
|
||||
this.querySelector('._content').innerHTML = htmlStr;
|
||||
} else {
|
||||
const span = document.createElement('span');
|
||||
span.style.display = 'block';
|
||||
span.className = '_content';
|
||||
span.innerHTML = htmlStr;
|
||||
this.appendChild(span);
|
||||
}
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-card-default', JoeCardDefault);
|
||||
class JoeMessage extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
type: /^success$|^info$|^warning$|^error$/.test(this.getAttribute('type')) ? this.getAttribute('type') : 'info',
|
||||
content: this.getAttribute('content') || '消息内容'
|
||||
};
|
||||
this.innerHTML = `
|
||||
<span class="joe_detail__article-message ${this.options.type}">
|
||||
<span class="icon"></span>
|
||||
<span class="content">${this.options.content}</span>
|
||||
</span>
|
||||
`;
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-message', JoeMessage);
|
||||
class JoeProgress extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
percentage: /^\d{1,3}%$/.test(this.getAttribute('percentage')) ? this.getAttribute('percentage') : '50%',
|
||||
color: this.getAttribute('color') || '#ff6c6c'
|
||||
};
|
||||
this.innerHTML = `
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-message', JoeMessage);
|
||||
class JoeProgress extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
percentage: /^\d{1,3}%$/.test(this.getAttribute('percentage')) ? this.getAttribute('percentage') : '50%',
|
||||
color: this.getAttribute('color') || '#ff6c6c'
|
||||
};
|
||||
this.innerHTML = `
|
||||
<span class="joe_detail__article-progress">
|
||||
<span class="strip">
|
||||
<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>
|
||||
`;
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-progress', JoeProgress);
|
||||
class JoeCallout extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
const _temp = this.querySelector('._temp');
|
||||
this.options = {
|
||||
color: this.getAttribute('color') || '#f0ad4e',
|
||||
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '标注内容'
|
||||
};
|
||||
const htmlStr = `
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-progress', JoeProgress);
|
||||
class JoeCallout extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
const _temp = this.querySelector('._temp');
|
||||
this.options = {
|
||||
color: this.getAttribute('color') || '#f0ad4e',
|
||||
content: _temp.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '标注内容'
|
||||
};
|
||||
const htmlStr = `
|
||||
<span class="joe_detail__article-callout" style="border-left-color: ${this.options.color};">
|
||||
${this.options.content}
|
||||
</span>
|
||||
`;
|
||||
if (this.querySelector('._content')) {
|
||||
this.querySelector('._content').innerHTML = htmlStr;
|
||||
} else {
|
||||
const div = document.createElement('div');
|
||||
div.className = '_content';
|
||||
div.innerHTML = htmlStr;
|
||||
this.appendChild(div);
|
||||
}
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-callout', JoeCallout);
|
||||
if (this.querySelector('._content')) {
|
||||
this.querySelector('._content').innerHTML = htmlStr;
|
||||
} else {
|
||||
const span = document.createElement('span');
|
||||
span.style.display = 'block';
|
||||
span.className = '_content';
|
||||
span.innerHTML = htmlStr;
|
||||
this.appendChild(span);
|
||||
}
|
||||
}
|
||||
}
|
||||
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 {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
text: this.getAttribute('text') || '默认文本',
|
||||
content: this.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '点击复制'
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
get template() {
|
||||
return `<span class="joe_detail__article-copy">${this.options.content}</span>`;
|
||||
}
|
||||
render() {
|
||||
this.innerHTML = this.template;
|
||||
this.event();
|
||||
}
|
||||
event() {
|
||||
this.$copy = this.querySelector('.joe_detail__article-copy');
|
||||
new ClipboardJS(this.$copy, { text: () => this.options.text }).on('success', () => Qmsg.success('复制成功!'));
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-copy', JoeCopy);
|
||||
/* 点击复制 */
|
||||
class JoeCopy extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
text: this.getAttribulte('text') || '默认文本',
|
||||
content: this.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '点击复制'
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
get template() {
|
||||
return `<span class="joe_detail__article-copy">${this.options.content}</span>`;
|
||||
}
|
||||
render() {
|
||||
this.innerHTML = this.template;
|
||||
this.event();
|
||||
}
|
||||
event() {
|
||||
this.$copy = this.querySelector('.joe_detail__article-copy');
|
||||
new ClipboardJS(this.$copy, { text: () => this.options.text }).on('success', () => Qmsg.success('复制成功!'));
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-copy', JoeCopy);
|
||||
});
|
||||
|
2
assets/js/joe.short.min.js
vendored
2
assets/js/joe.short.min.js
vendored
File diff suppressed because one or more lines are too long
@ -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/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="<?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>
|
||||
window.JoeConfig = {
|
||||
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
|
||||
@ -65,9 +65,9 @@ class Editor
|
||||
</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="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=2021042210') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=2021042210') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.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=2021042215') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('assets/js/joe.short.min.js?v=2021042215') ?>"></script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* 获取主题当前版本号 */
|
||||
function _getVersion()
|
||||
{
|
||||
return "6.5.5";
|
||||
return "6.5.6";
|
||||
};
|
||||
|
||||
/* 判断是否是手机 */
|
||||
|
@ -58,6 +58,9 @@ function _parseContent($post, $login)
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "typecho-joe-next",
|
||||
"version": "6.5.5",
|
||||
"version": "6.5.6",
|
||||
"description": "A Theme Of Typecho",
|
||||
"main": "index.php",
|
||||
"keywords": [
|
||||
|
@ -18,7 +18,7 @@
|
||||
<?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.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="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" />
|
||||
@ -40,6 +40,6 @@
|
||||
<?php if ($this->options->JCursorEffects && $this->options->JCursorEffects !== 'off') : ?>
|
||||
<script src="<?php $this->options->themeUrl('assets/cursor/' . $this->options->JCursorEffects); ?>" async></script>
|
||||
<?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.short.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=2021042215'); ?>"></script>
|
||||
<?php $this->options->JCustomHeadEnd() ?>
|
2
typecho/write/css/joe.write.min.css
vendored
2
typecho/write/css/joe.write.min.css
vendored
File diff suppressed because one or more lines are too long
@ -940,6 +940,60 @@ body.fullscreen {
|
||||
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) {
|
||||
.cm-modal__wrapper {
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ export default function createPreviewHtml(str) {
|
||||
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(/{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 p:empty').remove();
|
||||
|
@ -185,6 +185,11 @@ export default [
|
||||
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>'
|
||||
},
|
||||
{
|
||||
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',
|
||||
|
File diff suppressed because one or more lines are too long
@ -312,6 +312,9 @@ class Joe extends JoeAction {
|
||||
case 'mp3':
|
||||
super.handleMp3(this.cm);
|
||||
break;
|
||||
case 'tabs':
|
||||
super.handleTabs(this.cm);
|
||||
break;
|
||||
case 'preview':
|
||||
el.toggleClass('active');
|
||||
if (el.hasClass('active')) window.JoeConfig.canPreview = true;
|
||||
|
Loading…
Reference in New Issue
Block a user