mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-22 22:33:01 +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 { extConfig, isMobile, isLikesDisabled } from "./state";
|
||||
import { extConfig, isMobile, isLikesDisabled, isShorts } from "./state";
|
||||
import { cLog, getColorFromTheme } from "./utils";
|
||||
|
||||
function createRateBar(likes, dislikes) {
|
||||
@@ -41,49 +41,51 @@ function createRateBar(likes, dislikes) {
|
||||
}
|
||||
|
||||
|
||||
if (!rateBar && !isMobile()) {
|
||||
let colorLikeStyle = "";
|
||||
let colorDislikeStyle = "";
|
||||
if (extConfig.coloredBar) {
|
||||
colorLikeStyle = "; background-color: " + getColorFromTheme(true);
|
||||
colorDislikeStyle = "; background-color: " + getColorFromTheme(false);
|
||||
}
|
||||
if (!isShorts()) {
|
||||
if (!rateBar && !isMobile()) {
|
||||
let colorLikeStyle = "";
|
||||
let colorDislikeStyle = "";
|
||||
if (extConfig.coloredBar) {
|
||||
colorLikeStyle = "; background-color: " + getColorFromTheme(true);
|
||||
colorDislikeStyle = "; background-color: " + getColorFromTheme(false);
|
||||
}
|
||||
|
||||
(
|
||||
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
|
||||
id="ryd-bar-container"
|
||||
style="width: 100%; height: 2px;${colorDislikeStyle}"
|
||||
>
|
||||
<div
|
||||
id="ryd-bar"
|
||||
style="width: ${widthPercent}%; height: 100%${colorLikeStyle}"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<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}
|
||||
</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 = tooltipInnerHTML;
|
||||
if (extConfig.coloredBar) {
|
||||
document.getElementById("ryd-bar-container").style.backgroundColor =
|
||||
getColorFromTheme(false);
|
||||
document.getElementById("ryd-bar").style.backgroundColor =
|
||||
getColorFromTheme(true);
|
||||
(
|
||||
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
|
||||
id="ryd-bar-container"
|
||||
style="width: 100%; height: 2px;${colorDislikeStyle}"
|
||||
>
|
||||
<div
|
||||
id="ryd-bar"
|
||||
style="width: ${widthPercent}%; height: 100%${colorLikeStyle}"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<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}
|
||||
</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 = tooltipInnerHTML;
|
||||
if (extConfig.coloredBar) {
|
||||
document.getElementById("ryd-bar-container").style.backgroundColor =
|
||||
getColorFromTheme(false);
|
||||
document.getElementById("ryd-bar").style.backgroundColor =
|
||||
getColorFromTheme(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user