put font-awesome cast icon in span

This commit is contained in:
Roy Olav Purser 2021-06-10 12:23:55 +02:00
parent f04d343bdf
commit 9193895e45
Signed by: roypur
GPG Key ID: E14D26A036F21656
3 changed files with 27 additions and 19 deletions

View File

@ -30,7 +30,6 @@ fs.readFile("/app/setup/chromecast.css", "utf-8", (err, a) => {
if(err === null) { if(err === null) {
data = b + "\n" + data + "\n"; data = b + "\n" + data + "\n";
} }
console.log(data);
fs.writeFile("/app/style.css", css.stringify(css.parse(data), {"compress": true}), (err) => { fs.writeFile("/app/style.css", css.stringify(css.parse(data), {"compress": true}), (err) => {
if(err !== null) { if(err !== null) {
console.log(err); console.log(err);

View File

@ -32,28 +32,40 @@
} }
cbutton.text = "Chromecast"; cbutton.text = "Chromecast";
const bigCastButton = new Button(player, cbutton); const bigCastButtonWrapper = new Button(player, cbutton);
bigCastButton.addClass("fab"); const bigCastButton = bigCastButtonWrapper.el();
bigCastButton.addClass("fa-chromecast"); for(const elem of bigCastButton.children) {
bigCastButton.addClass("vjs-control"); bigCastButton.removeChild(elem);
bigCastButton.addClass("vjs-button"); }
bigCastButton.addClass("vjs-big-chromecast"); bigCastButton.classList.add("vjs-control");
player.addChild(bigCastButton); 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.one("error", () => {
player.removeChild(bigCastButton); player.removeChild(bigCastButtonWrapper);
}); });
player.one("play", () => { player.one("play", () => {
player.removeChild(bigCastButton); player.removeChild(bigCastButtonWrapper);
}); });
const smallCastButton = new Button(player, cbutton); const smallCastButtonWrapper = new Button(player, cbutton);
smallCastButton.addClass("fab"); const smallCastButton = smallCastButtonWrapper.el();
smallCastButton.addClass("fa-chromecast"); smallCastButton.classList.add("vjs-control");
smallCastButton.addClass("vjs-control"); smallCastButton.classList.add("vjs-button");
smallCastButton.addClass("vjs-button");
player.controlBar.addChild(smallCastButton); 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", () => { player.on("chromecastConnected", () => {
if(player.volume() > 0.3) { if(player.volume() > 0.3) {
player.volume(0.2); player.volume(0.2);

View File

@ -1,9 +1,6 @@
body { body {
margin: 0px; margin: 0px;
} }
.fa-chromecast:before {
font-size: 1.2em;
}
.vjs-button { .vjs-button {
cursor:pointer; cursor:pointer;
} }