更新
This commit is contained in:
parent
09ccfafe53
commit
f7699389e9
@ -25,41 +25,28 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
window.customElements.define('joe-mlist', JoeMlist);
|
||||
|
||||
/* 网易云音乐 - 单首 - 已测试 √ */
|
||||
/* 网易云音乐 - 歌曲 √ */
|
||||
class JoeMusic extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.options = {
|
||||
id: this.getAttribute('id'),
|
||||
width: this.getAttribute('width') || '100%',
|
||||
height: this.getAttribute('height') || '86px',
|
||||
autoplay: this.getAttribute('autoplay') ? 1 : 0
|
||||
};
|
||||
this.render();
|
||||
}
|
||||
get template() {
|
||||
return `
|
||||
<style>
|
||||
.container {
|
||||
width: 100%;
|
||||
}
|
||||
.container iframe {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
border: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
</style>
|
||||
<div class="container">
|
||||
<iframe src="//music.163.com/outchain/player?type=2&id=${this.options.id}&auto=${this.options.autoplay}&height=66" width="${this.options.width}" height="${this.options.height}"></iframe>
|
||||
</div>
|
||||
`;
|
||||
<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() {
|
||||
this.innerHTML = '';
|
||||
this._shadowRoot = this.attachShadow({ mode: 'closed' });
|
||||
if (this.options.id) this._shadowRoot.innerHTML = this.template;
|
||||
else this._shadowRoot.innerHTML = '网易云歌曲ID未填写!';
|
||||
else this._shadowRoot.innerHTML = '网易云歌单ID未填写!';
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-music', JoeMusic);
|
||||
|
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="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=6.1.8') ?>">
|
||||
<link rel="stylesheet" href="<?php Helper::options()->themeUrl('typecho/write/css/joe.write.min.css?v=6.2.0') ?>">
|
||||
<script>
|
||||
window.JoeConfig = {
|
||||
uploadAPI: '<?php Helper::security()->index('/action/upload'); ?>',
|
||||
@ -51,9 +51,9 @@ class Editor
|
||||
}
|
||||
</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') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.parse.min.js?v=6.1.8') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=6.1.8') ?>"></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.parse.min.js?v=6.2.0') ?>"></script>
|
||||
<script src="<?php Helper::options()->themeUrl('typecho/write/js/joe.write.chunk.js?v=6.2.0') ?>"></script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* 获取主题当前版本号 */
|
||||
function _getVersion()
|
||||
{
|
||||
return "6.1.9";
|
||||
return "6.2.0";
|
||||
};
|
||||
|
||||
/* 判断是否是手机 */
|
||||
|
@ -16,7 +16,7 @@ function _parseContent($post, $login)
|
||||
/* 过滤网易云音乐 - √ */
|
||||
if (strpos($content, '{music') !== false) {
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "typecho-joe-next",
|
||||
"version": "6.1.9",
|
||||
"version": "6.2.0",
|
||||
"description": "A Theme Of Typecho",
|
||||
"main": "index.php",
|
||||
"keywords": [
|
||||
|
@ -359,6 +359,7 @@ export default class JoeAction {
|
||||
handleAbout() {
|
||||
this._openModal({
|
||||
title: '关于',
|
||||
hasFooter: false,
|
||||
innerHtml: `
|
||||
<ul>
|
||||
<li>短代码功能正在开发中...</li>
|
||||
@ -373,13 +374,13 @@ export default class JoeAction {
|
||||
this._replaceSelection(cm, ` ${str} `);
|
||||
cm.focus();
|
||||
}
|
||||
handleNeteaseList(cm) {
|
||||
handleNetease(cm, type) {
|
||||
this._openModal({
|
||||
title: '网易云歌单',
|
||||
title: type ? '网易云歌单' : '网抑云单首',
|
||||
innerHtml: `
|
||||
<div class="fitem">
|
||||
<label>歌单 ID</label>
|
||||
<input autocomplete="off" name="id" placeholder="请输入歌单ID"/>
|
||||
<label>歌${type ? '单' : '曲'} ID</label>
|
||||
<input autocomplete="off" name="id" placeholder="请输入歌${type ? '单' : '曲'}ID"/>
|
||||
</div>
|
||||
<div class="fitem">
|
||||
<label>显示宽度</label>
|
||||
@ -397,7 +398,7 @@ export default class JoeAction {
|
||||
const id = $(".cm-modal input[name='id']").val();
|
||||
const width = $(".cm-modal input[name='width']").val() || '100%';
|
||||
const autoplay = $(".cm-modal select[name='autoplay']").val();
|
||||
const str = `{music-list id="${id}" width="${width}" ${autoplay === '1' ? 'autoplay ' : ''}/}\n`;
|
||||
const str = `{${type ? 'music-list' : 'music'} id="${id}" width="${width}" ${autoplay === '1' ? 'autoplay="autoplay"' : ''}/}\n`;
|
||||
if (this._getLineCh(cm)) this._replaceSelection(cm, '\n' + str);
|
||||
else this._replaceSelection(cm, str);
|
||||
cm.focus();
|
||||
|
@ -11,6 +11,9 @@ export default function createPreviewHtml(str) {
|
||||
/* 网易云 - 歌单 */
|
||||
str = str.replace(/{music-list([^\/})]*)\/}/g, '<joe-mlist $1></joe-mlist>');
|
||||
|
||||
/* 网易云 - 歌曲 */
|
||||
str = str.replace(/{music([^\/})]*)\/}/g, '<joe-music $1></joe-music>');
|
||||
|
||||
$('.cm-preview-content').html(str);
|
||||
$('.cm-preview-content pre code').each((i, el) => Prism.highlightElement(el));
|
||||
}
|
||||
|
@ -99,6 +99,11 @@ export default [
|
||||
title: '网易云列表',
|
||||
innerHTML: '<svg viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="18" height="18"><path d="M919.438 376.378c-3.328 17.214-8.767 31.228-16.254 42.043-7.487 10.815-13.822 15.87-19.005 15.166-5.248-.768-9.92-4.48-14.015-11.198-4.095-6.72-7.295-19.07-9.535-36.988-3.711-29.18-13.246-50.682-28.54-64.504-15.295-13.822-38.972-23.741-71.095-29.692-33.596-6.72-63.225-20.35-89.013-40.956-25.725-20.54-47.227-39.802-64.377-57.784-16.382-15.742-29.053-21.31-38.012-16.83s-13.437 12.734-13.437 24.7v48.25l-1.088 493.444v63.93c.768 17.916-2.048 37.946-8.383 60.023-6.335 22.077-18.302 42.81-35.836 62.264s-40.89 36.092-69.943 49.915c-29.117 13.822-65.337 21.884-108.595 24.124-44.027 2.24-83.766-5.631-119.217-23.55-35.452-17.916-62.905-40.569-82.295-67.83-19.39-27.26-28.923-57.21-28.54-89.718.384-32.508 14.335-62.967 41.98-91.38 27.644-28.413 57.464-48.25 89.589-59.45 32.06-11.197 63.03-17.405 92.916-18.492 29.884-1.088 56.505.96 80.054 6.143 23.485 5.247 40.827 10.11 52.025 14.59 0 0 .384-505.026 1.152-615.669 0-21.693 5.631-39.42 16.766-53.306 11.2-13.821 26.11-21.884 44.795-24.124 15.614-2.368 28.477.768 38.524 9.407 10.11 8.574 20.35 20.541 30.78 35.9 10.494 15.293 23.356 32.699 38.65 52.153 15.295 19.454 36.029 38.522 62.137 57.21 22.397 17.212 41.979 29.499 58.809 36.986a4986.732 4986.732 0 0 0 47.034 20.734c14.526 6.335 28.924 14.014 43.13 22.973 14.207 8.96 29.885 23.55 47.035 43.706 17.15 19.454 27.644 39.612 31.356 60.537 3.647 20.99 3.84 40.06.448 57.273z"/></svg>'
|
||||
},
|
||||
{
|
||||
type: 'netease-single',
|
||||
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>'
|
||||
},
|
||||
{
|
||||
type: 'code-block',
|
||||
title: '代码块',
|
||||
|
@ -12,9 +12,9 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
get template() {
|
||||
return `
|
||||
<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>
|
||||
`;
|
||||
<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() {
|
||||
this.innerHTML = '';
|
||||
@ -24,4 +24,30 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-mlist', JoeMlist);
|
||||
|
||||
/* 网易云音乐 - 歌曲 */
|
||||
class JoeMusic 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 `
|
||||
<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() {
|
||||
this.innerHTML = '';
|
||||
this._shadowRoot = this.attachShadow({ mode: 'closed' });
|
||||
if (this.options.id) this._shadowRoot.innerHTML = this.template;
|
||||
else this._shadowRoot.innerHTML = '网易云歌单ID未填写!';
|
||||
}
|
||||
}
|
||||
window.customElements.define('joe-music', JoeMusic);
|
||||
});
|
||||
|
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 <style>iframe {display: block;margin: 0 auto;border: none;}</style>\n <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 `}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)});
|
||||
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)});
|
File diff suppressed because one or more lines are too long
@ -256,7 +256,10 @@ class Joe extends JoeAction {
|
||||
super.handleTask(this.cm, true);
|
||||
break;
|
||||
case 'netease-list':
|
||||
super.handleNeteaseList(this.cm);
|
||||
super.handleNetease(this.cm, true);
|
||||
break;
|
||||
case 'netease-single':
|
||||
super.handleNetease(this.cm, false);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
@ -6,5 +6,5 @@ export default {
|
||||
file: './js/joe.write.chunk.js',
|
||||
format: 'iife'
|
||||
},
|
||||
plugins: [nodeResolve()]
|
||||
plugins: [nodeResolve(), uglify()]
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user