From fbf00e474df67e3faeffc8cdf2d7a29ec867b1df Mon Sep 17 00:00:00 2001
From: Divyansh Agrawal <57246976+DivyanshByte@users.noreply.github.com>
Date: Sun, 16 Jun 2024 22:22:41 +0530
Subject: [PATCH] Added Option to Disable Logging By Default (#474)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 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
---
.../UserScript/Return Youtube Dislike.user.js | 7 +++++--
Extensions/combined/popup.html | 6 +++++-
Extensions/combined/popup.js | 21 ++++++++++++++++++-
Extensions/combined/ryd.background.js | 17 +++++++++++++++
Extensions/combined/src/state.js | 12 +++++++++++
Extensions/combined/src/utils.js | 12 ++++++-----
6 files changed, 66 insertions(+), 9 deletions(-)
diff --git a/Extensions/UserScript/Return Youtube Dislike.user.js b/Extensions/UserScript/Return Youtube Dislike.user.js
index 05ba6fd..2bb961c 100644
--- a/Extensions/UserScript/Return Youtube Dislike.user.js
+++ b/Extensions/UserScript/Return Youtube Dislike.user.js
@@ -28,6 +28,7 @@ const extConfig = {
// You may change the following variables to allowed values listed in the corresponding brackets (* means default). Keep the style and keywords intact.
showUpdatePopup: false, // [true, false*] Show a popup tab after extension update (See what's new)
disableVoteSubmission: false, // [true, false*] Disable like/dislike submission (Stops counting your likes and dislikes)
+ disableLogging: true, // [true*, false] Disable Logging API Response in JavaScript Console.
coloredThumbs: false, // [true, false*] Colorize thumbs (Use custom colors for thumb icons)
coloredBar: false, // [true, false*] Colorize ratio bar (Use custom colors for ratio bar)
colorTheme: "classic", // [classic*, accessible, neon] Color theme (red/green, blue/yellow, pink/cyan)
@@ -51,8 +52,10 @@ let isMobile = location.hostname == "m.youtube.com";
let isShorts = () => location.pathname.startsWith("/shorts");
let mobileDislikes = 0;
function cLog(text, subtext = "") {
- subtext = subtext.trim() === "" ? "" : `(${subtext})`;
- console.log(`[Return YouTube Dislikes] ${text} ${subtext}`);
+ if (!extConfig.disableLogging) {
+ subtext = subtext.trim() === "" ? "" : `(${subtext})`;
+ console.log(`[Return YouTube Dislikes] ${text} ${subtext}`);
+ }
}
function isInViewport(element) {
diff --git a/Extensions/combined/popup.html b/Extensions/combined/popup.html
index 538958d..450c10f 100644
--- a/Extensions/combined/popup.html
+++ b/Extensions/combined/popup.html
@@ -84,7 +84,6 @@
/>
-
+