mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-25 15:53:01 +01:00
Add ratio display to new design
This commit is contained in:
1 parent
a6985cb753
commit
1be31bbb07
2 files changed
+9
-4
No files matched your search
@@ -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-top: -10px; margin-bottom: 15px" : ""}">
|
||||
<div class="ryd-tooltip-bar-container">
|
||||
<div
|
||||
id="ryd-bar-container"
|
||||
@@ -62,7 +62,7 @@ function createRateBar(likes, dislikes) {
|
||||
} else {
|
||||
cLog("removing bar");
|
||||
let ratebar = document.getElementById("ryd-bar-container");
|
||||
if(ratebar) {
|
||||
if (ratebar) {
|
||||
ratebar.parentNode.removeChild(ratebar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,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) {
|
||||
@@ -330,6 +334,7 @@ export {
|
||||
isShorts,
|
||||
isVideoDisliked,
|
||||
isVideoLiked,
|
||||
isNewDesign,
|
||||
getState,
|
||||
setState,
|
||||
setInitialState,
|
||||
|
||||
Reference in new issue
Block a user