1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-05 11:37:01 +02:00

this addresses #1505

This commit is contained in:
gorhill 2016-03-26 08:56:19 -04:00
parent c68473b1f3
commit ff8f0eb7a9
3 changed files with 62 additions and 2 deletions

View File

@ -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

View File

@ -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)

View File

@ -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);
})();