This commit is contained in:
杜恒 2021-04-02 13:09:15 +08:00
parent 523107075d
commit 4916bebac2
20 changed files with 14645 additions and 120 deletions

File diff suppressed because one or more lines are too long

View File

@ -1964,7 +1964,7 @@
.text { .text {
position: relative; position: relative;
color: var(--minor); color: var(--minor);
padding: 0 15px; padding: 0 12px;
transition: padding 0.35s; transition: padding 0.35s;
&:hover { &:hover {
padding: 0; padding: 0;

View File

@ -18,7 +18,6 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.customElements.define('joe-mlist', JoeMlist); window.customElements.define('joe-mlist', JoeMlist);
class JoeMusic extends HTMLElement { class JoeMusic extends HTMLElement {
constructor() { constructor() {
super(); super();
@ -38,7 +37,6 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.customElements.define('joe-music', JoeMusic); window.customElements.define('joe-music', JoeMusic);
class JoeBilibili extends HTMLElement { class JoeBilibili extends HTMLElement {
constructor() { constructor() {
super(); super();
@ -56,7 +54,6 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.customElements.define('joe-bilibili', JoeBilibili); window.customElements.define('joe-bilibili', JoeBilibili);
class JoeDplayer extends HTMLElement { class JoeDplayer extends HTMLElement {
constructor() { constructor() {
super(); super();
@ -75,12 +72,22 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.customElements.define('joe-dplayer', JoeDplayer); window.customElements.define('joe-dplayer', JoeDplayer);
class JoeMtitle extends HTMLElement {
constructor() {
super();
this.options = {
title: this.getAttribute('title') || '默认标题'
};
this.innerHTML = this.template;
}
get template() {
return `<div class="joe_detail__article-mtitle"><span class="text">${this.options.title}</span></div>`;
}
}
window.customElements.define('joe-mtitle', JoeMtitle);
/* 便条按钮 */ /* 便条按钮 */
class JoeAnote extends HTMLElement { class JoeAnote extends HTMLElement {
constructor() { constructor() {
@ -130,28 +137,6 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.customElements.define('joe-abtn', JoeAbtn); window.customElements.define('joe-abtn', JoeAbtn);
/* 居中标题 */
class JoeMtitle extends HTMLElement {
constructor() {
super();
this.options = {
content: this.innerHTML.trim().replace(/^(<br>)|(<br>)$/g, '') || '居中标题'
};
this.render();
}
get template() {
return `
<div class="joe_detail__article-mtitle">
<span class="text">${this.options.content}</span>
</div>
`;
}
render() {
this.innerHTML = this.template;
}
}
window.customElements.define('joe-mtitle', JoeMtitle);
/* 点击复制 */ /* 点击复制 */
class JoeCopy extends HTMLElement { class JoeCopy extends HTMLElement {
constructor() { constructor() {

File diff suppressed because one or more lines are too long

View File

@ -55,9 +55,9 @@ class Editor
} }
</script> </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.short.min.js') ?>"></script> <script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.short.min.js?v=20210402') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js') ?>"></script> <script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=20210402') ?>"></script>
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js') ?>"></script> <script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=20210402') ?>"></script>
<?php <?php
} }
} }

View File

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

View File

@ -22,6 +22,9 @@ function _parseContent($post, $login)
$player = Helper::options()->JCustomPlayer ? Helper::options()->JCustomPlayer : Helper::options()->themeUrl . '/library/player.php?url='; $player = Helper::options()->JCustomPlayer ? Helper::options()->JCustomPlayer : Helper::options()->themeUrl . '/library/player.php?url=';
$content = preg_replace('/{dplayer([^}]*)\/}/SU', '<joe-dplayer player="' . $player . '" $1></joe-dplayer>', $content); $content = preg_replace('/{dplayer([^}]*)\/}/SU', '<joe-dplayer player="' . $player . '" $1></joe-dplayer>', $content);
} }
if (strpos($content, '{mtitle') !== false) {
$content = preg_replace('/{mtitle([^}]*)\/}/SU', '<joe-mtitle $1></joe-mtitle>', $content);
}
@ -46,13 +49,7 @@ function _parseContent($post, $login)
$content = preg_replace('/{copy(.*)}/SU', '<joe-copy $1>', $content); $content = preg_replace('/{copy(.*)}/SU', '<joe-copy $1>', $content);
$content = preg_replace('/{\/copy}/SU', '</joe-copy>', $content); $content = preg_replace('/{\/copy}/SU', '</joe-copy>', $content);
} }
/* 过滤居中标题 */
if (strpos($content, '{mtitle') !== false) {
$content = strtr($content, array(
"{mtitle}" => '<joe-mtitle>',
"{/mtitle}" => '</joe-mtitle>'
));
}
/* 过滤消息提示 */ /* 过滤消息提示 */
if (strpos($content, '{message') !== false) { if (strpos($content, '{message') !== false) {
$content = preg_replace('/{message(.*)}/SU', '<joe-message $1>', $content); $content = preg_replace('/{message(.*)}/SU', '<joe-message $1>', $content);

View File

@ -1,6 +1,6 @@
{ {
"name": "typecho-joe-next", "name": "typecho-joe-next",
"version": "6.3.1", "version": "6.3.2",
"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=6.1.7'); ?>"> <link rel="stylesheet" href="<?php $this->options->themeUrl('assets/css/joe.global.min.css'); ?>">
<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">
<?php if ($this->options->JAside_Weather_Key) : ?> <?php if ($this->options->JAside_Weather_Key) : ?>
@ -42,5 +42,5 @@
<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'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.global.min.js'); ?>"></script>
<script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js'); ?>"></script> <script src="<?php $this->options->themeUrl('assets/js/joe.short.min.js?v=20210402'); ?>"></script>
<?php $this->options->JCustomHeadEnd() ?> <?php $this->options->JCustomHeadEnd() ?>

File diff suppressed because one or more lines are too long

View File

@ -653,6 +653,32 @@ body.fullscreen {
} }
} }
.joe_detail__article-mtitle {
display: flex;
justify-content: center;
.text {
position: relative;
color: #909399;
padding: 0 12px;
transition: padding 0.35s;
&::before,
&::after {
content: '';
position: absolute;
top: 50%;
width: 20px;
height: 1px;
background: #409eff;
}
&::before {
left: -35px;
}
&::after {
right: -35px;
}
}
}
@media (max-width: 768px) { @media (max-width: 768px) {
.cm-modal__wrapper { .cm-modal__wrapper {
width: 90%; width: 90%;

View File

@ -372,7 +372,7 @@ export default class JoeAction {
const id = $(".cm-modal input[name='id']").val(); const id = $(".cm-modal input[name='id']").val();
const width = $(".cm-modal input[name='width']").val() || '100%'; const width = $(".cm-modal input[name='width']").val() || '100%';
const autoplay = $(".cm-modal select[name='autoplay']").val(); const autoplay = $(".cm-modal select[name='autoplay']").val();
const str = `{${type ? 'music-list' : 'music'} id="${id}" width="${width}" ${autoplay === '1' ? 'autoplay="autoplay"' : ''}/}\n`; const str = `\n{${type ? 'music-list' : 'music'} id="${id}" width="${width}" ${autoplay === '1' ? 'autoplay="autoplay"' : ''}/}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str); if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str); else this._replaceSelection(cm, str);
cm.focus(); cm.focus();
@ -390,7 +390,7 @@ export default class JoeAction {
`, `,
confirm: () => { confirm: () => {
const bvid = $(".cm-modal input[name='bvid']").val(); const bvid = $(".cm-modal input[name='bvid']").val();
const str = `{bilibili bvid="${bvid}"/}\n`; const str = `\n{bilibili bvid="${bvid}"/}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str); if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str); else this._replaceSelection(cm, str);
cm.focus(); cm.focus();
@ -408,7 +408,7 @@ export default class JoeAction {
`, `,
confirm: () => { confirm: () => {
const src = $(".cm-modal input[name='src']").val(); const src = $(".cm-modal input[name='src']").val();
const str = `{dplayer src="${src}"/}\n`; const str = `\n{dplayer src="${src}"/}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str); if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str); else this._replaceSelection(cm, str);
cm.focus(); cm.focus();
@ -453,4 +453,22 @@ export default class JoeAction {
} }
}); });
} }
handleMtitle(cm) {
this._openModal({
title: '居中标题',
innerHtml: `
<div class="fitem">
<label>标题内容</label>
<input autocomplete="off" maxlength="10" name="text" placeholder="请输入标题内容10字以内"/>
</div>
`,
confirm: () => {
const text = $(".cm-modal input[name='text']").val();
const str = `\n{mtitle title="${text}"/}\n\n`;
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
else this._replaceSelection(cm, str);
cm.focus();
}
});
}
} }

View File

@ -23,6 +23,9 @@ export default function createPreviewHtml(str) {
/* dplayer */ /* dplayer */
str = str.replace(/{dplayer([^}]*)\/}/g, '<joe-dplayer player="' + player + '" $1></joe-dplayer>'); str = str.replace(/{dplayer([^}]*)\/}/g, '<joe-dplayer player="' + player + '" $1></joe-dplayer>');
/* mtitle */
str = str.replace(/{mtitle([^}]*)\/}/g, '<joe-mtitle $1></joe-mtitle>');
/* 表情 */ /* 表情 */
str = str.replace(/\:\:\(\s*(呵呵|哈哈|吐舌|太开心|笑眼|花心|小乖|乖|捂嘴笑|滑稽|你懂的|不高兴|怒|汗|黑线|泪|真棒|喷|惊哭|阴险|鄙视|酷|啊|狂汗|what|疑问|酸爽|呀咩爹|委屈|惊讶|睡觉|笑尿|挖鼻|吐|犀利|小红脸|懒得理|勉强|爱心|心碎|玫瑰|礼物|彩虹|太阳|星星月亮|钱币|茶杯|蛋糕|大拇指|胜利|haha|OK|沙发|手纸|香蕉|便便|药丸|红领巾|蜡烛|音乐|灯泡|开心|钱|咦|呼|冷|生气|弱|吐血|狗头)\s*\)/g, function ($0, $1) { str = str.replace(/\:\:\(\s*(呵呵|哈哈|吐舌|太开心|笑眼|花心|小乖|乖|捂嘴笑|滑稽|你懂的|不高兴|怒|汗|黑线|泪|真棒|喷|惊哭|阴险|鄙视|酷|啊|狂汗|what|疑问|酸爽|呀咩爹|委屈|惊讶|睡觉|笑尿|挖鼻|吐|犀利|小红脸|懒得理|勉强|爱心|心碎|玫瑰|礼物|彩虹|太阳|星星月亮|钱币|茶杯|蛋糕|大拇指|胜利|haha|OK|沙发|手纸|香蕉|便便|药丸|红领巾|蜡烛|音乐|灯泡|开心|钱|咦|呼|冷|生气|弱|吐血|狗头)\s*\)/g, function ($0, $1) {
$1 = encodeURI($1).replace(/%/g, ''); $1 = encodeURI($1).replace(/%/g, '');

View File

@ -84,11 +84,21 @@ export default [
title: '符号表情', title: '符号表情',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="19" height="19"><path d="M512 56.889A455.111 455.111 0 0 0 56.889 512 455.111 455.111 0 0 0 512 967.111 455.111 455.111 0 0 0 967.111 512 455.111 455.111 0 0 0 512 56.889zm111.047 270.336A69.086 69.086 0 0 1 671.29 307.2c17.863 0 35.67 7.396 48.242 20.025 12.629 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zm-318.578 0a69.086 69.086 0 0 1 48.242-20.025c17.863 0 35.67 7.396 48.242 20.025 12.63 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zM786.375 566.67c-10.24 132.893-118.556 236.544-270.563 235.975-156.331 1.707-264.704-107.178-270.507-235.975a23.324 23.324 0 0 1-2.446-10.41c0-13.597 11.605-24.633 26.282-24.52h493.796c14.336 0 26.055 11.037 26.055 24.52a24.292 24.292 0 0 1-2.617 10.41z"/></svg>' innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="19" height="19"><path d="M512 56.889A455.111 455.111 0 0 0 56.889 512 455.111 455.111 0 0 0 512 967.111 455.111 455.111 0 0 0 967.111 512 455.111 455.111 0 0 0 512 56.889zm111.047 270.336A69.086 69.086 0 0 1 671.29 307.2c17.863 0 35.67 7.396 48.242 20.025 12.629 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zm-318.578 0a69.086 69.086 0 0 1 48.242-20.025c17.863 0 35.67 7.396 48.242 20.025 12.63 12.572 20.025 30.379 20.025 48.242 0 17.863-7.396 35.669-20.025 48.241-12.8 12.744-30.151 19.912-48.242 20.025a68.95 68.95 0 0 1-48.242-20.025 68.95 68.95 0 0 1-20.025-48.241c0-17.863 7.396-35.67 20.025-48.242zM786.375 566.67c-10.24 132.893-118.556 236.544-270.563 235.975-156.331 1.707-264.704-107.178-270.507-235.975a23.324 23.324 0 0 1-2.446-10.41c0-13.597 11.605-24.633 26.282-24.52h493.796c14.336 0 26.055 11.037 26.055 24.52a24.292 24.292 0 0 1-2.617 10.41z"/></svg>'
}, },
{
type: 'code-block',
title: '代码块',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M902.4 454.4l-144-144a40.704 40.704 0 0 0-57.6 57.6l144 144-144 144a40.704 40.704 0 0 0 57.6 57.6l144-144a81.472 81.472 0 0 0 0-115.2zm-636.8-144l-144 144a81.472 81.472 0 0 0 0 115.2l144 144a40.704 40.704 0 0 0 57.6-57.6l-144-144 144-144a40.704 40.704 0 0 0-57.6-57.6zm109.568 544.064l195.072-706.56a40.704 40.704 0 0 1 78.528 21.632l-195.072 706.56a40.704 40.704 0 0 1-78.528-21.696z" /></svg>'
},
{ {
type: 'expression', type: 'expression',
title: '图片表情', title: '图片表情',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M512 63.488q93.184 0 174.592 35.328t142.336 95.744 96.256 142.336 35.328 174.08q0 93.184-35.328 174.592t-96.256 142.336-142.336 96.256T512 959.488q-92.16 0-174.08-35.328t-142.336-96.256T99.84 685.568 64.512 510.976q0-92.16 35.328-174.08t95.744-142.336T337.92 98.816 512 63.488zM247.808 274.432q13.312 43.008 28.672 78.848 13.312 30.72 29.696 59.904t33.792 37.376q17.408 9.216 36.864 1.536t35.84-20.992q18.432-15.36 37.888-38.912zm501.76 537.6q8.192-3.072 12.8-8.192t6.144-11.264 1.536-11.776-1.024-7.68q-2.048-8.192-5.12-11.264-12.288-28.672-35.84-51.712t-56.32-39.936-73.728-26.112-88.064-9.216-89.6 10.24-76.288 28.672-57.856 43.008-33.28 53.248q-1.024 1.024-1.024 3.072-2.048 6.144 1.024 20.48t18.432 18.432q23.552-29.696 57.344-53.248 29.696-20.48 73.728-36.864t105.472-16.384 107.008 16.384 75.264 36.864q34.816 23.552 59.392 53.248zM680.96 450.56q17.408-8.192 33.792-37.376t29.696-59.904q15.36-35.84 28.672-78.848l-202.752 117.76q19.456 23.552 37.888 38.912 16.384 13.312 35.84 20.992t36.864-1.536z"/></svg>' innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M512 63.488q93.184 0 174.592 35.328t142.336 95.744 96.256 142.336 35.328 174.08q0 93.184-35.328 174.592t-96.256 142.336-142.336 96.256T512 959.488q-92.16 0-174.08-35.328t-142.336-96.256T99.84 685.568 64.512 510.976q0-92.16 35.328-174.08t95.744-142.336T337.92 98.816 512 63.488zM247.808 274.432q13.312 43.008 28.672 78.848 13.312 30.72 29.696 59.904t33.792 37.376q17.408 9.216 36.864 1.536t35.84-20.992q18.432-15.36 37.888-38.912zm501.76 537.6q8.192-3.072 12.8-8.192t6.144-11.264 1.536-11.776-1.024-7.68q-2.048-8.192-5.12-11.264-12.288-28.672-35.84-51.712t-56.32-39.936-73.728-26.112-88.064-9.216-89.6 10.24-76.288 28.672-57.856 43.008-33.28 53.248q-1.024 1.024-1.024 3.072-2.048 6.144 1.024 20.48t18.432 18.432q23.552-29.696 57.344-53.248 29.696-20.48 73.728-36.864t105.472-16.384 107.008 16.384 75.264 36.864q34.816 23.552 59.392 53.248zM680.96 450.56q17.408-8.192 33.792-37.376t29.696-59.904q15.36-35.84 28.672-78.848l-202.752 117.76q19.456 23.552 37.888 38.912 16.384 13.312 35.84 20.992t36.864-1.536z"/></svg>'
}, },
{
type: 'mtitle',
title: '居中标题',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M967.1 455.3H672.2c-23.5-66.1-86-113.8-160.2-113.8s-136.7 47.6-160.2 113.8H56.9C25.5 455.3 0 480.7 0 512.2c0 31.4 25.5 56.9 56.9 56.9h294.9c23.5 66.1 86 113.8 160.2 113.8s136.7-47.6 160.2-113.8h294.9c31.4 0 56.9-25.5 56.9-56.9 0-31.5-25.5-56.9-56.9-56.9zM512 569.1c-31.4 0-56.9-25.5-56.9-56.9s25.5-56.9 56.9-56.9 56.9 25.5 56.9 56.9c0 31.3-25.5 56.9-56.9 56.9z"/></svg>'
},
{ {
type: 'task-no', type: 'task-no',
title: '任务 - 未完成', title: '任务 - 未完成',
@ -119,11 +129,6 @@ export default [
title: '哔哩哔哩视频', title: '哔哩哔哩视频',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18"><path d="M1023.488 344.064c-3.072-143.36-128-170.496-128-170.496s-97.28-.512-224.256-1.536l92.16-89.088s14.336-18.432-10.24-38.912-26.624-11.264-34.816-6.144c-7.68 5.632-117.76 113.664-137.216 133.12-50.176 0-102.4-.512-153.088-.512h17.92s-132.096-130.56-140.8-136.192-9.728-14.336-34.816 6.144c-24.576 20.48-10.24 38.912-10.24 38.912l94.208 91.648c-102.4 0-190.464.512-231.424 2.048C-9.728 210.944.512 344.064.512 344.064s1.536 285.696 0 429.568c14.336 144.384 125.44 167.424 125.44 167.424s44.032 1.024 76.8 1.024c3.072 9.216 6.144 54.272 56.32 54.272s56.32-54.272 56.32-54.272 369.152-1.536 399.872-1.536c1.536 15.872 9.216 57.344 59.904 56.32 50.176-1.024 53.76-59.904 53.76-59.904s17.408-1.536 68.608 0C1017.344 914.944 1024 774.656 1024 774.656s-2.048-287.232-.512-430.592zM920.576 800.768c0 22.528-17.92 40.96-39.936 40.96H153.6c-22.016 0-39.936-18.432-39.936-40.96V318.464c0-22.528 17.92-40.96 39.936-40.96h727.04c22.016 0 39.936 18.432 39.936 40.96v482.304z"/><path d="M403.968 414.208l-214.016 40.96 18.432 80.384 211.456-40.96-15.872-80.384zm115.2 212.48c-52.224 112.128-99.328 27.648-99.328 27.648l-34.816 22.528s69.12 94.208 134.656 22.528c77.312 71.68 136.704-23.04 136.704-23.04l-31.744-20.48c0-.512-55.808 79.872-105.472-29.184zM624.64 494.08l211.968 40.96 17.92-80.384-213.504-40.96-16.384 80.384z"/></svg>' innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18"><path d="M1023.488 344.064c-3.072-143.36-128-170.496-128-170.496s-97.28-.512-224.256-1.536l92.16-89.088s14.336-18.432-10.24-38.912-26.624-11.264-34.816-6.144c-7.68 5.632-117.76 113.664-137.216 133.12-50.176 0-102.4-.512-153.088-.512h17.92s-132.096-130.56-140.8-136.192-9.728-14.336-34.816 6.144c-24.576 20.48-10.24 38.912-10.24 38.912l94.208 91.648c-102.4 0-190.464.512-231.424 2.048C-9.728 210.944.512 344.064.512 344.064s1.536 285.696 0 429.568c14.336 144.384 125.44 167.424 125.44 167.424s44.032 1.024 76.8 1.024c3.072 9.216 6.144 54.272 56.32 54.272s56.32-54.272 56.32-54.272 369.152-1.536 399.872-1.536c1.536 15.872 9.216 57.344 59.904 56.32 50.176-1.024 53.76-59.904 53.76-59.904s17.408-1.536 68.608 0C1017.344 914.944 1024 774.656 1024 774.656s-2.048-287.232-.512-430.592zM920.576 800.768c0 22.528-17.92 40.96-39.936 40.96H153.6c-22.016 0-39.936-18.432-39.936-40.96V318.464c0-22.528 17.92-40.96 39.936-40.96h727.04c22.016 0 39.936 18.432 39.936 40.96v482.304z"/><path d="M403.968 414.208l-214.016 40.96 18.432 80.384 211.456-40.96-15.872-80.384zm115.2 212.48c-52.224 112.128-99.328 27.648-99.328 27.648l-34.816 22.528s69.12 94.208 134.656 22.528c77.312 71.68 136.704-23.04 136.704-23.04l-31.744-20.48c0-.512-55.808 79.872-105.472-29.184zM624.64 494.08l211.968 40.96 17.92-80.384-213.504-40.96-16.384 80.384z"/></svg>'
}, },
{
type: 'code-block',
title: '代码块',
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M902.4 454.4l-144-144a40.704 40.704 0 0 0-57.6 57.6l144 144-144 144a40.704 40.704 0 0 0 57.6 57.6l144-144a81.472 81.472 0 0 0 0-115.2zm-636.8-144l-144 144a81.472 81.472 0 0 0 0 115.2l144 144a40.704 40.704 0 0 0 57.6-57.6l-144-144 144-144a40.704 40.704 0 0 0-57.6-57.6zm109.568 544.064l195.072-706.56a40.704 40.704 0 0 1 78.528 21.632l-195.072 706.56a40.704 40.704 0 0 1-78.528-21.696z" /></svg>'
},
{ {
type: 'time', type: 'time',
title: '当前时间', title: '当前时间',

View File

@ -67,7 +67,7 @@ document.addEventListener('DOMContentLoaded', () => {
this.render(); this.render();
} }
get template() { get template() {
return `<iframe allowfullscreen="true" class="joe_detail__article-player" style="display: block; margin: 0 auto; border: 0;" width="100%" height="180px" src="${this.options.player + this.options.src}"></iframe>` return `<iframe allowfullscreen="true" class="joe_detail__article-player" style="display: block; margin: 0 auto; border: 0;" width="100%" height="180px" src="${this.options.player + this.options.src}"></iframe>`;
} }
render() { render() {
if (this.options.src) this.innerHTML = this.template; if (this.options.src) this.innerHTML = this.template;
@ -75,4 +75,18 @@ document.addEventListener('DOMContentLoaded', () => {
} }
} }
window.customElements.define('joe-dplayer', JoeDplayer); window.customElements.define('joe-dplayer', JoeDplayer);
class JoeMtitle extends HTMLElement {
constructor() {
super();
this.options = {
title: this.getAttribute('title') || '默认标题'
};
this.innerHTML = this.template;
}
get template() {
return `<div class="joe_detail__article-mtitle"><span class="text">${this.options.title}</span></div>`;
}
}
window.customElements.define('joe-mtitle', JoeMtitle);
}); });

View File

@ -1 +1 @@
document.addEventListener("DOMContentLoaded",()=>{class t extends HTMLElement{constructor(){super(),this.options={id:this.getAttribute("id"),width:this.getAttribute("width")||"100%",autoplay:this.getAttribute("autoplay")?1:0},this.render()}get template(){return`<iframe allowfullscreen="true" style="display: block; margin: 0 auto; border: 0;" width="${this.options.width}" height="450px" src="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430"></iframe>`}render(){this.options.id?this.innerHTML=this.template:this.innerHTML="网易云歌单ID未填写"}}window.customElements.define("joe-mlist",t);class e extends HTMLElement{constructor(){super(),this.options={id:this.getAttribute("id"),width:this.getAttribute("width")||"100%",autoplay:this.getAttribute("autoplay")?1:0},this.render()}get template(){return`<iframe allowfullscreen="true" style="display: block; margin: 0 auto; border: 0;" width="${this.options.width}" height="86px" src="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66"></iframe>`}render(){this.options.id?this.innerHTML=this.template:this.innerHTML="网易云歌曲ID未填写"}}window.customElements.define("joe-music",e);class i extends HTMLElement{constructor(){super(),this.options={bvid:this.getAttribute("bvid")},this.render()}get template(){return`<iframe allowfullscreen="true" class="joe_detail__article-player" style="display: block; margin: 0 auto; border: 0;" width="100%" height="180px" src="//player.bilibili.com/player.html?bvid=${this.options.bvid}"></iframe>`}render(){this.options.bvid?this.innerHTML=this.template:this.innerHTML="Bvid未填写"}}window.customElements.define("joe-bilibili",i);class s extends HTMLElement{constructor(){super(),this.options={src:this.getAttribute("src"),player:this.getAttribute("player")},this.render()}get template(){return`<iframe allowfullscreen="true" class="joe_detail__article-player" style="display: block; margin: 0 auto; border: 0;" width="100%" height="180px" src="${this.options.player+this.options.src}"></iframe>`}render(){this.options.src?this.innerHTML=this.template:this.innerHTML="播放地址未填写!"}}window.customElements.define("joe-dplayer",s)}); document.addEventListener("DOMContentLoaded",()=>{class t extends HTMLElement{constructor(){super(),this.options={id:this.getAttribute("id"),width:this.getAttribute("width")||"100%",autoplay:this.getAttribute("autoplay")?1:0},this.render()}get template(){return`<iframe allowfullscreen="true" style="display: block; margin: 0 auto; border: 0;" width="${this.options.width}" height="450px" src="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430"></iframe>`}render(){this.options.id?this.innerHTML=this.template:this.innerHTML="网易云歌单ID未填写"}}window.customElements.define("joe-mlist",t);class e extends HTMLElement{constructor(){super(),this.options={id:this.getAttribute("id"),width:this.getAttribute("width")||"100%",autoplay:this.getAttribute("autoplay")?1:0},this.render()}get template(){return`<iframe allowfullscreen="true" style="display: block; margin: 0 auto; border: 0;" width="${this.options.width}" height="86px" src="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66"></iframe>`}render(){this.options.id?this.innerHTML=this.template:this.innerHTML="网易云歌曲ID未填写"}}window.customElements.define("joe-music",e);class i extends HTMLElement{constructor(){super(),this.options={bvid:this.getAttribute("bvid")},this.render()}get template(){return`<iframe allowfullscreen="true" class="joe_detail__article-player" style="display: block; margin: 0 auto; border: 0;" width="100%" height="180px" src="//player.bilibili.com/player.html?bvid=${this.options.bvid}"></iframe>`}render(){this.options.bvid?this.innerHTML=this.template:this.innerHTML="Bvid未填写"}}window.customElements.define("joe-bilibili",i);class s extends HTMLElement{constructor(){super(),this.options={src:this.getAttribute("src"),player:this.getAttribute("player")},this.render()}get template(){return`<iframe allowfullscreen="true" class="joe_detail__article-player" style="display: block; margin: 0 auto; border: 0;" width="100%" height="180px" src="${this.options.player+this.options.src}"></iframe>`}render(){this.options.src?this.innerHTML=this.template:this.innerHTML="播放地址未填写!"}}window.customElements.define("joe-dplayer",s);class r extends HTMLElement{constructor(){super(),this.options={title:this.getAttribute("title")||"默认标题"},this.innerHTML=this.template}get template(){return`<div class="joe_detail__article-mtitle"><span class="text">${this.options.title}</span></div>`}}window.customElements.define("joe-mtitle",r)});

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,6 @@ import { classHighlightStyle } from '@codemirror/highlight';
import tools from './_tools'; import tools from './_tools';
import JoeAction from './_actions'; import JoeAction from './_actions';
import createPreviewHtml from './_create'; import createPreviewHtml from './_create';
class Joe extends JoeAction { class Joe extends JoeAction {
constructor() { constructor() {
super(); super();
@ -275,6 +274,9 @@ class Joe extends JoeAction {
case 'expression': case 'expression':
super.handleExpression(this.cm); super.handleExpression(this.cm);
break; break;
case 'mtitle':
super.handleMtitle(this.cm);
break;
} }
}); });
$('.cm-tools').append(el); $('.cm-tools').append(el);

View File

@ -1,47 +1,16 @@
{ {
"scripts": { "scripts": {
"serve": "rollup -c -w" "serve": "rollup -c -w"
}, },
"dependencies": { "dependencies": {
"@codemirror/autocomplete": "^0.18.3", "@codemirror/closebrackets": "^0.18.0",
"@codemirror/basic-setup": "^0.18.0", "@codemirror/commands": "^0.18.0",
"@codemirror/buildhelper": "^0.1.3", "@codemirror/highlight": "^0.18.3",
"@codemirror/closebrackets": "^0.18.0", "@codemirror/history": "^0.18.1",
"@codemirror/collab": "^0.18.1", "@codemirror/matchbrackets": "^0.18.0",
"@codemirror/commands": "^0.18.0", "@codemirror/state": "^0.18.3",
"@codemirror/comment": "^0.18.0", "@codemirror/view": "^0.18.3",
"@codemirror/fold": "^0.18.0", "@rollup/plugin-node-resolve": "^11.2.0",
"@codemirror/gutter": "^0.18.0", "rollup-plugin-uglify": "^6.0.4"
"@codemirror/highlight": "^0.18.3", }
"@codemirror/history": "^0.18.0",
"@codemirror/lang-cpp": "^0.18.0",
"@codemirror/lang-css": "^0.18.0",
"@codemirror/lang-html": "^0.18.0",
"@codemirror/lang-java": "^0.18.0",
"@codemirror/lang-javascript": "^0.18.0",
"@codemirror/lang-json": "^0.18.0",
"@codemirror/lang-lezer": "^0.18.0",
"@codemirror/lang-markdown": "^0.18.0",
"@codemirror/lang-python": "^0.18.0",
"@codemirror/lang-rust": "^0.18.0",
"@codemirror/lang-sql": "^0.18.0",
"@codemirror/lang-xml": "^0.18.0",
"@codemirror/language": "^0.18.0",
"@codemirror/language-data": "^0.18.0",
"@codemirror/legacy-modes": "^0.18.0",
"@codemirror/lint": "^0.18.1",
"@codemirror/matchbrackets": "^0.18.0",
"@codemirror/panel": "^0.18.1",
"@codemirror/rangeset": "^0.18.0",
"@codemirror/rectangular-selection": "^0.18.0",
"@codemirror/search": "^0.18.2",
"@codemirror/state": "^0.18.2",
"@codemirror/stream-parser": "^0.18.1",
"@codemirror/text": "^0.18.0",
"@codemirror/theme-one-dark": "^0.18.0",
"@codemirror/tooltip": "^0.18.4",
"@codemirror/view": "^0.18.3",
"@rollup/plugin-node-resolve": "^11.2.0",
"rollup-plugin-uglify": "^6.0.4"
}
} }

View File

@ -6,5 +6,5 @@ export default {
file: './js/joe.write.chunk.js', file: './js/joe.write.chunk.js',
format: 'iife' format: 'iife'
}, },
plugins: [nodeResolve(), uglify()] plugins: [nodeResolve()]
}; };