From ff8f0eb7a9c39e8941f292cad3e691d190c7554a Mon Sep 17 00:00:00 2001 From: gorhill Date: Sat, 26 Mar 2016 08:56:19 -0400 Subject: [PATCH] this addresses #1505 --- assets/checksums.txt | 4 +-- assets/ublock/filters.txt | 2 ++ assets/ublock/resources.txt | 58 +++++++++++++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) diff --git a/assets/checksums.txt b/assets/checksums.txt index 6f7c77dc7..6a17b4083 100644 --- a/assets/checksums.txt +++ b/assets/checksums.txt @@ -1,11 +1,11 @@ 8cebf7ef8d801c5aef9a48d85fc45a8b assets/ublock/unbreak.txt 62111a29f0a5cb361ba8dbae92054adb assets/ublock/redirect-resources.txt 7b860287140f033765f8e635d87cd6e8 assets/ublock/privacy.txt -b822a09258ebc845d1a9e423845b972b assets/ublock/filters.txt +612393fdfb9d13a638dee3aa666fee55 assets/ublock/filters.txt 98088252cedafb8571cf61b91bea219e assets/ublock/badware.txt 5baa90e2da7cd6a73edff2010557ee57 assets/ublock/redirect.txt 89f1a0b14271b83ca4980a3373d5fc12 assets/ublock/experimental.txt -5e2cbf111cfbc6ea76687d3e1d0c7bcb assets/ublock/resources.txt +9f59360b851d54c30394577348b53f92 assets/ublock/resources.txt 059e0bfbf22bd242dda7b07389fe09a2 assets/ublock/filter-lists.json 3605c73f21abca428c7eb69a8bc32dfe assets/thirdparties/easylist-downloads.adblockplus.org/easyprivacy.txt a91af77c47c302c0741c7445b0fada1a assets/thirdparties/easylist-downloads.adblockplus.org/easylist.txt diff --git a/assets/ublock/filters.txt b/assets/ublock/filters.txt index 2aa12d0f3..f292d1cc1 100644 --- a/assets/ublock/filters.txt +++ b/assets/ublock/filters.txt @@ -348,3 +348,5 @@ lemonde.fr##script:inject(lemonde-defuser.js) # https://forums.lanik.us/viewtopic.php?f=91&t=29267 www.rtl.fr###modal-warning rtl.fr##script:inject(rtlfr-defuser.js) +# https://github.com/gorhill/uBlock/issues/1505 +6play.fr,clubic.com,passeportsante.net,telerama.fr##script:inject(overlay-buster.js) diff --git a/assets/ublock/resources.txt b/assets/ublock/resources.txt index 6e7e5b609..5f406cf4c 100644 --- a/assets/ublock/resources.txt +++ b/assets/ublock/resources.txt @@ -951,3 +951,61 @@ rtlfr-defuser.js application/javascript document.body.style.setProperty('overflow', 'auto'); }); })(); + + +# Experimental: Generic overlay defuser. +# if this works well and proves to be useful, this may end up as a stock tool +# in uBO's popup panel. +overlay-buster.js application/javascript +(function() { + if ( window !== window.top ) { + return; + } + var shutdown = function() { + observer.disconnect(); + observer = null; + }; + var ttlTimer = setTimeout(shutdown, 15000); + var timer = null; + var domChanged = function(mutations) { + timer = null; + var docEl = document.documentElement, + bodyEl = document.body, + vw = Math.min(docEl.clientWidth, window.innerWidth), + vh = Math.min(docEl.clientHeight, window.innerHeight), + el = document.elementFromPoint(vw/2, vh/2), + style, rect; + for (;;) { + if ( el === null || el.parentNode === null || el === bodyEl ) { + return; + } + style = window.getComputedStyle(el); + if ( (parseInt(style.zIndex, 10) || 0) >= 1000 && style.position === 'fixed' ) { + rect = el.getBoundingClientRect(); + if ( rect.left <= 0 && rect.top <= 0 && rect.right >= vw && rect.bottom >= vh ) { + el.parentNode.removeChild(el); + if ( ttlTimer !== null ) { + clearTimeout(ttlTimer); + ttlTimer = setTimeout(shutdown); + } + return; + } + } + el = el.parentNode; + } + }; + var domChangedAsync = function(mutations) { + if ( timer === null ) { + timer = setTimeout(domChanged, 50); + } + }; + var observer = new MutationObserver(domChangedAsync); + var domReady = function(ev) { + document.removeEventListener(ev.type, domReady); + observer.observe(document.body, { + childList: true, + subtree: true + }); + }; + document.addEventListener('DOMContentLoaded', domReady); +})();