diff --git a/assets/js/joe.short.js b/assets/js/joe.short.js index f2b693b..95d55ed 100644 --- a/assets/js/joe.short.js +++ b/assets/js/joe.short.js @@ -1,4 +1,30 @@ document.addEventListener('DOMContentLoaded', () => { + /* 网易云音乐 - 歌单 √ */ + class JoeMlist 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 ` + + + `; + } + 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-mlist', JoeMlist); + /* 网易云音乐 - 单首 - 已测试 √ */ class JoeMusic extends HTMLElement { constructor() { @@ -245,44 +271,6 @@ document.addEventListener('DOMContentLoaded', () => { * */ - /* 网易云音乐 - 歌单 */ - class JoeMlist extends HTMLElement { - constructor() { - super(); - this.options = { - id: this.getAttribute('id'), - width: this.getAttribute('width') || '100%', - height: this.getAttribute('height') || '450px', - autoplay: this.getAttribute('autoplay') ? 1 : 0 - }; - this.render(); - } - get template() { - return ` - -