Added Option to Disable Logging By Default (#474)

* Added Option to Disable Logging By Default

* Added Userscript Support to Disable Logging

* Formatting and Fixed Compiling

* Updated Description of Setting Option

* Whitespace 😅

* Dot in Description of Setting option

* Typo in JAVASCRIPT
This commit is contained in:
Divyansh Agrawal authored and GitHub committed 2024-06-16 18:52:41 +02:00
1 parent 3d788b3d31
commit fbf00e474d
6 files changed
+66 -9

No files matched your search

+17
View File
@@ -6,6 +6,7 @@ let api;
/** stores extension's global config */
let extConfig = {
disableVoteSubmission: false,
disableLogging: true,
coloredThumbs: false,
coloredBar: false,
colorTheme: "classic", // classic, accessible, neon
@@ -275,6 +276,8 @@ function storageChangeHandler(changes, area) {
changes.numberDisplayReformatLikes.newValue,
);
}
if (changes.disableLogging !== undefined) {
handleDisableLoggingChangeEvent(changes.disableLogging.newValue);
if (changes.showTooltipPercentage !== undefined) {
handleShowTooltipPercentageChangeEvent(
changes.showTooltipPercentage.newValue,
@@ -296,6 +299,9 @@ function handleDisableVoteSubmissionChangeEvent(value) {
}
}
function handleDisableLoggingChangeEvent(value) {
extConfig.disableLogging = value;
}
function handleNumberDisplayFormatChangeEvent(value) {
extConfig.numberDisplayFormat = value;
}
@@ -342,6 +348,7 @@ api.storage.onChanged.addListener(storageChangeHandler);
function initExtConfig() {
initializeDisableVoteSubmission();
initializeDisableLogging();
initializeColoredThumbs();
initializeColoredBar();
initializeColorTheme();
@@ -362,6 +369,16 @@ function initializeDisableVoteSubmission() {
});
}
function initializeDisableLogging(){
api.storage.sync.get(['disableLogging'],(res)=>{
if (res.disableLogging === undefined) {
api.storage.sync.set({disableLogging:true});
}
else {
extConfig.disableLogging = res.disableLogging;
}
});
}
function initializeColoredThumbs() {
api.storage.sync.get(["coloredThumbs"], (res) => {
if (res.coloredThumbs === undefined) {