1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-09-04 18:19:38 +02:00
This commit is contained in:
gorhill 2014-12-19 14:00:46 -05:00
parent 35db700f58
commit 6fc7f96a48
3 changed files with 14 additions and 5 deletions

View File

@ -42,6 +42,11 @@ var messager = vAPI.messaging.channel('contentscript-end.js');
// ABP cosmetic filters
(function() {
if ( vAPI.skipCosmeticFiltering ) {
// console.debug('Abort cosmetic filtering');
return;
}
var queriedSelectors = {};
var injectedSelectors = vAPI.hideCosmeticFilters || {};
var classSelectors = null;

View File

@ -34,11 +34,16 @@
/******************************************************************************/
// because Safari
// Because Safari
if ( vAPI.canExecuteContentScript() !== true ) {
return;
}
// Because in case
if ( !vAPI ) {
return;
}
/******************************************************************************/
var localMessager = vAPI.messaging.channel('contentscript-start.js');
@ -116,6 +121,7 @@ var netFilters = function(details) {
};
var filteringHandler = function(details) {
vAPI.skipCosmeticFiltering = !details || details.skipCosmeticFiltering;
if ( details ) {
if ( details.cosmeticHide.length !== 0 || details.cosmeticDonthide.length !== 0 ) {
cosmeticFilters(details);

View File

@ -969,7 +969,7 @@ FilterContainer.prototype.pruneSelectorCache = function() {
/******************************************************************************/
FilterContainer.prototype.retrieveGenericSelectors = function(request) {
if ( µb.userSettings.parseAllABPHideFilters !== true ) {
if ( this.acceptedCount !== 0 ) {
return;
}
if ( !request.selectors ) {
@ -1031,9 +1031,6 @@ FilterContainer.prototype.retrieveGenericSelectors = function(request) {
/******************************************************************************/
FilterContainer.prototype.retrieveDomainSelectors = function(request) {
if ( µb.userSettings.parseAllABPHideFilters !== true ) {
return;
}
if ( !request.locationURL ) {
return;
}
@ -1047,6 +1044,7 @@ FilterContainer.prototype.retrieveDomainSelectors = function(request) {
var r = {
domain: domain,
entity: pos === -1 ? domain : domain.slice(0, pos - domain.length),
skipCosmeticFiltering: this.acceptedCount === 0,
cosmeticHide: [],
cosmeticDonthide: [],
netHide: [],