Repository navigation
Expand file tree
/
Copy pathunhook.js
More file actions
94 lines (89 loc) · 2.95 KB
/
Copy pathunhook.js
File metadata and controls
94 lines (89 loc) · 2.95 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// ═══════════════════════════════════
// superlevels: YouTube Unhook
// Based on remove-youtube-suggestions
// ═══════════════════════════════════
(() => {
const STYLE_ID = "sl-unhook";
const UNHOOK_CSS = `
/* Homepage: hide feed entirely */
ytd-browse[page-subtype="home"] #contents.ytd-rich-grid-renderer,
ytd-browse[page-subtype="home"] ytd-rich-grid-renderer,
ytd-browse[page-subtype="home"] #primary > ytd-rich-grid-renderer,
ytd-browse[page-subtype="home"] ytd-rich-section-list-renderer,
ytd-browse[page-subtype="home"] #header,
ytd-browse[page-subtype="home"] .ytd-browse-chips-wrapper {
display: none !important;
}
/* Black homepage background with message */
ytd-browse[page-subtype="home"] #primary {
display: flex !important;
justify-content: center;
align-items: center;
min-height: 60vh;
}
ytd-browse[page-subtype="home"] #primary::before {
content: 'Focus Mode — Use the search bar';
font-size: 20px;
color: #444;
font-family: 'YouTube Sans', 'Roboto', sans-serif;
font-weight: 500;
}
/* Sidebar suggestions on video pages */
#secondary.ytd-watch-flexy,
ytd-watch-next-secondary-results-renderer,
#related {
display: none !important;
}
/* Make video player wider without sidebar */
ytd-watch-flexy[flexy][is-two-columns_] #primary.ytd-watch-flexy {
max-width: 100% !important;
}
/* End screen suggestions & cards */
.ytp-ce-element,
.ytp-endscreen-content,
.ytp-suggestion-set,
.ytp-cards-teaser,
.ytp-ce-covering-overlay,
.ytp-ce-element-show {
display: none !important;
}
/* Trending / Explore feed */
ytd-browse[page-subtype="trending"] #contents {
display: none !important;
}
/* Homepage chips / categories bar */
#chips-wrapper.ytd-feed-filter-chip-bar-renderer,
ytd-feed-filter-chip-bar-renderer {
display: none !important;
}
/* Shorts shelf */
ytd-rich-shelf-renderer[is-shorts],
ytd-reel-shelf-renderer {
display: none !important;
}
/* "For You" / recommendation shelves */
ytd-rich-shelf-renderer {
display: none !important;
}
`;
function inject() {
if (document.getElementById(STYLE_ID)) return;
const style = document.createElement("style");
style.id = STYLE_ID;
style.textContent = UNHOOK_CSS;
(document.head || document.documentElement).appendChild(style);
}
function remove() {
const el = document.getElementById(STYLE_ID);
if (el) el.remove();
}
chrome.storage.local.get(["unhook_enabled"], (data) => {
if (data.unhook_enabled !== false) inject();
});
chrome.runtime.onMessage.addListener((msg) => {
if (msg.type === "unhook_toggle") {
if (msg.enabled) inject();
else remove();
}
});
})();