From f7699389e900436cc7bb3df28a572f63fa749240 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E6=81=92?= <2323333339@qq.com> Date: Tue, 30 Mar 2021 15:03:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/joe.short.js | 23 +- assets/js/joe.short.min.js | 2 +- core/factory.php | 8 +- core/function.php | 2 +- core/short.php | 2 +- package.json | 2 +- typecho/write/js/_actions.js | 11 +- typecho/write/js/_create.js | 5 +- typecho/write/js/_tools.js | 5 + typecho/write/js/joe.short.js | 32 +- typecho/write/js/joe.short.min.js | 2 +- typecho/write/js/joe.write.chunk.js | 14205 +------------------------- typecho/write/js/joe.write.js | 5 +- typecho/write/rollup.config.js | 2 +- 14 files changed, 77 insertions(+), 14229 deletions(-) diff --git a/assets/js/joe.short.js b/assets/js/joe.short.js index 95d55ed..bf1adc4 100644 --- a/assets/js/joe.short.js +++ b/assets/js/joe.short.js @@ -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 ` - -
- -
- `; + + + `; } 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); diff --git a/assets/js/joe.short.min.js b/assets/js/joe.short.min.js index 3f651bb..b476fb4 100644 --- a/assets/js/joe.short.min.js +++ b/assets/js/joe.short.min.js @@ -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\t\t\t\n\t\t\t\t\n\t\t\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 e 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`\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t\n\t\t\t\t
\n\t\t\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",e);class i 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.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"标签按钮"},this.render()}get template(){return`\n \n ${this.options.content}\n \n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-anote",i);class n 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.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"多彩按钮"},this.render()}get template(){return`\n \n ${this.options.content}\n \n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-abtn",n);class s extends HTMLElement{constructor(){super(),this.options={src:this.getAttribute("src"),player:this.getAttribute("player")},this.render()}get template(){return`\n \n `}render(){this.options.src?this.innerHTML=this.template:this.innerHTML="播放地址未填写!"}}window.customElements.define("joe-dplayer",s);class o extends HTMLElement{constructor(){super(),this.options={bvid:this.getAttribute("bvid")},this.render()}get template(){return`\n \n `}render(){this.options.bvid?this.innerHTML=this.template:this.innerHTML="Bvid未填写!"}}window.customElements.define("joe-bilibili",o);class r extends HTMLElement{constructor(){super(),this.options={content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"居中标题"},this.render()}get template(){return`\n
\n ${this.options.content} \n
\n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-mtitle",r);class a extends HTMLElement{constructor(){super(),this.options={text:this.getAttribute("text")||"默认文本",content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"点击复制"},this.render()}get template(){return`${this.options.content}`}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",a);class h extends HTMLElement{constructor(){super(),this.options={type:/^success$|^info$|^warning$|^error$/.test(this.getAttribute("type"))?this.getAttribute("type"):"info",content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"提示内容"},this.render()}get template(){return`\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
${this.options.content}
\n\t\t\t\t
\n\t\t\t`}render(){this.innerHTML=this.template}}window.customElements.define("joe-message",h);class l extends HTMLElement{constructor(){super(),this.options={width:this.getAttribute("width")||"100%",label:this.getAttribute("label")||"默认标题",content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"默认内容"},this.render()}get template(){return`\n
\n
${this.options.label}
\n
${this.options.content}
\n
\n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-card",l);class c extends HTMLElement{constructor(){super(),this.options={content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"默认隐藏的内容"},this.render()}render(){this.innerHTML=this.options.content}}window.customElements.define("joe-show",c);class d extends HTMLElement{constructor(){super(),this.render()}get template(){return'\n \n
\n 此处内容作者设置了 回复 可见\n
\n '}render(){this.innerHTML="",this._shadowRoot=this.attachShadow({mode:"closed"}),this._shadowRoot.innerHTML=this.template,this.event()}event(){this.$button=this._shadowRoot.querySelector("i"),this.$button.addEventListener("click",()=>{const t=$(".joe_comment").offset().top-$(".joe_header").height()-15;window.scrollTo({top:t,behavior:"smooth"})})}}window.customElements.define("joe-hide",d)}); \ No newline at end of file +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\t\t\t\n\t\t\t\t\n\t\t\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 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`\n \t\n \t\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",e);class i 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.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"标签按钮"},this.render()}get template(){return`\n \n ${this.options.content}\n \n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-anote",i);class n 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.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"多彩按钮"},this.render()}get template(){return`\n \n ${this.options.content}\n \n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-abtn",n);class s extends HTMLElement{constructor(){super(),this.options={src:this.getAttribute("src"),player:this.getAttribute("player")},this.render()}get template(){return`\n \n `}render(){this.options.src?this.innerHTML=this.template:this.innerHTML="播放地址未填写!"}}window.customElements.define("joe-dplayer",s);class o extends HTMLElement{constructor(){super(),this.options={bvid:this.getAttribute("bvid")},this.render()}get template(){return`\n \n `}render(){this.options.bvid?this.innerHTML=this.template:this.innerHTML="Bvid未填写!"}}window.customElements.define("joe-bilibili",o);class r extends HTMLElement{constructor(){super(),this.options={content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"居中标题"},this.render()}get template(){return`\n
\n ${this.options.content} \n
\n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-mtitle",r);class a extends HTMLElement{constructor(){super(),this.options={text:this.getAttribute("text")||"默认文本",content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"点击复制"},this.render()}get template(){return`${this.options.content}`}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",a);class l extends HTMLElement{constructor(){super(),this.options={type:/^success$|^info$|^warning$|^error$/.test(this.getAttribute("type"))?this.getAttribute("type"):"info",content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"提示内容"},this.render()}get template(){return`\n\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t\t\t
${this.options.content}
\n\t\t\t\t
\n\t\t\t`}render(){this.innerHTML=this.template}}window.customElements.define("joe-message",l);class h extends HTMLElement{constructor(){super(),this.options={width:this.getAttribute("width")||"100%",label:this.getAttribute("label")||"默认标题",content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"默认内容"},this.render()}get template(){return`\n
\n
${this.options.label}
\n
${this.options.content}
\n
\n `}render(){this.innerHTML=this.template}}window.customElements.define("joe-card",h);class c extends HTMLElement{constructor(){super(),this.options={content:this.innerHTML.trim().replace(/^(
)|(
)$/g,"")||"默认隐藏的内容"},this.render()}render(){this.innerHTML=this.options.content}}window.customElements.define("joe-show",c);class d extends HTMLElement{constructor(){super(),this.render()}get template(){return'\n \n
\n 此处内容作者设置了 回复 可见\n
\n '}render(){this.innerHTML="",this._shadowRoot=this.attachShadow({mode:"closed"}),this._shadowRoot.innerHTML=this.template,this.event()}event(){this.$button=this._shadowRoot.querySelector("i"),this.$button.addEventListener("click",()=>{const t=$(".joe_comment").offset().top-$(".joe_header").height()-15;window.scrollTo({top:t,behavior:"smooth"})})}}window.customElements.define("joe-hide",d)}); \ No newline at end of file diff --git a/core/factory.php b/core/factory.php index cfb83a1..f21860d 100644 --- a/core/factory.php +++ b/core/factory.php @@ -42,7 +42,7 @@ class Editor { ?> - + - - - + + + ', $content); - $content = preg_replace('/{music(.*)\/}/SU', '', $content); + $content = preg_replace('/{music([^\/})]*)\/}/SU', '', $content); } diff --git a/package.json b/package.json index 3855f4f..9ef609f 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/typecho/write/js/_actions.js b/typecho/write/js/_actions.js index 3458cdd..4726397 100644 --- a/typecho/write/js/_actions.js +++ b/typecho/write/js/_actions.js @@ -359,6 +359,7 @@ export default class JoeAction { handleAbout() { this._openModal({ title: '关于', + hasFooter: false, innerHtml: `