uBlock/platform/mv3/scriptlets/css-generic.template.js
2025-03-13 19:02:20 -04:00

87 lines
2.9 KiB
JavaScript

/*******************************************************************************
uBlock Origin Lite - a comprehensive, MV3-compliant content blocker
Copyright (C) 2014-present Raymond Hill
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see {http://www.gnu.org/licenses/}.
Home: https://github.com/gorhill/uBlock
*/
// $rulesetId$
// Important!
// Isolate from global scope
(function uBOL_cssGenericImport() {
/******************************************************************************/
const genericSelectorMap = self.$genericSelectorMap$;
const genericExceptionSieve = self.$genericExceptionSieve$;
const genericExceptionMap = self.$genericExceptionMap$;
if ( genericSelectorMap ) {
const map = self.genericSelectorMap =
self.genericSelectorMap || new Map();
if ( map.size !== 0 ) {
for ( const entry of genericSelectorMap ) {
const before = map.get(entry[0]);
if ( before === undefined ) {
map.set(entry[0], entry[1]);
} else {
map.set(entry[0], `${before},\n${entry[1]}`);
}
}
} else {
self.genericSelectorMap = new Map(genericSelectorMap);
}
genericSelectorMap.length = 0;
}
if ( genericExceptionSieve ) {
const hashes = self.genericExceptionSieve =
self.genericExceptionSieve || new Set();
if ( hashes.size !== 0 ) {
for ( const hash of genericExceptionSieve ) {
hashes.add(hash);
}
} else {
self.genericExceptionSieve = new Set(genericExceptionSieve);
}
genericExceptionSieve.length = 0;
}
if ( genericExceptionMap ) {
const map = self.genericExceptionMap =
self.genericExceptionMap || new Map();
if ( map.size !== 0 ) {
for ( const entry of genericExceptionMap ) {
const before = map.get(entry[0]);
if ( before === undefined ) {
map.set(entry[0], entry[1]);
} else {
map.set(entry[0], `${before}\n${entry[1]}`);
}
}
} else {
self.genericExceptionMap = new Map(genericExceptionMap);
}
genericExceptionMap.length = 0;
}
/******************************************************************************/
})();
/******************************************************************************/