From e8251dcd52a6f94df8d6d573e3393023037a94cc Mon Sep 17 00:00:00 2001 From: kgsensei Date: Wed, 20 Mar 2024 21:10:50 -0400 Subject: [PATCH] Improved adblock --- NitroTypeHack2/MainWindow.xaml.cs | 38 ++++++++++++++++--------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/NitroTypeHack2/MainWindow.xaml.cs b/NitroTypeHack2/MainWindow.xaml.cs index a330e71..c89d3d9 100644 --- a/NitroTypeHack2/MainWindow.xaml.cs +++ b/NitroTypeHack2/MainWindow.xaml.cs @@ -368,6 +368,12 @@ private void CoreWebView2_WebResourceResponseReceived( { injectAutoStartScript(); } + webview2.ExecuteScriptAsync(@" + NTGLOBALS.NO_ADS = true; + setInterval(() => { + const tmpx = document.getElementsByClassName('ad'); + for (let i = 0; i < tmpx.length; i++) { + tmpx[i].remove();}},100)"); } // Ad blocker. @@ -376,24 +382,20 @@ private void CoreWebView2_WebResourceRequested( CoreWebView2WebResourceRequestedEventArgs e) { string uri = e.Request.Uri; - if (uri.IndexOf("googlesyndication") != -1 || - uri.IndexOf("adservice") != -1 || - uri.IndexOf("adsystem") != -1 || - uri.IndexOf("adsafeprotected") != -1 || - uri.IndexOf("facebook") != -1 || - uri.IndexOf("googletagmanager") != -1 || - uri.IndexOf("google-analytics") != -1 || - uri.IndexOf("ad-delivery") != -1 || - uri.IndexOf("doubleclick") != -1 || - uri.IndexOf("adlightning") != -1 || - uri.IndexOf("smartadserver") != -1 || - uri.IndexOf("quantserve") != -1 || - uri.IndexOf("qccerttest") != -1 || - uri.IndexOf("qualaroo") != -1 || - uri.IndexOf("criteo") != -1 || - uri.IndexOf("moatads") != -1 || - uri.IndexOf("intergi") != -1 || - uri.IndexOf("playwire") != -1) + if ( + uri.IndexOf("doubleclick.net") != -1 || + uri.IndexOf("vuukle.com") != -1 || + uri.IndexOf("cloudfront.net") != -1 || + uri.IndexOf("proper.io") != -1 || + uri.IndexOf("pub.network") != -1 || + uri.IndexOf("btloader.com") != -1 || + uri.IndexOf("intergient.com") != -1 || + uri.IndexOf("qualaroo.com") != -1 || + uri.IndexOf("facebook.net") != -1 || + uri.IndexOf("facebook.com") != -1 || + uri.IndexOf("googletagmanager.com") != -1 || + uri.IndexOf("cloudflareinsights.com") != -1 + ) { e.Response = webview2.CoreWebView2.Environment.CreateWebResourceResponse(null, 404, "Not Found", null); }