Skip to content

Commit fd53940

Browse files
committed
🍧 2.0.1, fixed element display, close #11
1 parent 9e0e140 commit fd53940

3 files changed

Lines changed: 26 additions & 25 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ https://github.com/MoePlayer/APlayer
1919
|2.0.x|Latest|[![](https://img.shields.io/badge/APlayer-^1.10.0-green.svg?longCache=true&style=for-the-badge)](https://github.com/MoePlayer/APlayer)|
2020

2121
## CDN
22-
- https://cdn.jsdelivr.net/npm/meting@2/dist/Meting.min.js
23-
- https://unpkg.com/meting@2/dist/Meting.min.js
22+
- https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js
23+
- https://unpkg.com/meting@2.0.1/dist/Meting.min.js
2424

2525
## Quick Start
2626
```html

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "meting",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "Wow, such a beautiful html5 music player (with Meting API)",
55
"license": "MIT",
66
"homepage": "https://github.com/metowolf/MetingJS",

source/Meting.js

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,15 @@ class MetingJSElement extends HTMLElement {
3030
'auto', 'lock',
3131
'name', 'title', 'artist', 'author', 'url', 'cover', 'pic', 'lyric', 'lrc',
3232
]
33+
this.meta = {}
3334
for (let key of keys) {
34-
this[key] = config[key]
35+
this.meta[key] = config[key]
3536
delete config[key]
3637
}
3738
this.config = config
3839

39-
this.api = this.api || window.meting_api || 'https://api.i-meto.com/meting/api?server=:server&type=:type&id=:id&r=:r'
40-
if (this.auto) this._parse_link()
40+
this.api = this.meta.api || window.meting_api || 'https://api.i-meto.com/meting/api?server=:server&type=:type&id=:id&r=:r'
41+
if (this.meta.auto) this._parse_link()
4142
}
4243

4344
_parse_link() {
@@ -60,42 +61,42 @@ class MetingJSElement extends HTMLElement {
6061

6162
for (let rule of rules) {
6263
let patt = new RegExp(rule[0])
63-
let res = patt.exec(this.auto)
64+
let res = patt.exec(this.meta.auto)
6465
if (res !== null) {
65-
this.server = rule[1]
66-
this.type = rule[2]
67-
this.id = res[1]
66+
this.meta.server = rule[1]
67+
this.meta.type = rule[2]
68+
this.meta.id = res[1]
6869
return
6970
}
7071
}
7172
}
7273

7374
_parse() {
74-
if (this.url) {
75+
if (this.meta.url) {
7576
let result = {
76-
name: this.name || this.title || 'Audio name',
77-
artist: this.artist || this.author || 'Audio artist',
78-
url: this.url,
79-
cover: this.cover || this.pic,
80-
lrc: this.lrc || this.lyric || '',
81-
type: this.type || 'auto',
77+
name: this.meta.name || this.meta.title || 'Audio name',
78+
artist: this.meta.artist || this.meta.author || 'Audio artist',
79+
url: this.meta.url,
80+
cover: this.meta.cover || this.meta.pic,
81+
lrc: this.meta.lrc || this.meta.lyric || '',
82+
type: this.meta.type || 'auto',
8283
}
8384
if (!result.lrc) {
84-
this.lrcType = 0
85+
this.meta.lrcType = 0
8586
}
8687
if (this.innerText) {
8788
result.lrc = this.innerText
88-
this.lrcType = 2
89+
this.meta.lrcType = 2
8990
}
9091
this._loadPlayer([result])
9192
return
9293
}
9394

9495
let url = this.api
95-
.replace(':server', this.server)
96-
.replace(':type', this.type)
97-
.replace(':id', this.id)
98-
.replace(':auth', this.auth)
96+
.replace(':server', this.meta.server)
97+
.replace(':type', this.meta.type)
98+
.replace(':id', this.meta.id)
99+
.replace(':auth', this.meta.auth)
99100
.replace(':r', Math.random())
100101

101102
fetch(url)
@@ -108,7 +109,7 @@ class MetingJSElement extends HTMLElement {
108109
let defaultOption = {
109110
audio: data,
110111
mutex: true,
111-
lrcType: this.lrcType || 3,
112+
lrcType: this.meta.lrcType || 3,
112113
storageName: 'metingjs'
113114
}
114115

@@ -133,7 +134,7 @@ class MetingJSElement extends HTMLElement {
133134

134135
}
135136

136-
console.log('\n %c MetingJS v2.0.0 %c https://github.com/metowolf/MetingJS \n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;')
137+
console.log('\n %c MetingJS v2.0.1 %c https://github.com/metowolf/MetingJS \n', 'color: #fadfa3; background: #030307; padding:5px 0;', 'background: #fadfa3; padding:5px 0;')
137138

138139
if (window.customElements && !window.customElements.get('meting-js')) {
139140
window.MetingJSElement = MetingJSElement

0 commit comments

Comments
 (0)