mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-28 17:07:55 +01:00
Merge pull request #560 from ErykDarnowski/main
Implemented option to show like/dislike percentage instead of full like/dislike count
This commit is contained in:
7 files changed
+229
-48
No files matched your search
@@ -279,6 +279,12 @@ function storageChangeHandler(changes, area) {
|
||||
changes.numberDisplayReformatLikes.newValue
|
||||
);
|
||||
}
|
||||
if (changes.showTooltipPercentage !== undefined) {
|
||||
handleShowTooltipPercentageChangeEvent(changes.showTooltipPercentage.newValue);
|
||||
}
|
||||
if (changes.numberDisplayReformatLikes !== undefined) {
|
||||
handleNumberDisplayReformatLikesChangeEvent(changes.numberDisplayReformatLikes.newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisableVoteSubmissionChangeEvent(value) {
|
||||
@@ -294,6 +300,17 @@ function handleNumberDisplayFormatChangeEvent(value) {
|
||||
extConfig.numberDisplayFormat = value;
|
||||
}
|
||||
|
||||
function handleShowTooltipPercentageChangeEvent(value) {
|
||||
extConfig.showTooltipPercentage = value;
|
||||
};
|
||||
|
||||
function handleTooltipPercentageModeChangeEvent(value) {
|
||||
if (!value) {
|
||||
value = "dash_like";
|
||||
}
|
||||
extConfig.tooltipPercentageMode = value;
|
||||
};
|
||||
|
||||
function handleNumberDisplayRoundDownChangeEvent(value) {
|
||||
extConfig.numberDisplayRoundDown = value;
|
||||
}
|
||||
@@ -335,6 +352,8 @@ function initExtConfig() {
|
||||
initializeNumberDisplayFormat();
|
||||
initializeNumberDisplayRoundDown();
|
||||
initializeNumberDisplayReformatLikes();
|
||||
initializeTooltipPercentage();
|
||||
initializeTooltipPercentageMode();
|
||||
}
|
||||
|
||||
function initializeDisableVoteSubmission() {
|
||||
@@ -398,6 +417,26 @@ function initializeNumberDisplayFormat() {
|
||||
});
|
||||
}
|
||||
|
||||
function initializeTooltipPercentage() {
|
||||
api.storage.sync.get(["showTooltipPercentage"], (res) => {
|
||||
if (res.showTooltipPercentage === undefined) {
|
||||
api.storage.sync.set({ showTooltipPercentage: false });
|
||||
} else {
|
||||
extConfig.showTooltipPercentage = res.showTooltipPercentage;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeTooltipPercentageMode() {
|
||||
api.storage.sync.get(["tooltipPercentageMode"], (res) => {
|
||||
if (res.tooltipPercentageMode === undefined) {
|
||||
api.storage.sync.set({ tooltipPercentageMode: "dash_like" });
|
||||
} else {
|
||||
extConfig.tooltipPercentageMode = res.tooltipPercentageMode;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayReformatLikes() {
|
||||
api.storage.sync.get(["numberDisplayReformatLikes"], (res) => {
|
||||
if (res.numberDisplayReformatLikes === undefined) {
|
||||
|
||||
Reference in new issue
Block a user