mirror of
https://dl.bcrjl.com/ghg/HaoOuBa/Joe.git
synced 2026-02-17 13:10:05 +08:00
更新
This commit is contained in:
@@ -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
Reference in New Issue
Block a user