diff --git a/Extensions/combined/changelog/changelog.js b/Extensions/combined/changelog/changelog.js index 8c9e332..fbef6c9 100644 --- a/Extensions/combined/changelog/changelog.js +++ b/Extensions/combined/changelog/changelog.js @@ -6,7 +6,6 @@ const config = { coloredBar: false, colorTheme: "classic", numberDisplayFormat: "compactShort", - numberDisplayRoundDown: true, showAdvancedMessage: '', hideAdvancedMessage: diff --git a/Extensions/combined/manifest-firefox.json b/Extensions/combined/manifest-firefox.json index 82fd897..f304c6a 100644 --- a/Extensions/combined/manifest-firefox.json +++ b/Extensions/combined/manifest-firefox.json @@ -29,11 +29,12 @@ "js": ["ryd.content-script.js"] } ] - // , - // "browser_specific_settings": { - // "gecko": { - // "id": "addon@example.com", - // "strict_min_version": "42.0" - // } - // } + // uncomment this section for local storage to work in firefox locally + , + "browser_specific_settings": { + "gecko": { + "id": "addon@example.com", + "strict_min_version": "42.0" + } + } } diff --git a/Extensions/combined/popup.html b/Extensions/combined/popup.html index aa2e508..719d082 100644 --- a/Extensions/combined/popup.html +++ b/Extensions/combined/popup.html @@ -104,21 +104,15 @@
- -

@@ -134,13 +128,13 @@

@@ -184,7 +178,7 @@ data-hover="Display percentage in like/dislike bar tooltip." > - + Percentage in like/dislike bar tooltip.
diff --git a/Extensions/combined/popup.js b/Extensions/combined/popup.js index cf72829..1c7a832 100644 --- a/Extensions/combined/popup.js +++ b/Extensions/combined/popup.js @@ -8,7 +8,6 @@ const config = { coloredBar: false, colorTheme: "classic", numberDisplayFormat: "compactShort", - numberDisplayRoundDown: true, showTooltipPercentage: false, tooltipPercentageMode: "dash_like", numberDisplayReformatLikes: false, @@ -81,10 +80,6 @@ document.getElementById("color_theme").addEventListener("click", (ev) => { chrome.storage.sync.set({ colorTheme: ev.target.value }); }); -document.getElementById("number_round_down").addEventListener("click", (ev) => { - chrome.storage.sync.set({ numberDisplayRoundDown: ev.target.checked }); - updateNumberDisplayFormatContent(ev.target.checked); -}); document.getElementById("number_format").addEventListener("change", (ev) => { chrome.storage.sync.set({ numberDisplayFormat: ev.target.value }); @@ -135,7 +130,6 @@ function initConfig() { initializeColoredBar(); initializeColorTheme(); initializeNumberDisplayFormat(); - initializeNumberDisplayRoundDown(); initializeTooltipPercentage(); initializeTooltipPercentageMode(); initializeNumberDisplayReformatLikes(); @@ -203,11 +197,6 @@ function initializeColorTheme() { }); } -function initializeNumberDisplayRoundDown() { - chrome.storage.sync.get(["numberDisplayRoundDown"], (res) => { - handleNumberDisplayRoundDownChangeEvent(res.numberDisplayRoundDown); - }); -} function initializeTooltipPercentage() { chrome.storage.sync.get(["showTooltipPercentage"], (res) => { @@ -228,13 +217,8 @@ function initializeNumberDisplayFormat() { updateNumberDisplayFormatContent(); } -function updateNumberDisplayFormatContent(roundDown) { - let testValue; - if (roundDown) { - testValue = 123000; - } else { - testValue = 123456; - } +function updateNumberDisplayFormatContent() { + let testValue = 123456; document.getElementById("number_format_compactShort").innerHTML = getNumberFormatter("compactShort").format(testValue); document.getElementById("number_format_compactLong").innerHTML = @@ -266,11 +250,6 @@ function storageChangeHandler(changes, area) { if (changes.colorTheme !== undefined) { handleColorThemeChangeEvent(changes.colorTheme.newValue); } - if (changes.numberDisplayRoundDown !== undefined) { - handleNumberDisplayRoundDownChangeEvent( - changes.numberDisplayRoundDown.newValue - ); - } if (changes.numberDisplayFormat !== undefined) { handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue); } @@ -319,10 +298,7 @@ function updateColorThemePreviewContent(themeName) { getColorFromTheme(themeName, false); } -function handleNumberDisplayRoundDownChangeEvent(value) { - config.numberDisplayRoundDown = value; - document.getElementById("number_round_down").checked = value; -} + function handleNumberDisplayFormatChangeEvent(value) { config.numberDisplayFormat = value; diff --git a/Extensions/combined/ryd.background.js b/Extensions/combined/ryd.background.js index c416da9..edc5b6f 100644 --- a/Extensions/combined/ryd.background.js +++ b/Extensions/combined/ryd.background.js @@ -10,7 +10,6 @@ let extConfig = { coloredBar: false, colorTheme: "classic", // classic, accessible, neon numberDisplayFormat: "compactShort", // compactShort, compactLong, standard - numberDisplayRoundDown: true, // locale 'de' shows exact numbers by default numberDisplayReformatLikes: false, // use existing (native) likes number }; @@ -266,11 +265,6 @@ function storageChangeHandler(changes, area) { if (changes.colorTheme !== undefined) { handleColorThemeChangeEvent(changes.colorTheme.newValue); } - if (changes.numberDisplayRoundDown !== undefined) { - handleNumberDisplayRoundDownChangeEvent( - changes.numberDisplayRoundDown.newValue - ); - } if (changes.numberDisplayFormat !== undefined) { handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue); } @@ -315,10 +309,6 @@ function handleTooltipPercentageModeChangeEvent(value) { extConfig.tooltipPercentageMode = value; } -function handleNumberDisplayRoundDownChangeEvent(value) { - extConfig.numberDisplayRoundDown = value; -} - function changeIcon(iconName) { if (api.action !== undefined) api.action.setIcon({ path: "/icons/" + iconName }); @@ -354,7 +344,6 @@ function initExtConfig() { initializeColoredBar(); initializeColorTheme(); initializeNumberDisplayFormat(); - initializeNumberDisplayRoundDown(); initializeNumberDisplayReformatLikes(); initializeTooltipPercentage(); initializeTooltipPercentageMode(); @@ -381,15 +370,6 @@ function initializeColoredThumbs() { }); } -function initializeNumberDisplayRoundDown() { - api.storage.sync.get(["numberDisplayRoundDown"], (res) => { - if (res.numberDisplayRoundDown === undefined) { - api.storage.sync.set({ numberDisplayRoundDown: true }); - } else { - extConfig.numberDisplayRoundDown = res.numberDisplayRoundDown; - } - }); -} function initializeColoredBar() { api.storage.sync.get(["coloredBar"], (res) => { diff --git a/Extensions/combined/src/events.js b/Extensions/combined/src/events.js index 9b0e78a..47d0bce 100644 --- a/Extensions/combined/src/events.js +++ b/Extensions/combined/src/events.js @@ -108,12 +108,6 @@ function storageChangeHandler(changes, area) { if (changes.colorTheme !== undefined) { handleColorThemeChangeEvent(changes.colorTheme.newValue); } - - if (changes.numberDisplayRoundDown !== undefined) { - handleNumberDisplayRoundDownChangeEvent( - changes.numberDisplayRoundDown.newValue - ); - } if (changes.numberDisplayFormat !== undefined) { handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue); } @@ -145,10 +139,6 @@ function handleNumberDisplayFormatChangeEvent(value) { extConfig.numberDisplayFormat = value; } -function handleNumberDisplayRoundDownChangeEvent(value) { - extConfig.numberDisplayRoundDown = value; -} - function handleNumberDisplayReformatLikesChangeEvent(value) { extConfig.numberDisplayReformatLikes = value; } diff --git a/Extensions/combined/src/state.js b/Extensions/combined/src/state.js index ec2125a..73eb905 100644 --- a/Extensions/combined/src/state.js +++ b/Extensions/combined/src/state.js @@ -22,7 +22,6 @@ let extConfig = { coloredBar: false, colorTheme: "classic", numberDisplayFormat: "compactShort", - numberDisplayRoundDown: true, showTooltipPercentage: false, tooltipPercentageMode: "dash_like", numberDisplayReformatLikes: false, @@ -260,7 +259,6 @@ function initExtConfig() { initializeColoredBar(); initializeColorTheme(); initializeNumberDisplayFormat(); - initializeNumberDisplayRoundDown(); initializeTooltipPercentage(); initializeTooltipPercentageMode(); initializeNumberDisplayReformatLikes(); @@ -296,16 +294,6 @@ function initializeColoredBar() { }); } -function initializeNumberDisplayRoundDown() { - getBrowser().storage.sync.get(["numberDisplayRoundDown"], (res) => { - if (res.numberDisplayRoundDown === undefined) { - getBrowser().storage.sync.set({ numberDisplayRoundDown: true }); - } else { - extConfig.numberDisplayRoundDown = res.numberDisplayRoundDown; - } - }); -} - function initializeColorTheme() { getBrowser().storage.sync.get(["colorTheme"], (res) => { if (res.colorTheme === undefined) { diff --git a/Extensions/combined/src/utils.js b/Extensions/combined/src/utils.js index 05dafbf..b92bc0c 100644 --- a/Extensions/combined/src/utils.js +++ b/Extensions/combined/src/utils.js @@ -1,22 +1,8 @@ import { extConfig } from "./state"; -function roundDown(num) { - if (num < 1000) return num; - const int = Math.floor(Math.log10(num) - 2); - const decimal = int + (int % 3 ? 1 : 0); - const value = Math.floor(num / 10 ** decimal); - return value * 10 ** decimal; -} - function numberFormat(numberState) { - let numberDisplay; - if (extConfig.numberDisplayRoundDown === false) { - numberDisplay = numberState; - } else { - numberDisplay = roundDown(numberState); - } return getNumberFormatter(extConfig.numberDisplayFormat).format( - numberDisplay + numberState ); }