diff options
author | Aaron Kerckhoff <aaronkerckhoff@gmail.com> | 2022-07-24 19:48:10 +0300 |
---|---|---|
committer | Aaron Kerckhoff <aaronkerckhoff@gmail.com> | 2022-07-24 20:00:33 +0300 |
commit | 08bdfe1632dab00d768299a1a1e2a293bd8e2e2f (patch) | |
tree | ab63c36fea2dec0752a19e09104b95497120c369 | |
parent | fd49f02b383b0088fe9f2cbcae0970626cf44259 (diff) |
Add ratio bar to new design
-rw-r--r-- | Extensions/combined/content-style.css | 2 | ||||
-rw-r--r-- | Extensions/combined/src/bar.js | 13 | ||||
-rw-r--r-- | Extensions/combined/src/state.js | 5 |
3 files changed, 16 insertions, 4 deletions
diff --git a/Extensions/combined/content-style.css b/Extensions/combined/content-style.css index e2e5fa2..d8da7db 100644 --- a/Extensions/combined/content-style.css +++ b/Extensions/combined/content-style.css @@ -41,6 +41,6 @@ height: 2px; position: absolute; padding-top: 6px; - padding-bottom: 28px; + padding-bottom: 12px; top: -6px; } diff --git a/Extensions/combined/src/bar.js b/Extensions/combined/src/bar.js index c56ab57..0c8e328 100644 --- a/Extensions/combined/src/bar.js +++ b/Extensions/combined/src/bar.js @@ -1,5 +1,5 @@ import { getButtons } from "./buttons"; -import { extConfig, isMobile, isLikesDisabled } from "./state"; +import { extConfig, isMobile, isLikesDisabled, isNewDesign } from "./state"; import { cLog, getColorFromTheme } from "./utils"; function createRateBar(likes, dislikes) { @@ -23,12 +23,12 @@ function createRateBar(likes, dislikes) { } ( - document.getElementById("menu-container") || + document.getElementById(isNewDesign() ? "actions-inner" : "menu-container") || document.querySelector("ytm-slim-video-action-bar-renderer") ).insertAdjacentHTML( "beforeend", ` - <div class="ryd-tooltip" style="width: ${widthPx}px"> + <div class="ryd-tooltip" style="width: ${widthPx}px${isNewDesign() ? "; margin-bottom: -2px" : ""}"> <div class="ryd-tooltip-bar-container"> <div id="ryd-bar-container" @@ -46,6 +46,13 @@ function createRateBar(likes, dislikes) { </div> ` ); + + // Add border between info and comments + if (isNewDesign()) { + let descriptionAndActionsElement = document.getElementById("top-row"); + descriptionAndActionsElement.style.borderBottom = "1px solid var(--yt-spec-10-percent-layer)"; + descriptionAndActionsElement.style.paddingBottom = "10px"; + } } else { document.getElementById("ryd-bar-container").style.width = widthPx + "px"; document.getElementById("ryd-bar").style.width = widthPercent + "%"; diff --git a/Extensions/combined/src/state.js b/Extensions/combined/src/state.js index 7160903..15684eb 100644 --- a/Extensions/combined/src/state.js +++ b/Extensions/combined/src/state.js @@ -40,6 +40,10 @@ function isShorts() { return location.pathname.startsWith("/shorts"); } +function isNewDesign() { + return document.getElementById("comment-teaser") !== null; +} + let mutationObserver = new Object(); if (isShorts() && mutationObserver.exists !== true) { @@ -332,6 +336,7 @@ export { isShorts, isVideoDisliked, isVideoLiked, + isNewDesign, getState, setState, setInitialState, |