Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Anarios/return-youtube-dislike.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Extensions/combined/src/state.js')
-rw-r--r--Extensions/combined/src/state.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/Extensions/combined/src/state.js b/Extensions/combined/src/state.js
index 15684eb..8b0c519 100644
--- a/Extensions/combined/src/state.js
+++ b/Extensions/combined/src/state.js
@@ -23,6 +23,8 @@ let extConfig = {
colorTheme: "classic",
numberDisplayFormat: "compactShort",
numberDisplayRoundDown: true,
+ showTooltipPercentage: false,
+ tooltipPercentageMode: "dash_like",
numberDisplayReformatLikes: false,
};
@@ -155,10 +157,10 @@ function getLikeCountFromButton() {
if (isShorts()) {
//Youtube Shorts don't work with this query. It's not nessecary; we can skip it and still see the results.
//It should be possible to fix this function, but it's not critical to showing the dislike count.
- return 0;
+ return false;
}
let likesStr = getLikeButton()
- .querySelector("button")
+ .querySelector("yt-formatted-string#text")
.getAttribute("aria-label")
.replace(/\D/g, "");
return likesStr.length > 0 ? parseInt(likesStr) : false;
@@ -258,6 +260,8 @@ function initExtConfig() {
initializeColorTheme();
initializeNumberDisplayFormat();
initializeNumberDisplayRoundDown();
+ initializeTooltipPercentage();
+ initializeTooltipPercentageMode();
initializeNumberDisplayReformatLikes();
}
@@ -321,6 +325,26 @@ function initializeNumberDisplayFormat() {
});
}
+function initializeTooltipPercentage() {
+ getBrowser().storage.sync.get(["showTooltipPercentage"], (res) => {
+ if (res.showTooltipPercentage === undefined) {
+ getBrowser().storage.sync.set({ showTooltipPercentage: false });
+ } else {
+ extConfig.showTooltipPercentage = res.showTooltipPercentage;
+ }
+ });
+}
+
+function initializeTooltipPercentageMode() {
+ getBrowser().storage.sync.get(["tooltipPercentageMode"], (res) => {
+ if (res.tooltipPercentageMode === undefined) {
+ getBrowser().storage.sync.set({ tooltipPercentageMode: "dash_like" });
+ } else {
+ extConfig.tooltipPercentageMode = res.tooltipPercentageMode;
+ }
+ });
+}
+
function initializeNumberDisplayReformatLikes() {
getBrowser().storage.sync.get(["numberDisplayReformatLikes"], (res) => {
if (res.numberDisplayReformatLikes === undefined) {