1+ window . onload = function ( ) {
2+ // Function to hide an element by ID
3+ function hideElementById ( id ) {
4+ const element = document . getElementById ( id ) ;
5+ if ( element ) {
6+ element . style . display = 'none' ;
7+ }
8+ }
9+
10+ // Function to hide elements by class name prefix
11+ function hideElementsByClassPrefix ( prefix ) {
12+ const elements = document . querySelectorAll ( `[class^="${ prefix } "]` ) ;
13+ elements . forEach ( element => {
14+ element . style . display = 'none' ;
15+ } ) ;
16+ }
17+
18+ // Function to remove ::after pseudo-element styles
19+ function removeAfterPseudoElement ( attribute , value ) {
20+ const style = document . createElement ( 'style' ) ;
21+ style . innerHTML = `[${ attribute } ="${ value } "]::after { content: none !important; }` ;
22+ document . head . appendChild ( style ) ;
23+ }
24+
25+ // Function to overwrite overflow-y for class names starting with a prefix
26+ function overwriteOverflowYForClassPrefix ( prefix ) {
27+ const elements = document . querySelectorAll ( `[class^="${ prefix } "]` ) ;
28+ elements . forEach ( element => {
29+ element . style . setProperty ( 'overflow-y' , 'auto' , 'important' ) ;
30+ element . style . setProperty ( 'height' , 'auto' , 'important' ) ;
31+ } ) ;
32+ }
33+
34+ function overwriteMaskImageForClassSubstring ( substring ) {
35+ const elements = document . querySelectorAll ( `[class*="${ substring } "]` ) ;
36+ elements . forEach ( element => {
37+ element . style . maskImage = 'none' ;
38+ } ) ;
39+ }
40+
41+ // Function to remove all class names from the html tag
42+ function removeAllClassNamesFromHtml ( ) {
43+ const htmlElement = document . documentElement ;
44+ htmlElement . className = '' ;
45+ }
46+
47+ // Function to remove all class names from the body tag
48+ function removeAllClassNamesFromBody ( ) {
49+ const bodyElement = document . body ;
50+ bodyElement . className = '' ;
51+ }
52+ removeAfterPseudoElement ( 'data-component' , 'nav' ) ;
53+ setInterval ( ( ) => {
54+ // Example usage
55+ hideElementById ( 'fortress-container-root' ) ;
56+ hideElementsByClassPrefix ( 'media-ui-FullWidthAd' ) ;
57+ overwriteOverflowYForClassPrefix ( 'media-ui-LeaderboardAd' ) ;
58+ overwriteMaskImageForClassSubstring ( 'Blur' ) ;
59+ removeAllClassNamesFromHtml ( ) ;
60+ removeAllClassNamesFromBody ( ) ;
61+ } , 500 ) ;
62+ }
0 commit comments