diff options
Diffstat (limited to 'Extensions/combined/ryd.background.js')
-rw-r--r-- | Extensions/combined/ryd.background.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index 75f22ae..c416da9 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,16 @@ 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 +304,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 +356,8 @@ function initExtConfig() { initializeNumberDisplayFormat(); initializeNumberDisplayRoundDown(); initializeNumberDisplayReformatLikes(); + initializeTooltipPercentage(); + initializeTooltipPercentageMode(); } function initializeDisableVoteSubmission() { @@ -396,6 +421,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) { |