mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 02:41:22 +01:00
Bug fix (insertAdjacentHTML err when viewing shorts)
This commit is contained in:
1 parent
49d62522b6
commit
fee5ed916c
1 file changed
+45
-43
@@ -1,5 +1,5 @@
|
|||||||
import { getButtons } from "./buttons";
|
import { getButtons } from "./buttons";
|
||||||
import { extConfig, isMobile, isLikesDisabled } from "./state";
|
import { extConfig, isMobile, isLikesDisabled, isShorts } from "./state";
|
||||||
import { cLog, getColorFromTheme } from "./utils";
|
import { cLog, getColorFromTheme } from "./utils";
|
||||||
|
|
||||||
function createRateBar(likes, dislikes) {
|
function createRateBar(likes, dislikes) {
|
||||||
@@ -41,49 +41,51 @@ function createRateBar(likes, dislikes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!rateBar && !isMobile()) {
|
if (!isShorts()) {
|
||||||
let colorLikeStyle = "";
|
if (!rateBar && !isMobile()) {
|
||||||
let colorDislikeStyle = "";
|
let colorLikeStyle = "";
|
||||||
if (extConfig.coloredBar) {
|
let colorDislikeStyle = "";
|
||||||
colorLikeStyle = "; background-color: " + getColorFromTheme(true);
|
if (extConfig.coloredBar) {
|
||||||
colorDislikeStyle = "; background-color: " + getColorFromTheme(false);
|
colorLikeStyle = "; background-color: " + getColorFromTheme(true);
|
||||||
}
|
colorDislikeStyle = "; background-color: " + getColorFromTheme(false);
|
||||||
|
}
|
||||||
|
|
||||||
(
|
(
|
||||||
document.getElementById("menu-container") ||
|
document.getElementById("menu-container") ||
|
||||||
document.querySelector("ytm-slim-video-action-bar-renderer")
|
document.querySelector("ytm-slim-video-action-bar-renderer")
|
||||||
).insertAdjacentHTML(
|
).insertAdjacentHTML(
|
||||||
"beforeend",
|
"beforeend",
|
||||||
`
|
`
|
||||||
<div class="ryd-tooltip" style="width: ${widthPx}px">
|
<div class="ryd-tooltip" style="width: ${widthPx}px">
|
||||||
<div class="ryd-tooltip-bar-container">
|
<div class="ryd-tooltip-bar-container">
|
||||||
<div
|
<div
|
||||||
id="ryd-bar-container"
|
id="ryd-bar-container"
|
||||||
style="width: 100%; height: 2px;${colorDislikeStyle}"
|
style="width: 100%; height: 2px;${colorDislikeStyle}"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
id="ryd-bar"
|
id="ryd-bar"
|
||||||
style="width: ${widthPercent}%; height: 100%${colorLikeStyle}"
|
style="width: ${widthPercent}%; height: 100%${colorLikeStyle}"
|
||||||
></div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<tp-yt-paper-tooltip position="top" id="ryd-dislike-tooltip" class="style-scope ytd-sentiment-bar-renderer" role="tooltip" tabindex="-1">
|
<tp-yt-paper-tooltip position="top" id="ryd-dislike-tooltip" class="style-scope ytd-sentiment-bar-renderer" role="tooltip" tabindex="-1">
|
||||||
<!--css-build:shady-->${tooltipInnerHTML}
|
<!--css-build:shady-->${tooltipInnerHTML}
|
||||||
</tp-yt-paper-tooltip>
|
</tp-yt-paper-tooltip>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
document.getElementById("ryd-bar-container").style.width = widthPx + "px";
|
document.getElementById("ryd-bar-container").style.width = widthPx + "px";
|
||||||
document.getElementById("ryd-bar").style.width = widthPercent + "%";
|
document.getElementById("ryd-bar").style.width = widthPercent + "%";
|
||||||
document.querySelector(
|
document.querySelector(
|
||||||
"#ryd-dislike-tooltip > #tooltip"
|
"#ryd-dislike-tooltip > #tooltip"
|
||||||
).innerHTML = tooltipInnerHTML;
|
).innerHTML = tooltipInnerHTML;
|
||||||
if (extConfig.coloredBar) {
|
if (extConfig.coloredBar) {
|
||||||
document.getElementById("ryd-bar-container").style.backgroundColor =
|
document.getElementById("ryd-bar-container").style.backgroundColor =
|
||||||
getColorFromTheme(false);
|
getColorFromTheme(false);
|
||||||
document.getElementById("ryd-bar").style.backgroundColor =
|
document.getElementById("ryd-bar").style.backgroundColor =
|
||||||
getColorFromTheme(true);
|
getColorFromTheme(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in new issue
Block a user