Skip to content

Commit 3f81fa5

Browse files
committed
update : add remove recommendation bar in the video page
1 parent a77c8dd commit 3f81fa5

File tree

3 files changed

+38
-20
lines changed

3 files changed

+38
-20
lines changed

content.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,24 @@ const observeAndRemoveElements = () => {
1010
for (let mutation of mutationsList) {
1111
for (let node of mutation.addedNodes) {
1212
if (node instanceof HTMLElement) {
13-
if (node.matches("#shorts-container, ytd-rich-grid-renderer")) {
14-
node.remove()
13+
// Utilisez directement l'ID pour obtenir l'élément
14+
const secondaryElement = document.getElementById("secondary");
15+
const primaryElement = document.querySelector("ytd-rich-grid-renderer");
16+
const shortElement = document.getElementById("shorts-container");
17+
if (secondaryElement) {
18+
secondaryElement.remove();
19+
const video = document.querySelector('video')
20+
const videoc = document.querySelector('ytd-watch-flexy')
21+
if (video) {
22+
video.style.borderRadius = '10px'
23+
videoc.style.overflowY = 'hidden'
24+
}
25+
}
26+
if (primaryElement) {
27+
primaryElement.remove();
28+
}
29+
if (shortElement) {
30+
shortElement.remove();
1531
}
1632
}
1733
}
@@ -21,22 +37,24 @@ const observeAndRemoveElements = () => {
2137
observer.observe(document.body, { childList: true, subtree: true });
2238
};
2339

24-
window.addEventListener("load", () => {
40+
41+
42+
43+
window.addEventListener("DOMContentLoaded", () => {
2544
chrome.storage.sync.get(['removeYtdBrowse', 'msg'], (result) => {
2645
if (result.removeYtdBrowse === true) {
27-
removeElement("#shorts-container");
28-
removeElement("ytd-rich-grid-renderer");
29-
const y = document.querySelector('ytd-two-column-browse-results-renderer')
30-
const t = document.createElement('h1')
46+
observeAndRemoveElements()
47+
const t = document.createElement('h1');
3148
t.style.textAlign = "center";
3249
t.style.width = "100%";
3350
t.style.color = "#fff";
3451
t.style.fontSize = '40px';
35-
t.innerHTML = `${result.msg}`
36-
y.append(t)
37-
observeAndRemoveElements();
52+
t.innerHTML = `${result.msg}`;
53+
const y = document.querySelector('ytd-two-column-browse-results-renderer');
54+
console.log(y)
55+
y.append(t);
3856
} else if (result.removeYtdBrowse === false) {
39-
57+
4058
}
41-
});
59+
});
4260
});

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "disable youtube",
4-
"version": "0.0.2",
4+
"version": "0.0.3",
55
"description": "an extention to delete youtube home page and youtube short",
66
"permissions": [
77
"activeTab",

readme.MD

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515

1616
### ⚙️ Installation
1717

18-
- step 1 : `Go to https://github.com/royalygames/youtube-home-remove/releases and download the last version of the extention`
19-
- step 2 : `Go to extention in your chrome browser`
20-
- step 3 : `Active developer mode`
21-
- step 4 : `Now click on Load unpacked`
22-
- step 5 : `Selcte the folder of the extentionand`
23-
- step 6 : `now on youtube you don't see any more home and short !`
18+
- install: `go to extention in your chrome browser, active developer mode, now click on Load unpacked, selcte the folder of the extention, and now on youtube you don't see any more home and short !`
2419

2520
---
2621

@@ -41,6 +36,11 @@
4136

4237
### 📜 ChangeLog
4338

39+
```diff
40+
v0.0.3 ⋮ 08/11/2023
41+
! remove the recommendation bar in the video page
42+
```
43+
4444
```diff
4545
v0.0.2 ⋮ 08/11/2023
4646
! add a checkbox to enable and disable the extention whith the extention popup
@@ -55,4 +55,4 @@ v0.0.1 ⋮ 30/10/2023
5555

5656
---
5757

58-
<p>ReadMe By https://github.com/imvast</p>
58+
<p>ReadMe By https://github.com/imvast</p>

0 commit comments

Comments
 (0)