mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-13 10:17:34 +01:00
this fixes #869
This commit is contained in:
parent
265d18edc1
commit
6318d24f40
2 changed files with 22 additions and 18 deletions
|
@ -574,7 +574,8 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
var req = filterRequests[details.id];
|
var req = filterRequests[details.id];
|
||||||
delete filterRequests[details.id];
|
delete filterRequests[details.id];
|
||||||
|
|
||||||
if ( details.collapse === undefined ) {
|
// https://github.com/gorhill/uBlock/issues/869
|
||||||
|
if ( details.collapse !== true ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,13 +583,10 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
|
|
||||||
// If `!important` is not there, going back using history will
|
// If `!important` is not there, going back using history will
|
||||||
// likely cause the hidden element to re-appear.
|
// likely cause the hidden element to re-appear.
|
||||||
if ( details.collapse ) {
|
// https://github.com/gorhill/uBlock/issues/399
|
||||||
// https://github.com/gorhill/uBlock/issues/399
|
|
||||||
// Never remove elements from the DOM, just hide them
|
// Never remove elements from the DOM, just hide them
|
||||||
req.target.style.setProperty('display', 'none', 'important');
|
req.target.style.setProperty('display', 'none', 'important');
|
||||||
} else {
|
|
||||||
req.target.style.setProperty('visibility', 'hidden', 'important');
|
|
||||||
}
|
|
||||||
|
|
||||||
messager.send({
|
messager.send({
|
||||||
what: 'injectedSelectors',
|
what: 'injectedSelectors',
|
||||||
|
@ -672,21 +670,22 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
if ( typeof details !== 'object' || details === null ) {
|
if ( typeof details !== 'object' || details === null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var requests = details.requests;
|
|
||||||
var collapse = details.collapse;
|
var collapse = details.collapse;
|
||||||
|
|
||||||
|
// https://github.com/gorhill/uBlock/issues/869
|
||||||
|
if ( collapse !== true ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var requests = details.requests;
|
||||||
var selectors = [];
|
var selectors = [];
|
||||||
var i = requests.length;
|
var i = requests.length;
|
||||||
var request, elem;
|
var request;
|
||||||
while ( i-- ) {
|
while ( i-- ) {
|
||||||
request = requests[i];
|
request = requests[i];
|
||||||
elem = elements[request.index];
|
// https://github.com/gorhill/uBlock/issues/399
|
||||||
if ( collapse ) {
|
// Never remove elements from the DOM, just hide them
|
||||||
// https://github.com/gorhill/uBlock/issues/399
|
elements[request.index].style.setProperty('display', 'none', 'important');
|
||||||
// Never remove elements from the DOM, just hide them
|
|
||||||
elem.style.setProperty('display', 'none', 'important');
|
|
||||||
} else {
|
|
||||||
elem.style.setProperty('visibility', 'hidden', 'important');
|
|
||||||
}
|
|
||||||
selectors.push(request.tagName + '[' + srcProps[request.tagName] + '="' + request.url + '"]');
|
selectors.push(request.tagName + '[' + srcProps[request.tagName] + '="' + request.url + '"]');
|
||||||
}
|
}
|
||||||
if ( selectors.length !== 0 ) {
|
if ( selectors.length !== 0 ) {
|
||||||
|
|
|
@ -254,6 +254,11 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
||||||
|
|
||||||
// Post-change
|
// Post-change
|
||||||
switch ( name ) {
|
switch ( name ) {
|
||||||
|
case 'collapseBlocked':
|
||||||
|
if ( value === false ) {
|
||||||
|
this.cosmeticFilteringEngine.removeFromSelectorCache('*', 'net');
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'contextMenuEnabled':
|
case 'contextMenuEnabled':
|
||||||
this.contextMenu.toggle(value);
|
this.contextMenu.toggle(value);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue