mirror of https://github.com/gorhill/uBlock.git
this fixes #1113
This commit is contained in:
parent
231e640a79
commit
1a0d36b7aa
|
@ -135,7 +135,7 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
var selectors = vAPI.hideCosmeticFilters;
|
var selectors = vAPI.hideCosmeticFilters;
|
||||||
if ( typeof selectors === 'object' ) {
|
if ( typeof selectors === 'object' ) {
|
||||||
injectedSelectors = selectors;
|
injectedSelectors = selectors;
|
||||||
//hideElements(Object.keys(selectors));
|
hideElements(Object.keys(selectors));
|
||||||
}
|
}
|
||||||
// Add exception filters into injected filters collection, in order
|
// Add exception filters into injected filters collection, in order
|
||||||
// to force them to be seen as "already injected".
|
// to force them to be seen as "already injected".
|
||||||
|
@ -196,10 +196,11 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
// - Injecting a style tag
|
// - Injecting a style tag
|
||||||
|
|
||||||
var addStyleTag = function(selectors) {
|
var addStyleTag = function(selectors) {
|
||||||
//hideElements(selectors);
|
var selectorStr = selectors.toString();
|
||||||
|
hideElements(selectorStr);
|
||||||
var style = document.createElement('style');
|
var style = document.createElement('style');
|
||||||
// The linefeed before the style block is very important: do no remove!
|
// The linefeed before the style block is very important: do no remove!
|
||||||
style.appendChild(document.createTextNode(selectors.toString() + '\n{display:none !important;}'));
|
style.appendChild(document.createTextNode(selectorStr + '\n{display:none !important;}'));
|
||||||
var parent = document.body || document.documentElement;
|
var parent = document.body || document.documentElement;
|
||||||
if ( parent ) {
|
if ( parent ) {
|
||||||
parent.appendChild(style);
|
parent.appendChild(style);
|
||||||
|
@ -213,7 +214,6 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
//console.debug('µBlock> generic cosmetic filters: injecting %d CSS rules:', selectors.length, text);
|
//console.debug('µBlock> generic cosmetic filters: injecting %d CSS rules:', selectors.length, text);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
var hideElements = function(selectors) {
|
var hideElements = function(selectors) {
|
||||||
// https://github.com/gorhill/uBlock/issues/207
|
// https://github.com/gorhill/uBlock/issues/207
|
||||||
// Do not call querySelectorAll() using invalid CSS selectors
|
// Do not call querySelectorAll() using invalid CSS selectors
|
||||||
|
@ -231,7 +231,6 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
|
||||||
elems[i].style.setProperty('display', 'none', 'important');
|
elems[i].style.setProperty('display', 'none', 'important');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
// Extract and return the staged nodes which (may) match the selectors.
|
// Extract and return the staged nodes which (may) match the selectors.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue