$ remove cookiewall bookmarklet

Bookmarklet to remove cookiewall. Tries to find and remove backdrop/overlay, and popup box. Also attempts to restore body scrolling if needed (body.style.overflow='hidden' sometimes prevents scrolling) After it is done you can abort and undo, or click bookmark again later to undo. Seems to work on a few sites, but haven't tested many yet.

by Laurens Maneschijn

HTML

<pre>
Bookmarklet to remove cookiewall.

Tries to find backdrop/overlay, and popup box.
When elements have been found with a high enough probability,
they will be hidden (display:none).

Also attempts to restore body scrolling if needed
(body.style.overflow='hidden' sometimes prevents scrolling)

After it is done you can click bookmark again to undo if needed (if things break).

Seems to work on a few sites, but haven't tested many yet.
</pre>

<hr>
drag to bookmarks bar: 
<a href="javascript: (function(){ let backdrops = []; let popups = []; function init() { if (isUndoAvailable()) { if (confirm(&apos;Undo remove cookiewall?&apos;)) { executeUndo(); } return; } Array.from(document.querySelectorAll(&apos;*&apos;)).forEach( (el) =&gt; { let backdropProbability = getBackdropProbability(el); if (backdropProbability &gt; 100) { backdrops.push({ el: el, backdropProbability: backdropProbability }); } let popupProbability = getPopupProbability(el); if (popupProbability &gt; 100) { popups.push({ el: el, popupProbability: popupProbability }); } }); if (!backdrops.length &amp;&amp; !popups.length) { return; } backdrops.sort( (a, b) =&gt; { if (a.backdropProbability == b.backdropProbability) { return 0; } return a.backdropProbability &gt; b.backdropProbability ? -1 : 1; }); popups.sort( (a, b) =&gt; { if (a.popupProbability == b.popupProbability) { return 0; } return a.popupProbability &gt; b.popupProbability ? -1 : 1; }); if (backdrops[0] &amp;&amp; popups[0] &amp;&amp; backdrops[0].el === popups[0].el) { popups.shift(); } var backdrop = backdrops[0] ? (backdrops[0]).el : null; var popup = popups[0] ? (popups[0]).el : null; var undo = window.remove_cookiewall_undo = { elements: [] }; undo.elements.push({ el: document.body, style: {overflow: document.body.style.overflow}, }); if (document.body.style.overflow === &apos;hidden&apos;) { document.body.style.overflow = &apos;auto&apos;; } if (backdrop) { undo.elements.push({ el: backdrop, style: {display:...

CSS

/*

CSS panel unused, just some comments and examples here...


Some example test urls with cookiewall popups:
  (use incognito mode to make it appear again if you accepted it before, or clear cookies)

	https://thegimptutorials.com/how-to-make-gif/
	https://opensource.com/article/19/12/help-bash-program
	https://www.linuxquestions.org/questions/debian-26/stopping-a-runaway-script-4175462991/




Example html + css layout of cookiewalls:

	https://opensource.com/article/19/12/help-bash-program
		body
			<div id="pop-div06818956343113329" class="truste_overlay"></div>
				.truste_overlay {
				    background-color: #000;
				    opacity: 0.4;
				    position: fixed;
				    z-index: 1000010;
				    width: 100%;
				    height: 100%;
				    top: 0px;
				    left: 0px;
				    overflow: hidden;
				    filter: Alpha(Opacity: 80);
				}
			<div id="pop-div205702627587266527" class="truste_box_overlay">
				.truste_box_overlay {
				    position: absolute;
				    z-index: 2000010;
				    top: 0px;
				    left: 0px;
				    bottom: 0px;
				    right: 0px;
				    border-radius: 5px;
				    padding: 10px;
				    width: 80%;
				    max-width: 829px;
				    height: var(--truste-box-overlay-height);
				    min-width: 220px;
				    margin: 20px auto 20px var(--truste-box-overlay-margin-left);
				    box-sizing: content-box;
				    padding: 0px;
				    border-radius: 3px;
				    margin: 20px auto !important;
				}




	https://www.linuxquestions.org/questions/debian-26/stopping-a-runaway-script-4175462991/
		body
			<div class="fc-consent-root">
				<div class="fc-dialog-overlay"></div>
				<div class="fc-dialog-container">...</div>
				<div class="fc-help-dialog-container" role="dialog" tabindex="0" style="display: none !important;">
					<div class="fc-help-dialog-overlay"></div>
					<div class="fc-help-dialog">...</div>
				</div>
			</div>
		div.fc-consent-root {
		    position: fixed !important;
		    z-index: 2147483644 !important;
		    align-items:...

JavaScript

// DEBUG RETURN THROW ERROR temp disabled so code does not run on startup in jsfiddle
// DEBUG RETURN THROW ERROR temp disabled so code does not run on startup in jsfiddle
		return;	throw new Error('dont run in jsfiddle'); // remove me for bookmarklet
// DEBUG RETURN THROW ERROR temp disabled so code does not run on startup in jsfiddle
// DEBUG RETURN THROW ERROR temp disabled so code does not run on startup in jsfiddle


// To convert all code below into a bookmarklet, see:
// https://jsfiddle.net/ElMoonLite/ndg24dso/ -- convert javascript into a bookmarklet
// (copy all this JS here in the "Input" field there)


/*

remove cookiewall bookmarklet

- look for and remove: backdrop or overlay
- look for and remove: popup box
- fix original content: e.g. fix scrolling or blur or opacity etc.
- support preview or undo
- start out strict, but allow lose matching using (sorting on) probability?

indicators an element might be a backdrop/overlay or popup:

- backdrop/overlay:
	usually a full window size container (width: 100% height 100%)
	position: fixed or absolute, 
	often but not always direct child of document.body
	often black with opacity < 1,
	or background #000 with alpha < 1
	very high z-index
	overflow: hidden
	top: 0px
	left: 0px
	bottom: 0px
	right: 0px

- popup box: 
	element usually the next sibling of backdrop.
	sometimes popup is a child of the backdrop/overlay.
	very high z-index, above backdrop z-index.
	position often somewhere in the middle.
	or at the top or bottom, and full window width, or horizontally centered.

- document.body:
	sometimes scrolling is prevented, by using e.g. overflow: hidden, set back to overflow: auto

TODO: run tests on more sites, and clean up code a bit.

*/

//javascript:
(function(){
	
	let backdrops = [];
	let popups = [];

	function init() {

		if (isUndoAvailable()) {
			if (confirm('Undo remove cookiewall?')) {
				executeUndo();
			}
			return;
		}

		// Probability ranges from 0-1000 ish.
		// The chances of having...