mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-12-02 02:41:22 +01:00
RoundDown option removed
This commit is contained in:
1 parent
752edcc27f
commit
8e376f6142
8 files changed
+17
-103
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user