-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
47 lines (40 loc) · 1.25 KB
/
content.js
File metadata and controls
47 lines (40 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function isHomePage() {
const browse = document.querySelector('ytd-browse[page-subtype="home"]');
return !!browse;
}
function applyTopChipsSettings(settings) {
if (!isHomePage()) return;
const show = settings.showTopChips;
const home = document.querySelector('ytd-browse[page-subtype="home"]');
if (!home) return;
// ищем чипсы ТОЛЬКО внутри главной
home.querySelectorAll("ytd-feed-filter-chip-bar-renderer")
.forEach(el => {
el.style.display = show ? "" : "none";
});
// контейнер
const frosted = document.getElementById("frosted-glass");
if (frosted) {
if (show) {
frosted.classList.add("with-chipbar");
frosted.classList.remove("no-chipbar-by-ext");
} else {
frosted.classList.remove("with-chipbar");
frosted.classList.add("no-chipbar-by-ext");
}
}
}
(function addChipbarFixStyle() {
if (document.getElementById("yt-chipbar-fix")) return;
const style = document.createElement("style");
style.id = "yt-chipbar-fix";
style.textContent = `
#frosted-glass.no-chipbar-by-ext {
height: 0 !important;
min-height: 0 !important;
margin: 0 !important;
padding: 0 !important;
}
`;
document.documentElement.appendChild(style);
})();