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

+12
View File
@@ -25,6 +25,7 @@ const NEUTRAL_STATE = "NEUTRAL_STATE";
let extConfig = {
disableVoteSubmission: false,
disableLogging: true,
coloredThumbs: false,
coloredBar: false,
colorTheme: "classic",
@@ -298,6 +299,7 @@ async function setInitialState() {
async function initExtConfig() {
initializeDisableVoteSubmission();
initializeDisableLogging();
initializeColoredThumbs();
initializeColoredBar();
initializeColorTheme();
@@ -332,6 +334,16 @@ function initializeDisableVoteSubmission() {
});
}
function initializeDisableLogging() {
getBrowser().storage.sync.get(["disableLogging"], (res) => {
if (res.disableLogging === undefined) {
getBrowser().storage.sync.set({ disableLogging: true });
} else {
extConfig.disableLogging = res.disableLogging;
}
});
}
function initializeColoredThumbs() {
getBrowser().storage.sync.get(["coloredThumbs"], (res) => {
if (res.coloredThumbs === undefined) {
+7 -5
View File
@@ -103,11 +103,13 @@ function isVideoLoaded() {
}
function cLog(message, writer) {
message = `[return youtube dislike]: ${message}`;
if (writer) {
writer(message);
} else {
console.log(message);
if (!extConfig.disableLogging){
message = `[return youtube dislike]: ${message}`;
if (writer) {
writer(message);
} else {
console.log(message);
}
}
}