Enhance debugging features: add debug group logging and update popup UI for clarity
This commit is contained in:
parent
0ac7326ceb
commit
e768a0bbbc
26
content.js
26
content.js
@ -28,6 +28,16 @@ function debugLog(...args) {
|
|||||||
console.log("[MemberFilter]", ...args);
|
console.log("[MemberFilter]", ...args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function debugGroup(...args) {
|
||||||
|
if (!debugEnabled) return;
|
||||||
|
console.group("[MemberFilter]", ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
function debugGroupEnd() {
|
||||||
|
if (!debugEnabled) return;
|
||||||
|
console.groupEnd();
|
||||||
|
}
|
||||||
|
|
||||||
function normalizeKey(value) {
|
function normalizeKey(value) {
|
||||||
return value
|
return value
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
@ -110,15 +120,13 @@ function process(root = document) {
|
|||||||
|
|
||||||
const whitelisted = whitelist.includes(channelKey);
|
const whitelisted = whitelist.includes(channelKey);
|
||||||
|
|
||||||
if (debugEnabled) {
|
debugGroup();
|
||||||
console.group("[MemberFilter]");
|
debugLog("Title :", title);
|
||||||
console.log("Title :", title);
|
debugLog("Channel:", channel);
|
||||||
console.log("Channel:", channel);
|
debugLog("URL :", url);
|
||||||
console.log("URL :", url);
|
debugLog("ID :", id || "(no id)");
|
||||||
console.log("ID :", id || "(no id)");
|
debugLog("Whitelisted:", whitelisted);
|
||||||
console.log("Whitelisted:", whitelisted);
|
debugGroupEnd();
|
||||||
console.groupEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!whitelisted) {
|
if (!whitelisted) {
|
||||||
video.setAttribute(`data-${DATA_PREFIX}-hidden`, "true");
|
video.setAttribute(`data-${DATA_PREFIX}-hidden`, "true");
|
||||||
|
|||||||
11
popup.css
11
popup.css
@ -14,6 +14,17 @@ h3 {
|
|||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.subtext {
|
||||||
|
margin: 0 0 10px;
|
||||||
|
font-size: 11px;
|
||||||
|
line-height: 1.3;
|
||||||
|
color: #5b4a33;
|
||||||
|
}
|
||||||
|
|
||||||
|
.subtext.subtext-debug {
|
||||||
|
margin: 6px 0 8px;
|
||||||
|
}
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 6px;
|
gap: 6px;
|
||||||
|
|||||||
@ -7,6 +7,10 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h3>Channel Whitelist</h3>
|
<h3>Channel Whitelist</h3>
|
||||||
|
<p class="subtext">
|
||||||
|
Hide member-only videos by default. Whitelisted creators stay visible.
|
||||||
|
Add the channel name and its @handle or link.
|
||||||
|
</p>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<input id="channelInput" placeholder="Channel name" />
|
<input id="channelInput" placeholder="Channel name" />
|
||||||
@ -19,10 +23,13 @@
|
|||||||
<div class="row settings">
|
<div class="row settings">
|
||||||
<label class="toggle">
|
<label class="toggle">
|
||||||
<input id="debugToggle" type="checkbox" />
|
<input id="debugToggle" type="checkbox" />
|
||||||
<span>Debug</span>
|
<span>Debug logging</span>
|
||||||
</label>
|
</label>
|
||||||
<button id="resetBtn" class="ghost">Reset defaults</button>
|
<button id="resetBtn" class="ghost">Reset defaults</button>
|
||||||
</div>
|
</div>
|
||||||
|
<p class="subtext subtext-debug">
|
||||||
|
Debug logs will appear in the console only when enabled.
|
||||||
|
</p>
|
||||||
|
|
||||||
<ul id="channelList"></ul>
|
<ul id="channelList"></ul>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user