Initial git commit
This commit is contained in:
commit
7b74311278
11
README.md
Normal file
11
README.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
A fork of the original Youtube UnHooked, with soma added features, including the ability to toggle comment visibility in the extension preferences.
|
||||
The content of the original README follows
|
||||
|
||||
# youtube-feed-hider
|
||||
A Chrome extension for hiding the feed on Youtube.com
|
||||
|
||||
Install here:
|
||||
https://chrome.google.com/webstore/detail/fkhfakakdbjcdipdgnbfngaljiecclaf/
|
||||
|
||||
Also see this related extension from Stanford:
|
||||
https://habitlab.stanford.edu/
|
25
manifest.json
Normal file
25
manifest.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "Youtube UnHooked",
|
||||
"version": "0.9",
|
||||
"description": "Hides parts of Youtube that are unneeded/addictive: recommendations, related videos, comments.",
|
||||
"content_scripts": [
|
||||
{
|
||||
"matches": ["https://www.youtube.com/*"],
|
||||
"css": ["styles.css"],
|
||||
"js": ["styles.js"]
|
||||
}
|
||||
],
|
||||
"browser_specific_settings": {
|
||||
"gecko": {
|
||||
"id": "youtube-unhooked@ffffff.gov"
|
||||
}
|
||||
},
|
||||
"manifest_version": 2,
|
||||
"options_ui": {
|
||||
"page": "options.html",
|
||||
"browser_style": true
|
||||
},
|
||||
"permissions": [
|
||||
"storage"
|
||||
]
|
||||
}
|
17
options.html
Normal file
17
options.html
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form>
|
||||
<hr>
|
||||
<input type="checkbox" name="Disable" id="commentsRemoveCheck" value="Comments">Disable Comments?<br>
|
||||
<hr>
|
||||
<button id="submitbtn" type="submit">Save</button>
|
||||
</form>
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
</html>
|
16
options.js
Normal file
16
options.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
function saveOptions(e) {
|
||||
browser.storage.sync.set({
|
||||
commentsRemove: document.getElementById("commentsRemoveCheck").checked
|
||||
});
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
function restoreOptions() {
|
||||
var gettingItem = browser.storage.sync.get({commentsRemove: false});
|
||||
gettingItem.then((res) => {
|
||||
document.getElementById("commentsRemoveCheck").checked = res.commentsRemove;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', restoreOptions);
|
||||
document.querySelector("form").addEventListener("submit", saveOptions);
|
40
styles.css
Normal file
40
styles.css
Normal file
|
@ -0,0 +1,40 @@
|
|||
/** Youtube CSS overrides **/
|
||||
|
||||
/** FRONT PAGE FEED **/
|
||||
|
||||
/** Displayed while loading, grey boxes **/
|
||||
#home-page-skeleton {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
/**
|
||||
Must use visibility instead of display as otherwise
|
||||
it thinks that the user has scrolled and tries to load
|
||||
additional feed items repeatedly.
|
||||
**/
|
||||
ytd-browse[role="main"][page-subtype="home"] #contents {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
|
||||
/** RELATED VIDEOS (SIDEBAR) **/
|
||||
|
||||
/** Displayed while loading, grey boxes **/
|
||||
#related-skeleton, .watch-skeleton {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
ytd-watch-next-secondary-results-renderer {
|
||||
visibility: hidden !important;
|
||||
}
|
||||
|
||||
/** COMMENTS **/
|
||||
|
||||
/* changed
|
||||
ytd-comments {
|
||||
visibility: visible !important;
|
||||
} */
|
||||
|
||||
/** RELATED VIDEOS (END OF VIDEO SCREEN) **/
|
||||
.ytp-videowall-still, .ytp-endscreen-previous, .ytp-endscreen-next {
|
||||
display: none !important;
|
||||
}
|
17
styles.js
Normal file
17
styles.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
let gettingItem = browser.storage.sync.get({commentsRemove: false});
|
||||
// Retrieves the storage variable to determine whether comments should be removed
|
||||
|
||||
function setComments(remove) {
|
||||
document.getElementsByTagName("ytd-comments")[0].style.visibility = remove ? "hidden" : "visible";
|
||||
}
|
||||
|
||||
function onGot(result) {
|
||||
var remove = result.commentsRemove;
|
||||
setComments(remove);
|
||||
// Sets the visibility of the comments section depending on the storage vairable
|
||||
}
|
||||
function onFailure(error) {
|
||||
alert(`Error: ${error}`);
|
||||
}
|
||||
|
||||
gettingItem.then(onGot, onFailure);
|
Loading…
Reference in a new issue