2019-03-22 22:35:04 +08:00
|
|
|
import * as nav from "./nav.js";
|
|
|
|
import * as mpd from "./lib/mpd.js";
|
2019-03-21 17:32:58 +08:00
|
|
|
import * as player from "./player.js";
|
2019-03-22 22:35:04 +08:00
|
|
|
|
|
|
|
import * as queue from "./queue.js";
|
2019-03-25 22:49:23 +08:00
|
|
|
import * as library from "./library.js";
|
|
|
|
import * as fs from "./fs.js";
|
2019-03-22 22:35:04 +08:00
|
|
|
|
2019-03-25 22:49:23 +08:00
|
|
|
const components = { queue, library, fs };
|
2019-03-22 22:35:04 +08:00
|
|
|
|
|
|
|
export function activate(what) {
|
|
|
|
for (let id in components) {
|
|
|
|
let node = document.querySelector(`#${id}`);
|
|
|
|
if (what == id) {
|
|
|
|
node.style.display = "";
|
|
|
|
components[id].activate();
|
|
|
|
} else {
|
|
|
|
node.style.display = "none";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
nav.active(what);
|
|
|
|
}
|
2019-03-20 03:45:23 +08:00
|
|
|
|
|
|
|
async function init() {
|
2019-03-26 19:35:47 +08:00
|
|
|
await mpd.init();
|
|
|
|
|
2019-03-22 22:35:04 +08:00
|
|
|
nav.init(document.querySelector("nav"));
|
|
|
|
for (let id in components) {
|
|
|
|
let node = document.querySelector(`#${id}`);
|
|
|
|
components[id].init(node);
|
|
|
|
}
|
|
|
|
|
|
|
|
player.init(document.querySelector("#player"));
|
|
|
|
|
2019-03-25 22:49:23 +08:00
|
|
|
activate("fs");
|
2019-03-20 03:45:23 +08:00
|
|
|
}
|
|
|
|
|
2019-03-22 22:35:04 +08:00
|
|
|
|
2019-03-20 03:45:23 +08:00
|
|
|
init();
|