diff options
author | Astound <kirito@disroot.org> | 2025-03-04 11:06:04 +0800 |
---|---|---|
committer | Astound <kirito@disroot.org> | 2025-03-04 11:06:04 +0800 |
commit | a7993781648fefb51444e208d92e7efb7f3ab783 (patch) | |
tree | 742f61d28c8d587ae69cdbcee8ffa91422a4fe76 | |
parent | f64b36260381fe46b739a9821d3e850e82e5848b (diff) | |
download | yt-local-a7993781648fefb51444e208d92e7efb7f3ab783.tar.lz yt-local-a7993781648fefb51444e208d92e7efb7f3ab783.tar.xz yt-local-a7993781648fefb51444e208d92e7efb7f3ab783.zip |
Renew plyr UI and simplify elements
-rw-r--r-- | youtube/static/js/plyr-start.js | 19 | ||||
-rw-r--r-- | youtube/static/modules/plyr/custom_plyr.css | 44 |
2 files changed, 63 insertions, 0 deletions
diff --git a/youtube/static/js/plyr-start.js b/youtube/static/js/plyr-start.js index 3838acc..4188829 100644 --- a/youtube/static/js/plyr-start.js +++ b/youtube/static/js/plyr-start.js @@ -133,4 +133,23 @@ // Needed so controls won't be hidden before playback has started player.started = false; player.once('playing', function(){this.started = true}); + + // Custom styles for plyr similar to shaka-player + const playerUI = document.querySelector(".plyr"); + if (playerUI) { + playerUI.classList.add("plyr--minimal"); + const controls = document.querySelector(".plyr__controls"); + const progressContainer = document.querySelector(".plyr__progress__container"); + const topControls = document.createElement("div"); + topControls.classList.add("plyr__controls__top"); + document.querySelectorAll(".plyr__controls__item").forEach((item) => { + if (!item.classList.contains("plyr__progress__container")) { + topControls.appendChild(item); + } + }); + // Insert new structure to player + controls.prepend(topControls); + controls.appendChild(progressContainer); + } + // End of custom styles })(); diff --git a/youtube/static/modules/plyr/custom_plyr.css b/youtube/static/modules/plyr/custom_plyr.css index 0fd3c52..fd2034b 100644 --- a/youtube/static/modules/plyr/custom_plyr.css +++ b/youtube/static/modules/plyr/custom_plyr.css @@ -37,3 +37,47 @@ e.g. Firefox playback speed options */ max-height: 320px; overflow-y: auto; } + + +/* +* Custom styles for plyr similar to shaka-player +*/ +.plyr__controls__top { + display: flex; + justify-content: space-between; + align-items: center; + width: 100%; + padding: 0px 10px; +} + +.plyr__progress__container { + display: flex; + justify-content: center; + width: 100%; + padding: 5px 0; +} + +.plyr__progress { + width: 100%; +} + +.plyr__controls { + flex-direction: column; +} + +.plyr__controls .plyr__controls__item:first-child { + margin-left: 0; + margin-right: 0; +} + +.plyr__controls .plyr__controls__item.plyr__volume { + margin-left: auto; +} + +.plyr__controls .plyr__controls__item.plyr__progress__container { + padding-left: 10px; + padding-right: 10px; +} +/* +* End custom styles for plyr similar to shaka-player +*/ |