mirror of
https://github.com/Alvin-Zilverstand/return-youtube-dislike.git
synced 2026-11-25 15:53:01 +01:00
Add user option to re-format likes
fixes #543 This feature does not force-display likes when uploader has disabled like number display. Consult with other issues.
This commit is contained in:
1 parent
a99410ae13
commit
09b29d7cab
5 files changed
+70
No files matched your search
@@ -11,6 +11,7 @@ let extConfig = {
|
||||
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
|
||||
};
|
||||
|
||||
if (isChrome()) api = chrome;
|
||||
@@ -264,6 +265,9 @@ function storageChangeHandler(changes, area) {
|
||||
if (changes.numberDisplayFormat !== undefined) {
|
||||
handleNumberDisplayFormatChangeEvent(changes.numberDisplayFormat.newValue);
|
||||
}
|
||||
if (changes.numberDisplayReformatLikes !== undefined) {
|
||||
handleNumberDisplayReformatLikesChangeEvent(changes.numberDisplayReformatLikes.newValue);
|
||||
}
|
||||
}
|
||||
|
||||
function handleDisableVoteSubmissionChangeEvent(value) {
|
||||
@@ -306,6 +310,10 @@ function handleColorThemeChangeEvent(value) {
|
||||
extConfig.colorTheme = value;
|
||||
}
|
||||
|
||||
function handleNumberDisplayReformatLikesChangeEvent(value) {
|
||||
extConfig.numberDisplayReformatLikes = value;
|
||||
}
|
||||
|
||||
api.storage.onChanged.addListener(storageChangeHandler);
|
||||
|
||||
function initExtConfig() {
|
||||
@@ -315,6 +323,7 @@ function initExtConfig() {
|
||||
initializeColorTheme();
|
||||
initializeNumberDisplayFormat();
|
||||
initializeNumberDisplayRoundDown();
|
||||
initializeNumberDisplayReformatLikes();
|
||||
}
|
||||
|
||||
function initializeDisableVoteSubmission() {
|
||||
@@ -378,6 +387,16 @@ function initializeNumberDisplayFormat() {
|
||||
});
|
||||
}
|
||||
|
||||
function initializeNumberDisplayReformatLikes() {
|
||||
api.storage.sync.get(["numberDisplayReformatLikes"], (res) => {
|
||||
if (res.numberDisplayReformatLikes === undefined) {
|
||||
api.storage.sync.set({ numberDisplayReformatLikes: false });
|
||||
} else {
|
||||
extConfig.numberDisplayReformatLikes = res.numberDisplayReformatLikes;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function isChrome() {
|
||||
return typeof chrome !== "undefined" && typeof chrome.runtime !== "undefined";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user