Initial commit
This commit is contained in:
commit
d7ed922b18
6 changed files with 56 additions and 0 deletions
38
Content.js
Normal file
38
Content.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
function removeShortButtons(){
|
||||
const shortsButtons = document.querySelectorAll('a[title="Shorts"]');
|
||||
|
||||
shortsButtons.forEach(button => {
|
||||
button.remove();
|
||||
});
|
||||
}
|
||||
|
||||
function removeShortSections(){
|
||||
const sections = document.querySelectorAll("span#title.style-scope.ytd-rich-shelf-renderer");
|
||||
sections.forEach(title => {
|
||||
if (title.textContent.trim() === "Shorts") {
|
||||
var section = title;
|
||||
for (let i = 1; i < 7; i++) {
|
||||
section = section.parentElement;
|
||||
if (!section){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (section.className == "style-scope ytd-rich-shelf-renderer") {
|
||||
section.style.display = "none";
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
removeShortButtons();
|
||||
removeShortSections();
|
||||
});
|
||||
|
||||
const observer = new MutationObserver(function (mutations) {
|
||||
removeShortButtons();
|
||||
removeShortSections();
|
||||
});
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
Loading…
Add table
Add a link
Reference in a new issue