This commit is contained in:
杜恒
2021-03-30 15:03:37 +08:00
parent 09ccfafe53
commit f7699389e9
14 changed files with 77 additions and 14229 deletions

View File

@@ -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);

File diff suppressed because one or more lines are too long