( async ( ) => { const urlRegex = "^http(s?):\\/\\/" ; const blockRules = [ "namu.wiki" , "namu.mirror.wiki" , "namu.moe" , "mir.pe" , "namu.news" ] ; const searchResultClasses = [ 'xpd' , 'ez02md' , 'g' , 'ifM9O' ] ; let searchResults = [ ] ; function checkURLBanned ( url ) { for ( const rule of blockRules ) { const baseBlockRegex = new RegExp ( urlRegex + rule , "ig" ) ; if ( baseBlockRegex . test ( url ) ) { return true ; } } return false ; } const killList = [ ] ; console . log ( "NAMUWIKI SEARCH KILL ACTIVE!" ) ; console . time ( "namuKill" ) ; for ( const currentClass of searchResultClasses ) { console . log ( ) ; console . log ( "Searching for class:" , currentClass ) ; searchResults = document . getElementsByClassName ( currentClass ) as unknown as HTMLDivElement [ ] ; console . log ( "Current searchResults: " , searchResults ) ; for ( const searchResult of searchResults as unknown as HTMLDivElement [ ] ) { const searchResultAnchors = searchResult . getElementsByTagName ( 'a' ) ; for ( const searchResultAnchor of searchResultAnchors as unknown as HTMLAnchorElement [ ] ) { const banned = checkURLBanned ( searchResultAnchor . href ) ; if ( banned ) { killList . push ( searchResult ) ; } } } } for ( const kill of killList ) { try { kill . remove ( ) ; } catch { } } console . timeEnd ( "namuKill" ) ; } ) ( ) ;