youtube-unhookedplusplus/styles.js

23 lines
648 B
JavaScript
Raw Normal View History

2020-01-03 12:48:26 +01:00
let gettingItem = browser.storage.sync.get({commentsRemove: false});
// Retrieves the storage variable to determine whether comments should be removed
function setComments(remove) {
if (!remove)
return;
var commentStyle = document.createElement('style');
document.head.appendChild(commentStyle);
commentStyle.sheet.insertRule("ytd-comments {visibility: hidden !important}");
2020-01-03 12:48:26 +01:00
}
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);