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 });
|
BIN
icon128.png
Normal file
BIN
icon128.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.3 KiB |
BIN
icon16.png
Normal file
BIN
icon16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
icon32.png
Normal file
BIN
icon32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
BIN
icon48.png
Normal file
BIN
icon48.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
18
manifest.json
Normal file
18
manifest.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"manifest_version": 3,
|
||||
"name": "Block Youtube Shorts",
|
||||
"description": "Blocks the Youtube Short buttons and sections on the main page.",
|
||||
"version": "1.0",
|
||||
"icons": {
|
||||
"16": "icon16.png",
|
||||
"32": "icon32.png",
|
||||
"48": "icon48.png",
|
||||
"128": "icon128.png"
|
||||
},
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["https://www.youtube.com/*"],
|
||||
"js": ["Content.js"]
|
||||
}
|
||||
]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue