@@ -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
138139if ( window . customElements && ! window . customElements . get ( 'meting-js' ) ) {
139140 window . MetingJSElement = MetingJSElement
0 commit comments