forked from zusorio/GoodTwitterChrome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove-banner.js
30 lines (24 loc) · 1.16 KB
/
remove-banner.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Remove warning banners that the browser is outdated
let topBannerContainer = document.getElementById("banners");
if (topBannerContainer !== null) {
topBannerContainer.classList.add("hidden")
}
// Resize the large padding removing the banner creates
let topSpacerBar = document.getElementsByClassName("topbar-spacer");
if (topSpacerBar !== null && topSpacerBar[0] !== undefined) {
topSpacerBar[0].style.paddingTop = "50px";
}
// Remove search warning banner
let searchWarningContainer = document.getElementsByClassName("BannersContainer");
if (searchWarningContainer !== null && searchWarningContainer[0] !== undefined) {
searchWarningContainer[0].classList.add("hidden");
}
// make sure that if the banner doesn't exist, wait until it does before removing it
let searchObserver = new MutationObserver(mutations => {
let searchWarningContainer = document.getElementsByClassName("BannersContainer");
if (searchWarningContainer !== null && searchWarningContainer[0] !== undefined) {
searchWarningContainer[0].classList.add("hidden");
searchObserver.disconnect();
}
});
searchObserver.observe(document.body, {childList: true, subtree: true});