docsify-plugin-meting-api
Version:
A docsify.js plugin for meting-api.
1 lines • 1.42 kB
JavaScript
(()=>{"use strict";class i{constructor(o){i.instances={},this.options=o,this.init()}instances(){return i.instances}init(){const i=this;this.getPlaylist(i.options.playlists[0],(function(o){void 0===i.options.audio&&(i.options.audio=[]),i.options.audio=i.options.audio.concat(o),void 0===i.options.elementId&&(i.options.elementId="aplayer"),void 0===i.options.api&&(i.options.api="https://api.i-meto.com/meting/api"),i.options.element=document.getElementById(i.options.elementId),i.aplayer=new APlayer(i.options),i.lazyLoading()}))}lazyLoading(){const i=this;for(var o=1;o<this.options.playlists.length;o++)this.getPlaylist(this.options.playlists[o],(function(o){i.aplayer.list.add(o),console.log("lazyLoaded: playlist +1")}))}getPlaylist(i,o){axios.get(this.options.api,{params:i}).then((function(i){200==i.status&&o(i.data)})).catch((function(i){console.log(i)}))}}window.$docsify=window.$docsify||{},window.$docsify.MetingAPI=Object.assign({elementId:"aplayer",api:"https://api.i-meto.com/meting/api",fixed:!0,autoplay:!0,lrcType:3,order:"random",loop:"all",mutex:!0,theme:"#b7daff",playlists:[]},window.$docsify.MetingAPI),window.$docsify.plugins=(window.$docsify.plugins||[]).concat((function(o,t){let n=Docsify.dom;window.$docsify.MetingAPI&&(o.mounted((function(){let i=n.create("div");i.id=window.$docsify.MetingAPI.elementId,n.appendTo(n.body,i)})),o.ready((function(){new i(window.$docsify.MetingAPI)})))}))})();