فهرست منبع

ref: change console.log to dbg wrapper fn

Sv443 10 ماه پیش
والد
کامیت
6062d1d967
2فایلهای تغییر یافته به همراه78 افزوده شده و 78 حذف شده
  1. 61 61
      dist/BetterYTM.user.js
  2. 17 17
      src/index.ts

+ 61 - 61
dist/BetterYTM.user.js

@@ -17,7 +17,7 @@
 // @license           AGPL-3.0-only
 // @license           AGPL-3.0-only
 // @author            Sv443
 // @author            Sv443
 // @copyright         Sv443 (https://github.com/Sv443)
 // @copyright         Sv443 (https://github.com/Sv443)
-// @icon              https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/logo/logo_dev_48.png
+// @icon              https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/logo/logo_dev_48.png
 // @match             https://music.youtube.com/*
 // @match             https://music.youtube.com/*
 // @match             https://www.youtube.com/*
 // @match             https://www.youtube.com/*
 // @run-at            document-start
 // @run-at            document-start
@@ -33,49 +33,49 @@
 // @grant             GM.openInTab
 // @grant             GM.openInTab
 // @grant             unsafeWindow
 // @grant             unsafeWindow
 // @noframes
 // @noframes
-// @resource          css-bundle              https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/dist/BetterYTM.css
-// @resource          css-above_queue_btns    https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/style/aboveQueueBtns.css
-// @resource          css-anchor_improvements https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/style/anchorImprovements.css
-// @resource          css-fix_hdr             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/style/fixHDR.css
-// @resource          css-fix_spacing         https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/style/fixSpacing.css
-// @resource          css-show_votes          https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/style/showVotes.css
-// @resource          css-vol_slider_size     https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/style/volSliderSize.css
-// @resource          doc-changelog           https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/changelog.md
-// @resource          icon-advanced_mode      https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/plus_circle_small.svg
-// @resource          icon-arrow_down         https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/arrow_down.svg
-// @resource          icon-auto_like_enabled  https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/auto_like_enabled.svg
-// @resource          icon-auto_like          https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/auto_like.svg
-// @resource          icon-clear_list         https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/clear_list.svg
-// @resource          icon-delete             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/delete.svg
-// @resource          icon-edit               https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/edit.svg
-// @resource          icon-error              https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/error.svg
-// @resource          icon-experimental       https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/beaker_small.svg
-// @resource          icon-globe_small        https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/globe_small.svg
-// @resource          icon-globe              https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/globe.svg
-// @resource          icon-help               https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/help.svg
-// @resource          icon-image_filled       https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/image_filled.svg
-// @resource          icon-image              https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/image.svg
-// @resource          icon-link               https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/link.svg
-// @resource          icon-lyrics             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/lyrics.svg
-// @resource          icon-reload             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/refresh.svg
-// @resource          icon-skip_to            https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/skip_to.svg
-// @resource          icon-spinner            https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/icons/spinner.svg
-// @resource          img-close               https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/close.png
-// @resource          img-discord             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/external/discord.png
-// @resource          img-github              https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/external/github.png
-// @resource          img-greasyfork          https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/external/greasyfork.png
-// @resource          img-logo_dev            https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/logo/logo_dev_48.png
-// @resource          img-logo                https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/logo/logo_48.png
-// @resource          img-openuserjs          https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/images/external/openuserjs.png
-// @resource          trans-de_DE             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/de_DE.json
-// @resource          trans-en_US             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/en_US.json
-// @resource          trans-en_UK             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/en_UK.json
-// @resource          trans-es_ES             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/es_ES.json
-// @resource          trans-fr_FR             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/fr_FR.json
-// @resource          trans-hi_IN             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/hi_IN.json
-// @resource          trans-ja_JA             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/ja_JA.json
-// @resource          trans-pt_BR             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/pt_BR.json
-// @resource          trans-zh_CN             https://raw.githubusercontent.com/Sv443/BetterYTM/eef7c266/assets/translations/zh_CN.json
+// @resource          css-bundle              https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/dist/BetterYTM.css
+// @resource          css-above_queue_btns    https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/style/aboveQueueBtns.css
+// @resource          css-anchor_improvements https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/style/anchorImprovements.css
+// @resource          css-fix_hdr             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/style/fixHDR.css
+// @resource          css-fix_spacing         https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/style/fixSpacing.css
+// @resource          css-show_votes          https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/style/showVotes.css
+// @resource          css-vol_slider_size     https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/style/volSliderSize.css
+// @resource          doc-changelog           https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/changelog.md
+// @resource          icon-advanced_mode      https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/plus_circle_small.svg
+// @resource          icon-arrow_down         https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/arrow_down.svg
+// @resource          icon-auto_like_enabled  https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/auto_like_enabled.svg
+// @resource          icon-auto_like          https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/auto_like.svg
+// @resource          icon-clear_list         https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/clear_list.svg
+// @resource          icon-delete             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/delete.svg
+// @resource          icon-edit               https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/edit.svg
+// @resource          icon-error              https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/error.svg
+// @resource          icon-experimental       https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/beaker_small.svg
+// @resource          icon-globe_small        https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/globe_small.svg
+// @resource          icon-globe              https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/globe.svg
+// @resource          icon-help               https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/help.svg
+// @resource          icon-image_filled       https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/image_filled.svg
+// @resource          icon-image              https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/image.svg
+// @resource          icon-link               https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/link.svg
+// @resource          icon-lyrics             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/lyrics.svg
+// @resource          icon-reload             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/refresh.svg
+// @resource          icon-skip_to            https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/skip_to.svg
+// @resource          icon-spinner            https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/icons/spinner.svg
+// @resource          img-close               https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/close.png
+// @resource          img-discord             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/external/discord.png
+// @resource          img-github              https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/external/github.png
+// @resource          img-greasyfork          https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/external/greasyfork.png
+// @resource          img-logo_dev            https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/logo/logo_dev_48.png
+// @resource          img-logo                https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/logo/logo_48.png
+// @resource          img-openuserjs          https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/images/external/openuserjs.png
+// @resource          trans-de_DE             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/de_DE.json
+// @resource          trans-en_US             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/en_US.json
+// @resource          trans-en_UK             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/en_UK.json
+// @resource          trans-es_ES             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/es_ES.json
+// @resource          trans-fr_FR             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/fr_FR.json
+// @resource          trans-hi_IN             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/hi_IN.json
+// @resource          trans-ja_JA             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/ja_JA.json
+// @resource          trans-pt_BR             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/pt_BR.json
+// @resource          trans-zh_CN             https://raw.githubusercontent.com/Sv443/BetterYTM/44e45a08/assets/translations/zh_CN.json
 // @require           https://cdn.jsdelivr.net/npm/@sv443-network/[email protected]/dist/index.global.js
 // @require           https://cdn.jsdelivr.net/npm/@sv443-network/[email protected]/dist/index.global.js
 // @require           https://cdn.jsdelivr.net/npm/[email protected]/dist/fuse.basic.js
 // @require           https://cdn.jsdelivr.net/npm/[email protected]/dist/fuse.basic.js
 // @require           https://cdn.jsdelivr.net/npm/[email protected]/lib/marked.umd.js
 // @require           https://cdn.jsdelivr.net/npm/[email protected]/lib/marked.umd.js
@@ -186,7 +186,7 @@ var PluginIntent;
 })(PluginIntent || (PluginIntent = {}));const modeRaw = "development";
 })(PluginIntent || (PluginIntent = {}));const modeRaw = "development";
 const branchRaw = "develop";
 const branchRaw = "develop";
 const hostRaw = "github";
 const hostRaw = "github";
-const buildNumberRaw = "eef7c266";
+const buildNumberRaw = "44e45a08";
 /** The mode in which the script was built (production or development) */
 /** The mode in which the script was built (production or development) */
 const mode = (modeRaw.match(/^#{{.+}}$/) ? "production" : modeRaw);
 const mode = (modeRaw.match(/^#{{.+}}$/) ? "production" : modeRaw);
 /** The branch to use in various URLs that point to the GitHub repo */
 /** The branch to use in various URLs that point to the GitHub repo */
@@ -6959,15 +6959,15 @@ function registerDevMenuCommands() {
     GM.registerMenuCommand("Fix config values", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("Fix config values", () => __awaiter(this, void 0, void 0, function* () {
         const oldFeats = JSON.parse(JSON.stringify(getFeatures()));
         const oldFeats = JSON.parse(JSON.stringify(getFeatures()));
         yield setFeatures(fixCfgKeys(oldFeats));
         yield setFeatures(fixCfgKeys(oldFeats));
-        console.log("Fixed missing or extraneous config values.\nFrom:", oldFeats, "\n\nTo:", getFeatures());
+        dbg("Fixed missing or extraneous config values.\nFrom:", oldFeats, "\n\nTo:", getFeatures());
         if (confirm("All missing or config values were set to their default values and extraneous ones were removed.\nDo you want to reload the page now?"))
         if (confirm("All missing or config values were set to their default values and extraneous ones were removed.\nDo you want to reload the page now?"))
             location.reload();
             location.reload();
     }));
     }));
     GM.registerMenuCommand("List GM values in console with decompression", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("List GM values in console with decompression", () => __awaiter(this, void 0, void 0, function* () {
         const keys = yield GM.listValues();
         const keys = yield GM.listValues();
-        console.log(`GM values (${keys.length}):`);
+        dbg(`GM values (${keys.length}):`);
         if (keys.length === 0)
         if (keys.length === 0)
-            console.log("  No values found.");
+            dbg("  No values found.");
         const values = {};
         const values = {};
         let longestKey = 0;
         let longestKey = 0;
         for (const key of keys) {
         for (const key of keys) {
@@ -6979,14 +6979,14 @@ function registerDevMenuCommands() {
         for (const [key, finalVal] of Object.entries(values)) {
         for (const [key, finalVal] of Object.entries(values)) {
             const isEncoded = key.startsWith("_uucfg-") ? yield GM.getValue(`_uucfgenc-${key.substring(7)}`, false) : false;
             const isEncoded = key.startsWith("_uucfg-") ? yield GM.getValue(`_uucfgenc-${key.substring(7)}`, false) : false;
             const lengthStr = String(finalVal).length > 50 ? `(${String(finalVal).length} chars) ` : "";
             const lengthStr = String(finalVal).length > 50 ? `(${String(finalVal).length} chars) ` : "";
-            console.log(`  "${key}"${" ".repeat(longestKey - key.length)} -${isEncoded ? "-[decoded]-" : ""}> ${lengthStr}${finalVal}`);
+            dbg(`  "${key}"${" ".repeat(longestKey - key.length)} -${isEncoded ? "-[decoded]-" : ""}> ${lengthStr}${finalVal}`);
         }
         }
     }), "l");
     }), "l");
     GM.registerMenuCommand("List GM values in console, without decompression", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("List GM values in console, without decompression", () => __awaiter(this, void 0, void 0, function* () {
         const keys = yield GM.listValues();
         const keys = yield GM.listValues();
-        console.log(`GM values (${keys.length}):`);
+        dbg(`GM values (${keys.length}):`);
         if (keys.length === 0)
         if (keys.length === 0)
-            console.log("  No values found.");
+            dbg("  No values found.");
         const values = {};
         const values = {};
         let longestKey = 0;
         let longestKey = 0;
         for (const key of keys) {
         for (const key of keys) {
@@ -6996,18 +6996,18 @@ function registerDevMenuCommands() {
         }
         }
         for (const [key, val] of Object.entries(values)) {
         for (const [key, val] of Object.entries(values)) {
             const lengthStr = String(val).length >= 16 ? `(${String(val).length} chars) ` : "";
             const lengthStr = String(val).length >= 16 ? `(${String(val).length} chars) ` : "";
-            console.log(`  "${key}"${" ".repeat(longestKey - key.length)} -> ${lengthStr}${val}`);
+            dbg(`  "${key}"${" ".repeat(longestKey - key.length)} -> ${lengthStr}${val}`);
         }
         }
     }));
     }));
     GM.registerMenuCommand("Delete all GM values", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("Delete all GM values", () => __awaiter(this, void 0, void 0, function* () {
         const keys = yield GM.listValues();
         const keys = yield GM.listValues();
         if (confirm(`Clear all ${keys.length} GM values?\nSee console for details.`)) {
         if (confirm(`Clear all ${keys.length} GM values?\nSee console for details.`)) {
-            console.log(`Clearing ${keys.length} GM values:`);
+            dbg(`Clearing ${keys.length} GM values:`);
             if (keys.length === 0)
             if (keys.length === 0)
-                console.log("  No values found.");
+                dbg("  No values found.");
             for (const key of keys) {
             for (const key of keys) {
                 yield GM.deleteValue(key);
                 yield GM.deleteValue(key);
-                console.log(`  Deleted ${key}`);
+                dbg(`  Deleted ${key}`);
             }
             }
         }
         }
     }), "d");
     }), "d");
@@ -7021,17 +7021,17 @@ function registerDevMenuCommands() {
                 const truncLength = 400;
                 const truncLength = 400;
                 const oldVal = yield GM.getValue(key);
                 const oldVal = yield GM.getValue(key);
                 yield GM.deleteValue(key);
                 yield GM.deleteValue(key);
-                console.log(`Deleted GM value '${key}' with previous value '${oldVal && String(oldVal).length > truncLength ? String(oldVal).substring(0, truncLength) + `… (${String(oldVal).length} / ${truncLength} chars.)` : oldVal}'`);
+                dbg(`Deleted GM value '${key}' with previous value '${oldVal && String(oldVal).length > truncLength ? String(oldVal).substring(0, truncLength) + `… (${String(oldVal).length} / ${truncLength} chars.)` : oldVal}'`);
             }
             }
         }
         }
     }), "n");
     }), "n");
     GM.registerMenuCommand("Reset install timestamp", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("Reset install timestamp", () => __awaiter(this, void 0, void 0, function* () {
         yield GM.deleteValue("bytm-installed");
         yield GM.deleteValue("bytm-installed");
-        console.log("Reset install time.");
+        dbg("Reset install time.");
     }), "t");
     }), "t");
     GM.registerMenuCommand("Reset version check timestamp", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("Reset version check timestamp", () => __awaiter(this, void 0, void 0, function* () {
         yield GM.deleteValue("bytm-version-check");
         yield GM.deleteValue("bytm-version-check");
-        console.log("Reset version check time.");
+        dbg("Reset version check time.");
     }), "v");
     }), "v");
     GM.registerMenuCommand("List active selector listeners in console", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("List active selector listeners in console", () => __awaiter(this, void 0, void 0, function* () {
         const lines = [];
         const lines = [];
@@ -7047,20 +7047,20 @@ function registerDevMenuCommands() {
                 });
                 });
             });
             });
         }
         }
-        console.log(`Showing currently active listeners for ${Object.keys(globservers).length} observers with ${listenersAmt} total listeners:\n${lines.join("\n")}`);
+        dbg(`Showing currently active listeners for ${Object.keys(globservers).length} observers with ${listenersAmt} total listeners:\n${lines.join("\n")}`);
     }), "s");
     }), "s");
     GM.registerMenuCommand("Compress value", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("Compress value", () => __awaiter(this, void 0, void 0, function* () {
         const input = prompt("Enter the value to compress.\nSee console for output.");
         const input = prompt("Enter the value to compress.\nSee console for output.");
         if (input && input.length > 0) {
         if (input && input.length > 0) {
             const compressed = yield UserUtils.compress(input, compressionFormat);
             const compressed = yield UserUtils.compress(input, compressionFormat);
-            console.log(`Compression result (${input.length} chars -> ${compressed.length} chars)\nValue: ${compressed}`);
+            dbg(`Compression result (${input.length} chars -> ${compressed.length} chars)\nValue: ${compressed}`);
         }
         }
     }));
     }));
     GM.registerMenuCommand("Decompress value", () => __awaiter(this, void 0, void 0, function* () {
     GM.registerMenuCommand("Decompress value", () => __awaiter(this, void 0, void 0, function* () {
         const input = prompt("Enter the value to decompress.\nSee console for output.");
         const input = prompt("Enter the value to decompress.\nSee console for output.");
         if (input && input.length > 0) {
         if (input && input.length > 0) {
             const decompressed = yield UserUtils.decompress(input, compressionFormat);
             const decompressed = yield UserUtils.decompress(input, compressionFormat);
-            console.log(`Decompresion result (${input.length} chars -> ${decompressed.length} chars)\nValue: ${decompressed}`);
+            dbg(`Decompresion result (${input.length} chars -> ${decompressed.length} chars)\nValue: ${decompressed}`);
         }
         }
     }));
     }));
     log("Registered dev menu commands");
     log("Registered dev menu commands");

+ 17 - 17
src/index.ts

@@ -2,7 +2,7 @@ import { compress, decompress, pauseFor, type Stringifiable } from "@sv443-netwo
 import { addStyleFromResource, domLoaded, warn } from "./utils/index.js";
 import { addStyleFromResource, domLoaded, warn } from "./utils/index.js";
 import { clearConfig, fixCfgKeys, getFeatures, initConfig, setFeatures } from "./config.js";
 import { clearConfig, fixCfgKeys, getFeatures, initConfig, setFeatures } from "./config.js";
 import { buildNumber, compressionFormat, defaultLogLevel, mode, scriptInfo } from "./constants.js";
 import { buildNumber, compressionFormat, defaultLogLevel, mode, scriptInfo } from "./constants.js";
-import { error, getDomain, info, getSessionId, log, setLogLevel, initTranslations, setLocale } from "./utils/index.js";
+import { dbg, error, getDomain, info, getSessionId, log, setLogLevel, initTranslations, setLocale } from "./utils/index.js";
 import { initSiteEvents } from "./siteEvents.js";
 import { initSiteEvents } from "./siteEvents.js";
 import { emitInterface, initInterface, initPlugins } from "./interface.js";
 import { emitInterface, initInterface, initPlugins } from "./interface.js";
 import { initObservers, addSelectorListener, globservers } from "./observers.js";
 import { initObservers, addSelectorListener, globservers } from "./observers.js";
@@ -302,16 +302,16 @@ function registerDevMenuCommands() {
   GM.registerMenuCommand("Fix config values", async () => {
   GM.registerMenuCommand("Fix config values", async () => {
     const oldFeats = JSON.parse(JSON.stringify(getFeatures())) as FeatureConfig;
     const oldFeats = JSON.parse(JSON.stringify(getFeatures())) as FeatureConfig;
     await setFeatures(fixCfgKeys(oldFeats));
     await setFeatures(fixCfgKeys(oldFeats));
-    console.log("Fixed missing or extraneous config values.\nFrom:", oldFeats, "\n\nTo:", getFeatures());
+    dbg("Fixed missing or extraneous config values.\nFrom:", oldFeats, "\n\nTo:", getFeatures());
     if(confirm("All missing or config values were set to their default values and extraneous ones were removed.\nDo you want to reload the page now?"))
     if(confirm("All missing or config values were set to their default values and extraneous ones were removed.\nDo you want to reload the page now?"))
       location.reload();
       location.reload();
   });
   });
 
 
   GM.registerMenuCommand("List GM values in console with decompression", async () => {
   GM.registerMenuCommand("List GM values in console with decompression", async () => {
     const keys = await GM.listValues();
     const keys = await GM.listValues();
-    console.log(`GM values (${keys.length}):`);
+    dbg(`GM values (${keys.length}):`);
     if(keys.length === 0)
     if(keys.length === 0)
-      console.log("  No values found.");
+      dbg("  No values found.");
 
 
     const values = {} as Record<string, Stringifiable | undefined>;
     const values = {} as Record<string, Stringifiable | undefined>;
     let longestKey = 0;
     let longestKey = 0;
@@ -325,15 +325,15 @@ function registerDevMenuCommands() {
     for(const [key, finalVal] of Object.entries(values)) {
     for(const [key, finalVal] of Object.entries(values)) {
       const isEncoded = key.startsWith("_uucfg-") ? await GM.getValue(`_uucfgenc-${key.substring(7)}`, false) : false;
       const isEncoded = key.startsWith("_uucfg-") ? await GM.getValue(`_uucfgenc-${key.substring(7)}`, false) : false;
       const lengthStr = String(finalVal).length > 50 ? `(${String(finalVal).length} chars) ` : "";
       const lengthStr = String(finalVal).length > 50 ? `(${String(finalVal).length} chars) ` : "";
-      console.log(`  "${key}"${" ".repeat(longestKey - key.length)} -${isEncoded ? "-[decoded]-" : ""}> ${lengthStr}${finalVal}`);
+      dbg(`  "${key}"${" ".repeat(longestKey - key.length)} -${isEncoded ? "-[decoded]-" : ""}> ${lengthStr}${finalVal}`);
     }
     }
   }, "l");
   }, "l");
 
 
   GM.registerMenuCommand("List GM values in console, without decompression", async () => {
   GM.registerMenuCommand("List GM values in console, without decompression", async () => {
     const keys = await GM.listValues();
     const keys = await GM.listValues();
-    console.log(`GM values (${keys.length}):`);
+    dbg(`GM values (${keys.length}):`);
     if(keys.length === 0)
     if(keys.length === 0)
-      console.log("  No values found.");
+      dbg("  No values found.");
 
 
     const values = {} as Record<string, Stringifiable | undefined>;
     const values = {} as Record<string, Stringifiable | undefined>;
     let longestKey = 0;
     let longestKey = 0;
@@ -345,19 +345,19 @@ function registerDevMenuCommands() {
     }
     }
     for(const [key, val] of Object.entries(values)) {
     for(const [key, val] of Object.entries(values)) {
       const lengthStr = String(val).length >= 16 ? `(${String(val).length} chars) ` : "";
       const lengthStr = String(val).length >= 16 ? `(${String(val).length} chars) ` : "";
-      console.log(`  "${key}"${" ".repeat(longestKey - key.length)} -> ${lengthStr}${val}`);
+      dbg(`  "${key}"${" ".repeat(longestKey - key.length)} -> ${lengthStr}${val}`);
     }
     }
   });
   });
 
 
   GM.registerMenuCommand("Delete all GM values", async () => {
   GM.registerMenuCommand("Delete all GM values", async () => {
     const keys = await GM.listValues();
     const keys = await GM.listValues();
     if(confirm(`Clear all ${keys.length} GM values?\nSee console for details.`)) {
     if(confirm(`Clear all ${keys.length} GM values?\nSee console for details.`)) {
-      console.log(`Clearing ${keys.length} GM values:`);
+      dbg(`Clearing ${keys.length} GM values:`);
       if(keys.length === 0)
       if(keys.length === 0)
-        console.log("  No values found.");
+        dbg("  No values found.");
       for(const key of keys) {
       for(const key of keys) {
         await GM.deleteValue(key);
         await GM.deleteValue(key);
-        console.log(`  Deleted ${key}`);
+        dbg(`  Deleted ${key}`);
       }
       }
     }
     }
   }, "d");
   }, "d");
@@ -371,19 +371,19 @@ function registerDevMenuCommands() {
         const truncLength = 400;
         const truncLength = 400;
         const oldVal = await GM.getValue(key);
         const oldVal = await GM.getValue(key);
         await GM.deleteValue(key);
         await GM.deleteValue(key);
-        console.log(`Deleted GM value '${key}' with previous value '${oldVal && String(oldVal).length > truncLength ? String(oldVal).substring(0, truncLength) + `… (${String(oldVal).length} / ${truncLength} chars.)` : oldVal}'`);
+        dbg(`Deleted GM value '${key}' with previous value '${oldVal && String(oldVal).length > truncLength ? String(oldVal).substring(0, truncLength) + `… (${String(oldVal).length} / ${truncLength} chars.)` : oldVal}'`);
       }
       }
     }
     }
   }, "n");
   }, "n");
 
 
   GM.registerMenuCommand("Reset install timestamp", async () => {
   GM.registerMenuCommand("Reset install timestamp", async () => {
     await GM.deleteValue("bytm-installed");
     await GM.deleteValue("bytm-installed");
-    console.log("Reset install time.");
+    dbg("Reset install time.");
   }, "t");
   }, "t");
 
 
   GM.registerMenuCommand("Reset version check timestamp", async () => {
   GM.registerMenuCommand("Reset version check timestamp", async () => {
     await GM.deleteValue("bytm-version-check");
     await GM.deleteValue("bytm-version-check");
-    console.log("Reset version check time.");
+    dbg("Reset version check time.");
   }, "v");
   }, "v");
 
 
   GM.registerMenuCommand("List active selector listeners in console", async () => {
   GM.registerMenuCommand("List active selector listeners in console", async () => {
@@ -400,14 +400,14 @@ function registerDevMenuCommands() {
         });
         });
       });
       });
     }
     }
-    console.log(`Showing currently active listeners for ${Object.keys(globservers).length} observers with ${listenersAmt} total listeners:\n${lines.join("\n")}`);
+    dbg(`Showing currently active listeners for ${Object.keys(globservers).length} observers with ${listenersAmt} total listeners:\n${lines.join("\n")}`);
   }, "s");
   }, "s");
 
 
   GM.registerMenuCommand("Compress value", async () => {
   GM.registerMenuCommand("Compress value", async () => {
     const input = prompt("Enter the value to compress.\nSee console for output.");
     const input = prompt("Enter the value to compress.\nSee console for output.");
     if(input && input.length > 0) {
     if(input && input.length > 0) {
       const compressed = await compress(input, compressionFormat);
       const compressed = await compress(input, compressionFormat);
-      console.log(`Compression result (${input.length} chars -> ${compressed.length} chars)\nValue: ${compressed}`);
+      dbg(`Compression result (${input.length} chars -> ${compressed.length} chars)\nValue: ${compressed}`);
     }
     }
   });
   });
 
 
@@ -415,7 +415,7 @@ function registerDevMenuCommands() {
     const input = prompt("Enter the value to decompress.\nSee console for output.");
     const input = prompt("Enter the value to decompress.\nSee console for output.");
     if(input && input.length > 0) {
     if(input && input.length > 0) {
       const decompressed = await decompress(input, compressionFormat);
       const decompressed = await decompress(input, compressionFormat);
-      console.log(`Decompresion result (${input.length} chars -> ${decompressed.length} chars)\nValue: ${decompressed}`);
+      dbg(`Decompresion result (${input.length} chars -> ${decompressed.length} chars)\nValue: ${decompressed}`);
     }
     }
   });
   });