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/ryd.background.js')
-rw-r--r--Extensions/combined/ryd.background.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js
index 75f22ae..b6b6b67 100644
--- a/Extensions/combined/ryd.background.js
+++ b/Extensions/combined/ryd.background.js
@@ -77,6 +77,8 @@ api.runtime.onInstalled.addListener((details) => {
if (
// No need to show changelog if its was a browser update (and not extension update)
details.reason === "browser_update" ||
+ // Chromium (e.g., Google Chrome Cannary) uses this name instead of the one above for some reason
+ details.reason === "chrome_update" ||
// No need to show changelog if developer just reloaded the extension
details.reason === "update"
)
@@ -277,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) {
@@ -292,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;
}
@@ -333,6 +352,8 @@ function initExtConfig() {
initializeNumberDisplayFormat();
initializeNumberDisplayRoundDown();
initializeNumberDisplayReformatLikes();
+ initializeTooltipPercentage();
+ initializeTooltipPercentageMode();
}
function initializeDisableVoteSubmission() {
@@ -396,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) {