mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 02:41:22 +01:00
Merge issues fixed, core reformatted with prettier
This commit is contained in:
1 parent
6894a706aa
commit
b7029ce426
14 files changed
+315
-275
No files matched your search
@@ -1,9 +1,6 @@
|
||||
import { getButtons } from "./buttons";
|
||||
import { likesDisabledState, extConfig } from "./state";
|
||||
import {
|
||||
cLog,
|
||||
getColorFromTheme,
|
||||
} from "./utils";
|
||||
import { cLog, getColorFromTheme } from "./utils";
|
||||
import { isMobile, likesDisabledState } from "./state";
|
||||
import { cLog } from "./utils";
|
||||
function createRateBar(likes, dislikes) {
|
||||
@@ -18,22 +15,21 @@ function createRateBar(likes, dislikes) {
|
||||
const widthPercent =
|
||||
likes + dislikes > 0 ? (likes / (likes + dislikes)) * 100 : 50;
|
||||
|
||||
|
||||
if (!rateBar) {
|
||||
let colorLikeStyle = '';
|
||||
let colorDislikeStyle = '';
|
||||
let colorLikeStyle = "";
|
||||
let colorDislikeStyle = "";
|
||||
if (extConfig.coloredBar) {
|
||||
colorLikeStyle = '; background-color: ' + getColorFromTheme(true);
|
||||
colorDislikeStyle = '; background-color: ' + getColorFromTheme(false);
|
||||
colorLikeStyle = "; background-color: " + getColorFromTheme(true);
|
||||
colorDislikeStyle = "; background-color: " + getColorFromTheme(false);
|
||||
}
|
||||
|
||||
if (!rateBar && !isMobile()) {
|
||||
(
|
||||
document.getElementById("menu-container") ||
|
||||
document.querySelector("ytm-slim-video-action-bar-renderer")
|
||||
).insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`
|
||||
if (!rateBar && !isMobile()) {
|
||||
(
|
||||
document.getElementById("menu-container") ||
|
||||
document.querySelector("ytm-slim-video-action-bar-renderer")
|
||||
).insertAdjacentHTML(
|
||||
"beforeend",
|
||||
`
|
||||
<div class="ryd-tooltip" style="width: ${widthPx}px">
|
||||
<div class="ryd-tooltip-bar-container">
|
||||
<div
|
||||
@@ -51,22 +47,26 @@ function createRateBar(likes, dislikes) {
|
||||
</tp-yt-paper-tooltip>
|
||||
</div>
|
||||
`
|
||||
);
|
||||
} else {
|
||||
document.getElementById("ryd-bar-container").style.width = widthPx + "px";
|
||||
document.getElementById("ryd-bar").style.width = widthPercent + "%";
|
||||
document.querySelector(
|
||||
"#ryd-dislike-tooltip > #tooltip"
|
||||
).innerHTML = `${likes.toLocaleString()} / ${dislikes.toLocaleString()}`;
|
||||
if (extConfig.coloredBar) {
|
||||
document.getElementById("ryd-bar-container").style.backgroundColor = getColorFromTheme(false);
|
||||
document.getElementById("ryd-bar").style.backgroundColor = getColorFromTheme(true);
|
||||
);
|
||||
} else {
|
||||
document.getElementById("ryd-bar-container").style.width =
|
||||
widthPx + "px";
|
||||
document.getElementById("ryd-bar").style.width = widthPercent + "%";
|
||||
document.querySelector(
|
||||
"#ryd-dislike-tooltip > #tooltip"
|
||||
).innerHTML = `${likes.toLocaleString()} / ${dislikes.toLocaleString()}`;
|
||||
if (extConfig.coloredBar) {
|
||||
document.getElementById("ryd-bar-container").style.backgroundColor =
|
||||
getColorFromTheme(false);
|
||||
document.getElementById("ryd-bar").style.backgroundColor =
|
||||
getColorFromTheme(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
cLog("removing bar");
|
||||
let ratebar = document.getElementById("ryd-bar-container");
|
||||
ratebar.parentNode.removeChild(ratebar);
|
||||
}
|
||||
} else {
|
||||
cLog("removing bar");
|
||||
let ratebar = document.getElementById("ryd-bar-container");
|
||||
ratebar.parentNode.removeChild(ratebar);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user