youtube-unhookedplusplus/styles.js
2020-01-03 12:48:26 +01:00

18 lines
548 B
JavaScript

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);