更新
This commit is contained in:
parent
f7699389e9
commit
e8ab5c4666
@ -1,5 +1,4 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
/* 网易云音乐 - 歌单 √ */
|
|
||||||
class JoeMlist extends HTMLElement {
|
class JoeMlist extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -11,21 +10,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
get template() {
|
get template() {
|
||||||
return `
|
return `<object style="display: block;margin: 0 auto;" width="${this.options.width}" height="450px" data="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430"></object>`;
|
||||||
<style>iframe {display: block;margin: 0 auto;border: none;}</style>
|
|
||||||
<iframe src="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430" width="${this.options.width}" height="450px"></iframe>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
this.innerHTML = '';
|
if (this.options.id) this.innerHTML = this.template;
|
||||||
this._shadowRoot = this.attachShadow({ mode: 'closed' });
|
else this.innerHTML = '网易云歌单ID未填写!';
|
||||||
if (this.options.id) this._shadowRoot.innerHTML = this.template;
|
|
||||||
else this._shadowRoot.innerHTML = '网易云歌单ID未填写!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.customElements.define('joe-mlist', JoeMlist);
|
window.customElements.define('joe-mlist', JoeMlist);
|
||||||
|
|
||||||
/* 网易云音乐 - 歌曲 √ */
|
|
||||||
class JoeMusic extends HTMLElement {
|
class JoeMusic extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -37,20 +30,38 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
get template() {
|
get template() {
|
||||||
return `
|
return `<object style="display: block;margin: 0 auto;" width="${this.options.width}" height="86px" data="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66"></object>`;
|
||||||
<style>iframe {display: block;margin: 0 auto;border: none;}</style>
|
|
||||||
<iframe src="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66" width="${this.options.width}" height="86px"></iframe>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
this.innerHTML = '';
|
if (this.options.id) this.innerHTML = this.template;
|
||||||
this._shadowRoot = this.attachShadow({ mode: 'closed' });
|
else this.innerHTML = '网易云歌单ID未填写!';
|
||||||
if (this.options.id) this._shadowRoot.innerHTML = this.template;
|
|
||||||
else this._shadowRoot.innerHTML = '网易云歌单ID未填写!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.customElements.define('joe-music', JoeMusic);
|
window.customElements.define('joe-music', JoeMusic);
|
||||||
|
|
||||||
|
class JoeBilibili extends HTMLElement {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.options = {
|
||||||
|
bvid: this.getAttribute('bvid')
|
||||||
|
};
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
get template() {
|
||||||
|
return `<object class="joe_detail__article-player" data="//player.bilibili.com/player.html?bvid=${this.options.bvid}"></object>`;
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
if (this.options.bvid) this.innerHTML = this.template;
|
||||||
|
else this.innerHTML = 'Bvid未填写!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.customElements.define('joe-bilibili', JoeBilibili);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* 便条按钮 */
|
/* 便条按钮 */
|
||||||
class JoeAnote extends HTMLElement {
|
class JoeAnote extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
@ -121,26 +132,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.customElements.define('joe-dplayer', JoeDplayer);
|
window.customElements.define('joe-dplayer', JoeDplayer);
|
||||||
/* BiliBili */
|
|
||||||
class JoeBilibili extends HTMLElement {
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.options = {
|
|
||||||
bvid: this.getAttribute('bvid')
|
|
||||||
};
|
|
||||||
this.render();
|
|
||||||
}
|
|
||||||
get template() {
|
|
||||||
return `
|
|
||||||
<iframe class="joe_detail__article-player" allowfullscreen="true" src="//player.bilibili.com/player.html?bvid=${this.options.bvid}"></iframe>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
render() {
|
|
||||||
if (this.options.bvid) this.innerHTML = this.template;
|
|
||||||
else this.innerHTML = 'Bvid未填写!';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
window.customElements.define('joe-bilibili', JoeBilibili);
|
|
||||||
/* 居中标题 */
|
/* 居中标题 */
|
||||||
class JoeMtitle extends HTMLElement {
|
class JoeMtitle extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
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
@ -42,7 +42,7 @@ class Editor
|
|||||||
{
|
{
|
||||||
?>
|
?>
|
||||||
<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="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=6.2.0') ?>">
|
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css') ?>">
|
||||||
<script>
|
<script>
|
||||||
window.JoeConfig = {
|
window.JoeConfig = {
|
||||||
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
|
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
|
||||||
@ -51,9 +51,9 @@ class Editor
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/typecho-joe-next@6.0.0/plugin/prism/prism.js"></script>
|
||||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.short.min.js?v=6.2.0') ?>"></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.parse.min.js?v=6.2.0') ?>"></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.write.chunk.js?v=6.2.0') ?>"></script>
|
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js') ?>"></script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
/* 获取主题当前版本号 */
|
/* 获取主题当前版本号 */
|
||||||
function _getVersion()
|
function _getVersion()
|
||||||
{
|
{
|
||||||
return "6.2.0";
|
return "6.2.1";
|
||||||
};
|
};
|
||||||
|
|
||||||
/* 判断是否是手机 */
|
/* 判断是否是手机 */
|
||||||
|
@ -5,18 +5,18 @@ function _parseContent($post, $login)
|
|||||||
$content = $post->content;
|
$content = $post->content;
|
||||||
$content = _parseReply($content);
|
$content = _parseReply($content);
|
||||||
|
|
||||||
/* 已测试 √ */
|
|
||||||
if (strpos($content, '{x}') !== false || strpos($content, '{ }') !== false) {
|
if (strpos($content, '{x}') !== false || strpos($content, '{ }') !== false) {
|
||||||
$content = strtr($content, array(
|
$content = strtr($content, array(
|
||||||
"{x}" => '<input type="checkbox" class="joe_detail__article-checkbox" checked disabled></input>',
|
"{x}" => '<input type="checkbox" class="joe_detail__article-checkbox" checked disabled></input>',
|
||||||
"{ }" => '<input type="checkbox" class="joe_detail__article-checkbox" disabled></input>'
|
"{ }" => '<input type="checkbox" class="joe_detail__article-checkbox" disabled></input>'
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 过滤网易云音乐 - √ */
|
|
||||||
if (strpos($content, '{music') !== false) {
|
if (strpos($content, '{music') !== false) {
|
||||||
$content = preg_replace('/{music-list([^\/})]*)\/}/SU', '<joe-mlist $1></joe-mlist>', $content);
|
$content = preg_replace('/{music-list([^\/}]*)\/}/SU', '<joe-mlist $1></joe-mlist>', $content);
|
||||||
$content = preg_replace('/{music([^\/})]*)\/}/SU', '<joe-music $1></joe-music>', $content);
|
$content = preg_replace('/{music([^\/}]*)\/}/SU', '<joe-music $1></joe-music>', $content);
|
||||||
|
}
|
||||||
|
if (strpos($content, '{bilibili') !== false) {
|
||||||
|
$content = preg_replace('/{bilibili([^\/}]*)\/}/SU', '<joe-bilibili $1></joe-bilibili>', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -44,10 +44,7 @@ function _parseContent($post, $login)
|
|||||||
$player = Helper::options()->JCustomPlayer ? Helper::options()->JCustomPlayer : '/usr/themes/Joe/library/player.php?url=';
|
$player = Helper::options()->JCustomPlayer ? Helper::options()->JCustomPlayer : '/usr/themes/Joe/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);
|
||||||
}
|
}
|
||||||
/* 过滤bilibili播放器 */
|
|
||||||
if (strpos($content, '{bilibili') !== false) {
|
|
||||||
$content = preg_replace('/{bilibili(.*)\/}/SU', '<joe-bilibili $1></joe-bilibili>', $content);
|
|
||||||
}
|
|
||||||
/* 过滤复制粘贴功能 */
|
/* 过滤复制粘贴功能 */
|
||||||
if (strpos($content, '{copy') !== false) {
|
if (strpos($content, '{copy') !== false) {
|
||||||
$content = preg_replace('/{copy(.*)}/SU', '<joe-copy $1>', $content);
|
$content = preg_replace('/{copy(.*)}/SU', '<joe-copy $1>', $content);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "typecho-joe-next",
|
"name": "typecho-joe-next",
|
||||||
"version": "6.2.0",
|
"version": "6.2.1",
|
||||||
"description": "A Theme Of Typecho",
|
"description": "A Theme Of Typecho",
|
||||||
"main": "index.php",
|
"main": "index.php",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
@ -405,4 +405,22 @@ export default class JoeAction {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
handleBilibili(cm) {
|
||||||
|
this._openModal({
|
||||||
|
title: 'BiliBili视频',
|
||||||
|
innerHtml: `
|
||||||
|
<div class="fitem">
|
||||||
|
<label>视频Bvid</label>
|
||||||
|
<input autocomplete="off" name="bvid" placeholder="请输入视频Bvid"/>
|
||||||
|
</div>
|
||||||
|
`,
|
||||||
|
confirm: () => {
|
||||||
|
const bvid = $(".cm-modal input[name='bvid']").val();
|
||||||
|
const str = `{bilibili bvid="${bvid}"/}\n`;
|
||||||
|
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
|
||||||
|
else this._replaceSelection(cm, str);
|
||||||
|
cm.focus();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,13 @@ export default function createPreviewHtml(str) {
|
|||||||
str = str.replace(/{ }/g, '<input type="checkbox" class="task" disabled></input>');
|
str = str.replace(/{ }/g, '<input type="checkbox" class="task" disabled></input>');
|
||||||
|
|
||||||
/* 网易云 - 歌单 */
|
/* 网易云 - 歌单 */
|
||||||
str = str.replace(/{music-list([^\/})]*)\/}/g, '<joe-mlist $1></joe-mlist>');
|
str = str.replace(/{music-list([^/}]*)\/}/g, '<joe-mlist $1></joe-mlist>');
|
||||||
|
|
||||||
/* 网易云 - 歌曲 */
|
/* 网易云 - 歌曲 */
|
||||||
str = str.replace(/{music([^\/})]*)\/}/g, '<joe-music $1></joe-music>');
|
str = str.replace(/{music([^/}]*)\/}/g, '<joe-music $1></joe-music>');
|
||||||
|
|
||||||
|
/* BiliBili */
|
||||||
|
str = str.replace(/{bilibili([^/}]*)\/}/g, '<joe-bilibili $1></joe-bilibili>');
|
||||||
|
|
||||||
$('.cm-preview-content').html(str);
|
$('.cm-preview-content').html(str);
|
||||||
$('.cm-preview-content pre code').each((i, el) => Prism.highlightElement(el));
|
$('.cm-preview-content pre code').each((i, el) => Prism.highlightElement(el));
|
||||||
|
@ -104,6 +104,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="M837.766 364.816c-50.828-54.107-111.313-91.2-187.245-98.706-7.324-.728-18.983-5.028-20.404-9.983-6.595-23.064-12.826-46.784-14.283-70.54-1.64-26.6 20.368-44.744 46.748-39.425 16.724 3.389 32.392 12.389 48.277 19.457 10.968 4.883 20.988 12.389 32.32 15.923 27.472 8.49 53.378-7.725 58.589-35.78 4.408-23.684-4.41-42.922-22.154-58.153-28.857-24.776-62.998-37.748-100.054-44.743-70.977-13.409-152.74 38.768-169.648 108.908-8.453 35.088-1.712 68.755 10.457 101.51 6.486 17.527 1.968 24.595-16.032 30.862-118.308 41.32-182.508 155.436-154.49 276.075 16.506 71.123 59.465 121.733 131.862 138.604 74.44 17.344 136.818-7.943 182.62-69.192 37.056-49.516 39.133-105.519 23.976-163.197-7.943-30.242-17.198-60.156-26.672-92.948 5.575 1.094 7.397 1.203 9.037 1.786 125.486 45.436 188.959 183.858 125.232 318.813-63.91 135.325-211.911 183.348-344.362 155.072-166.26-35.526-278.955-210.93-245.286-377.62 23.61-116.924 91.564-198.32 200.253-246.342 8.27-3.68 16.797-7.251 24.266-12.28 15.595-10.53 24.886-25.687 23.064-44.633-1.93-19.93-11.878-37.93-32.136-42.011-16.215-3.28-36.036-3.68-50.72 2.696-166.223 72.107-260.848 197.994-272.869 379.884-18.655 282.566 246.128 504.023 521.296 440.882 171.833-39.424 293.167-182.18 303.986-330.804 7.105-97.248-18.619-182.763-85.625-254.11zm-309.05 234.651c-39.06 3.352-71.233-23.83-77.609-65.548-11.113-72.545 19.894-127.162 85.48-151.94 12.606-4.774 18.18-2.915 21.934 10.858 8.745 32.1 19.493 63.617 28.675 95.609 3.133 10.93 3.972 22.554 5.83 33.885-.219 42.922-25.578 73.82-64.31 77.136z"/></svg>'
|
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M837.766 364.816c-50.828-54.107-111.313-91.2-187.245-98.706-7.324-.728-18.983-5.028-20.404-9.983-6.595-23.064-12.826-46.784-14.283-70.54-1.64-26.6 20.368-44.744 46.748-39.425 16.724 3.389 32.392 12.389 48.277 19.457 10.968 4.883 20.988 12.389 32.32 15.923 27.472 8.49 53.378-7.725 58.589-35.78 4.408-23.684-4.41-42.922-22.154-58.153-28.857-24.776-62.998-37.748-100.054-44.743-70.977-13.409-152.74 38.768-169.648 108.908-8.453 35.088-1.712 68.755 10.457 101.51 6.486 17.527 1.968 24.595-16.032 30.862-118.308 41.32-182.508 155.436-154.49 276.075 16.506 71.123 59.465 121.733 131.862 138.604 74.44 17.344 136.818-7.943 182.62-69.192 37.056-49.516 39.133-105.519 23.976-163.197-7.943-30.242-17.198-60.156-26.672-92.948 5.575 1.094 7.397 1.203 9.037 1.786 125.486 45.436 188.959 183.858 125.232 318.813-63.91 135.325-211.911 183.348-344.362 155.072-166.26-35.526-278.955-210.93-245.286-377.62 23.61-116.924 91.564-198.32 200.253-246.342 8.27-3.68 16.797-7.251 24.266-12.28 15.595-10.53 24.886-25.687 23.064-44.633-1.93-19.93-11.878-37.93-32.136-42.011-16.215-3.28-36.036-3.68-50.72 2.696-166.223 72.107-260.848 197.994-272.869 379.884-18.655 282.566 246.128 504.023 521.296 440.882 171.833-39.424 293.167-182.18 303.986-330.804 7.105-97.248-18.619-182.763-85.625-254.11zm-309.05 234.651c-39.06 3.352-71.233-23.83-77.609-65.548-11.113-72.545 19.894-127.162 85.48-151.94 12.606-4.774 18.18-2.915 21.934 10.858 8.745 32.1 19.493 63.617 28.675 95.609 3.133 10.93 3.972 22.554 5.83 33.885-.219 42.922-25.578 73.82-64.31 77.136z"/></svg>'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'bilibili',
|
||||||
|
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>'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'code-block',
|
type: 'code-block',
|
||||||
title: '代码块',
|
title: '代码块',
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
/* 网易云音乐 - 歌单 */
|
|
||||||
class JoeMlist extends HTMLElement {
|
class JoeMlist extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -11,21 +10,14 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
get template() {
|
get template() {
|
||||||
return `
|
return `<object style="display: block;margin: 0 auto;" width="${this.options.width}" height="450px" data="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430"></object>`;
|
||||||
<style>iframe {display: block;margin: 0 auto;border: none;}</style>
|
|
||||||
<iframe src="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430" width="${this.options.width}" height="450px"></iframe>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
this.innerHTML = '';
|
if (this.options.id) this.innerHTML = this.template;
|
||||||
this._shadowRoot = this.attachShadow({ mode: 'closed' });
|
else this.innerHTML = '网易云歌单ID未填写!';
|
||||||
if (this.options.id) this._shadowRoot.innerHTML = this.template;
|
|
||||||
else this._shadowRoot.innerHTML = '网易云歌单ID未填写!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.customElements.define('joe-mlist', JoeMlist);
|
window.customElements.define('joe-mlist', JoeMlist);
|
||||||
|
|
||||||
/* 网易云音乐 - 歌曲 */
|
|
||||||
class JoeMusic extends HTMLElement {
|
class JoeMusic extends HTMLElement {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
@ -37,17 +29,29 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
get template() {
|
get template() {
|
||||||
return `
|
return `<object style="display: block;margin: 0 auto;" width="${this.options.width}" height="86px" data="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66"></object>`;
|
||||||
<style>iframe {display: block;margin: 0 auto;border: none;}</style>
|
|
||||||
<iframe src="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66" width="${this.options.width}" height="86px"></iframe>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
this.innerHTML = '';
|
if (this.options.id) this.innerHTML = this.template;
|
||||||
this._shadowRoot = this.attachShadow({ mode: 'closed' });
|
else this.innerHTML = '网易云歌曲ID未填写!';
|
||||||
if (this.options.id) this._shadowRoot.innerHTML = this.template;
|
|
||||||
else this._shadowRoot.innerHTML = '网易云歌单ID未填写!';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.customElements.define('joe-music', JoeMusic);
|
window.customElements.define('joe-music', JoeMusic);
|
||||||
|
class JoeBilibili extends HTMLElement {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
this.options = {
|
||||||
|
bvid: this.getAttribute('bvid')
|
||||||
|
};
|
||||||
|
this.render();
|
||||||
|
}
|
||||||
|
get template() {
|
||||||
|
return `<object style="display: block;margin: 0 auto;" width="100%" height="180px" data="//player.bilibili.com/player.html?bvid=${this.options.bvid}"></object>`;
|
||||||
|
}
|
||||||
|
render() {
|
||||||
|
if (this.options.bvid) this.innerHTML = this.template;
|
||||||
|
else this.innerHTML = 'Bvid未填写!';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
window.customElements.define('joe-bilibili', JoeBilibili);
|
||||||
});
|
});
|
||||||
|
2
typecho/write/js/joe.short.min.js
vendored
2
typecho/write/js/joe.short.min.js
vendored
@ -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`\n \t<style>iframe {display: block;margin: 0 auto;border: none;}</style>\n \t<iframe src="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430" width="${this.options.width}" height="450px"></iframe>\n \t`}render(){this.innerHTML="",this._shadowRoot=this.attachShadow({mode:"closed"}),this.options.id?this._shadowRoot.innerHTML=this.template:this._shadowRoot.innerHTML="网易云歌单ID未填写!"}}window.customElements.define("joe-mlist",t);class i 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`\n \t<style>iframe {display: block;margin: 0 auto;border: none;}</style>\n \t<iframe src="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66" width="${this.options.width}" height="86px"></iframe>\n \t`}render(){this.innerHTML="",this._shadowRoot=this.attachShadow({mode:"closed"}),this.options.id?this._shadowRoot.innerHTML=this.template:this._shadowRoot.innerHTML="网易云歌单ID未填写!"}}window.customElements.define("joe-music",i)});
|
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`<object style="display: block;margin: 0 auto;" width="${this.options.width}" height="450px" data="//music.163.com/outchain/player?type=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430"></object>`}render(){this.options.id?this.innerHTML=this.template:this.innerHTML="网易云歌单ID未填写!"}}window.customElements.define("joe-mlist",t);class i 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`<object style="display: block;margin: 0 auto;" width="${this.options.width}" height="86px" data="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66"></object>`}render(){this.options.id?this.innerHTML=this.template:this.innerHTML="网易云歌曲ID未填写!"}}window.customElements.define("joe-music",i);class e extends HTMLElement{constructor(){super(),this.options={bvid:this.getAttribute("bvid")},this.render()}get template(){return`<object style="display: block;margin: 0 auto;" width="100%" height="180px" data="//player.bilibili.com/player.html?bvid=${this.options.bvid}"></object>`}render(){this.options.bvid?this.innerHTML=this.template:this.innerHTML="Bvid未填写!"}}window.customElements.define("joe-bilibili",e)});
|
File diff suppressed because one or more lines are too long
@ -261,6 +261,9 @@ class Joe extends JoeAction {
|
|||||||
case 'netease-single':
|
case 'netease-single':
|
||||||
super.handleNetease(this.cm, false);
|
super.handleNetease(this.cm, false);
|
||||||
break;
|
break;
|
||||||
|
case 'bilibili':
|
||||||
|
super.handleBilibili(this.cm);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.cm-tools').append(el);
|
$('.cm-tools').append(el);
|
||||||
|
@ -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()]
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user