This commit is contained in:
杜恒
2021-03-30 14:29:21 +08:00
parent a19e1581aa
commit 09ccfafe53
17 changed files with 14504 additions and 245 deletions

View File

@@ -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 `
<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 = '';
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 `
<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=0&id=${this.options.id}&auto=${this.options.autoplay}&height=430" width="${this.options.width}" height="${this.options.height}"></iframe>
</div>
`;
}
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 JoeHide extends HTMLElement {
constructor() {

File diff suppressed because one or more lines are too long