diff --git a/app/src/main/java/com/cookiegames/smartcookie/view/SmartCookieWebClient.kt b/app/src/main/java/com/cookiegames/smartcookie/view/SmartCookieWebClient.kt index ed264d19..ac789720 100644 --- a/app/src/main/java/com/cookiegames/smartcookie/view/SmartCookieWebClient.kt +++ b/app/src/main/java/com/cookiegames/smartcookie/view/SmartCookieWebClient.kt @@ -171,9 +171,6 @@ class SmartCookieWebClient( } override fun onPageFinished(view: WebView, url: String) { - if(userPreferences.cookieBlockEnabled){ - view.evaluateJavascript(cookieBlock.provideJs(), null) - } if(url.contains(BuildConfig.APPLICATION_ID + "/files/homepage.html")) { view.evaluateJavascript("javascript:(function() {" + "link1var = '" + userPreferences.link1 + "';" @@ -294,22 +291,7 @@ class SmartCookieWebClient( if (userPreferences.darkModeExtension && !WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) { view.evaluateJavascript(darkMode.provideJs(), null) } - val letDirectory = File(activity.getFilesDir(), "extensions") - letDirectory.mkdirs() - val file = File(letDirectory, "extension_file.txt") - if(file.exists()){ - var contents = file.readText() // Read file - - contents = contents.replace("(\\\\n)+".toRegex(), "") - contents = contents.replace("(\\\\\")+".toRegex(), "\"") - - - Log.d("extensions", contents) - view.settings.javaScriptEnabled = true - view.loadUrl("javascript:(function() {" + contents.toString() + "})()") - view.settings.javaScriptEnabled = userPreferences.javaScriptEnabled - } if (userPreferences.blockMalwareEnabled) { val inputStream: InputStream = activity.assets.open("malware.txt") val inputString = inputStream.bufferedReader().use { it.readText() } @@ -422,6 +404,9 @@ class SmartCookieWebClient( uiController.tabChanged(smartCookieView) } } + if(userPreferences.cookieBlockEnabled){ + view.evaluateJavascript(cookieBlock.provideJs(), null) + } } fun stringContainsItemFromList(inputStr: String, items: Array): Boolean { diff --git a/app/src/main/js/CookieBlock.js b/app/src/main/js/CookieBlock.js index a9ba95fd..2114e82b 100644 --- a/app/src/main/js/CookieBlock.js +++ b/app/src/main/js/CookieBlock.js @@ -1,8 +1,7 @@ // Copyright 2020 CookieJarApps -var styles = '[class*="ConsentBanner"], .cc_cookieAlert, .message-container, .rgpd-notice, #cookiemessage-root, #privacy_policy_wrapper, .cc_overlay_lock, .banner-gdpr, .eu-cookies-show, #cookies-consent, #privconsentContainer, #cookieConsentGTM, #js-cookie-banner, #ma-cookie-law-info, #ma-cookies-law-info, #js--tracking--note, #ideocookie-widget, #headerCookieInfo, .wx-cookie-ppp, .ip-cookie-banner, .cookie-consent--GDPR, #gd-cookiebar, .bottom-bar-cookies, #stickyCookieBar, .app_gdpr--2k2uB.css, -tes4ja-ConsentBanner, .qc-cmp2-container, .qc-cmp-ui-container, .cc_banner-wrapper, .cc-floating, #cookiePrompt, .kLCTYz, #gdpr-banner, #popup-announcements, .cookie-ui__cookieUI___3fxp1, #cookieWarning, #CybotCookiebotDialog, #catapult-cookie-bar, .FAVrq, #gpdr, .gpdr, .we-love-cookies, #privacy_notice, .cookiebar-bar, #stickyCookieBar, #onetrust-consent-sdk, .qc-cmp-cleanslate, .js-cookie-msg, #consent, .qc-cmp2-container, .lmZkxY, .cookiebanner, .bbccookies-banner, .butterBar-message, .gl-modal__main-content, .md-cookiesoptinout, .lOPC8 , .cp-overlay, .cp-dialog, .cc-light, .xFNJP, .yAVMkd, .vk_c, .evidon-consent-button, .cookie-warn, .cc-banner, .cc-bottom, .qc-cmp-ui-content, .hnf-banner, .m-privacy-consent, .c-cookie-disclaimer, .important-banner--cookies, .cookie-policy, .cookie-banner-optout, .cookie-banner__wrapper { visibility: hidden !important; height: 0; } .qc-cmp-ui-showing{ overflow:scroll; }' +var styles = '[class*="ConsentBanner"], .type-bottom, .cc_cookieAlert, .message-container, .rgpd-notice, #cookiemessage-root, #privacy_policy_wrapper, .cc_overlay_lock, .banner-gdpr, .eu-cookies-show, #cookies-consent, #privconsentContainer, #cookieConsentGTM, #js-cookie-banner, #ma-cookie-law-info, #ma-cookies-law-info, #js--tracking--note, #ideocookie-widget, #headerCookieInfo, .wx-cookie-ppp, .ip-cookie-banner, .cookie-consent--GDPR, #gd-cookiebar, .bottom-bar-cookies, #stickyCookieBar, .app_gdpr--2k2uB.css, -tes4ja-ConsentBanner, .qc-cmp2-container, .qc-cmp-ui-container, .cc_banner-wrapper, .cc-floating, #cookiePrompt, .kLCTYz, #gdpr-banner, #popup-announcements, .cookie-ui__cookieUI___3fxp1, #cookieWarning, #CybotCookiebotDialog, #catapult-cookie-bar, .FAVrq, #gpdr, .gpdr, .we-love-cookies, #privacy_notice, .cookiebar-bar, #stickyCookieBar, #onetrust-consent-sdk, .qc-cmp-cleanslate, .js-cookie-msg, #consent, .qc-cmp2-container, .lmZkxY, .cookiebanner, .bbccookies-banner, .butterBar-message, .gl-modal__main-content, .md-cookiesoptinout, .lOPC8 , .cp-overlay, .cp-dialog, .cc-light, .xFNJP, .yAVMkd, .vk_c, .evidon-consent-button, .cookie-warn, .cc-banner, .cc-bottom, .qc-cmp-ui-content, .hnf-banner, .m-privacy-consent, .c-cookie-disclaimer, .important-banner--cookies, .cookie-policy, .cookie-banner-optout, .cookie-banner__wrapper { visibility: hidden !important; height: 0; } .qc-cmp-ui-showing{ overflow:scroll; }' var styleSheet = document.createElement("style") styleSheet.type = "text/css" styleSheet.innerText = styles -document.head.appendChild(styleSheet) - +document.head.appendChild(styleSheet) \ No newline at end of file