diff --git a/backend/style.js b/backend/style.js index cc90053..0f79cf0 100644 --- a/backend/style.js +++ b/backend/style.js @@ -30,7 +30,6 @@ fs.readFile("/app/setup/chromecast.css", "utf-8", (err, a) => { if(err === null) { data = b + "\n" + data + "\n"; } - console.log(data); fs.writeFile("/app/style.css", css.stringify(css.parse(data), {"compress": true}), (err) => { if(err !== null) { console.log(err); diff --git a/frontend/script.js b/frontend/script.js index 89b201e..94f7b69 100644 --- a/frontend/script.js +++ b/frontend/script.js @@ -32,28 +32,40 @@ } cbutton.text = "Chromecast"; - const bigCastButton = new Button(player, cbutton); - bigCastButton.addClass("fab"); - bigCastButton.addClass("fa-chromecast"); - bigCastButton.addClass("vjs-control"); - bigCastButton.addClass("vjs-button"); - bigCastButton.addClass("vjs-big-chromecast"); - player.addChild(bigCastButton); + const bigCastButtonWrapper = new Button(player, cbutton); + const bigCastButton = bigCastButtonWrapper.el(); + for(const elem of bigCastButton.children) { + bigCastButton.removeChild(elem); + } + bigCastButton.classList.add("vjs-control"); + bigCastButton.classList.add("vjs-button"); + bigCastButton.classList.add("fab"); + bigCastButton.classList.add("fa-chromecast"); + bigCastButton.classList.add("vjs-big-chromecast"); + player.addChild(bigCastButtonWrapper); player.one("error", () => { - player.removeChild(bigCastButton); + player.removeChild(bigCastButtonWrapper); }); player.one("play", () => { - player.removeChild(bigCastButton); + player.removeChild(bigCastButtonWrapper); }); - const smallCastButton = new Button(player, cbutton); - smallCastButton.addClass("fab"); - smallCastButton.addClass("fa-chromecast"); - smallCastButton.addClass("vjs-control"); - smallCastButton.addClass("vjs-button"); - player.controlBar.addChild(smallCastButton); + const smallCastButtonWrapper = new Button(player, cbutton); + const smallCastButton = smallCastButtonWrapper.el(); + smallCastButton.classList.add("vjs-control"); + smallCastButton.classList.add("vjs-button"); + + for(const elem of smallCastButton.children) { + if(elem.classList.contains("vjs-icon-placeholder")) { + elem.classList.add("fab"); + elem.classList.add("fa-chromecast"); + } + } + + player.controlBar.addChild(smallCastButtonWrapper); + player.on("chromecastConnected", () => { if(player.volume() > 0.3) { player.volume(0.2); diff --git a/frontend/style.css b/frontend/style.css index dc443eb..557d28a 100644 --- a/frontend/style.css +++ b/frontend/style.css @@ -1,9 +1,6 @@ body { margin: 0px; } -.fa-chromecast:before { - font-size: 1.2em; -} .vjs-button { cursor:pointer; }