2022-09-19 14:55:45 +02:00
|
|
|
/*******************************************************************************
|
|
|
|
|
|
|
|
uBlock Origin - a browser extension to block requests.
|
|
|
|
Copyright (C) 2019-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
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* jshint esversion:11 */
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
/// name css-specific
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
// Important!
|
|
|
|
// Isolate from global scope
|
2022-09-30 20:55:36 +02:00
|
|
|
(function uBOL_cssSpecific() {
|
2022-09-19 14:55:45 +02:00
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
2022-09-24 17:33:04 +02:00
|
|
|
// $rulesetId$
|
|
|
|
|
2022-10-15 19:05:20 +02:00
|
|
|
const argsList = self.$argsList$;
|
2022-09-19 14:55:45 +02:00
|
|
|
|
|
|
|
const hostnamesMap = new Map(self.$hostnamesMap$);
|
|
|
|
|
2022-09-24 17:33:04 +02:00
|
|
|
/******************************************************************************/
|
|
|
|
|
2022-09-19 14:55:45 +02:00
|
|
|
let hn;
|
|
|
|
try { hn = document.location.hostname; } catch(ex) { }
|
|
|
|
const styles = [];
|
|
|
|
while ( hn ) {
|
|
|
|
if ( hostnamesMap.has(hn) ) {
|
2022-10-15 19:05:20 +02:00
|
|
|
let argsIndices = hostnamesMap.get(hn);
|
|
|
|
if ( typeof argsIndices === 'number' ) { argsIndices = [ argsIndices ]; }
|
|
|
|
for ( const argsIndex of argsIndices ) {
|
|
|
|
const details = argsList[argsIndex];
|
2022-09-19 14:55:45 +02:00
|
|
|
if ( details.n && details.n.includes(hn) ) { continue; }
|
|
|
|
styles.push(details.a);
|
|
|
|
}
|
|
|
|
}
|
2022-09-24 17:33:04 +02:00
|
|
|
if ( hn === '*' ) { break; }
|
2022-09-19 14:55:45 +02:00
|
|
|
const pos = hn.indexOf('.');
|
2022-09-24 17:33:04 +02:00
|
|
|
if ( pos !== -1 ) {
|
|
|
|
hn = hn.slice(pos + 1);
|
|
|
|
} else {
|
|
|
|
hn = '*';
|
|
|
|
}
|
2022-09-19 14:55:45 +02:00
|
|
|
}
|
|
|
|
|
2022-10-15 19:05:20 +02:00
|
|
|
argsList.length = 0;
|
|
|
|
hostnamesMap.clear();
|
|
|
|
|
2022-09-19 14:55:45 +02:00
|
|
|
if ( styles.length === 0 ) { return; }
|
|
|
|
|
|
|
|
try {
|
|
|
|
const sheet = new CSSStyleSheet();
|
|
|
|
sheet.replace(`@layer{${styles.join(',')}{display:none!important;}}`);
|
|
|
|
document.adoptedStyleSheets = [
|
|
|
|
...document.adoptedStyleSheets,
|
|
|
|
sheet
|
|
|
|
];
|
|
|
|
} catch(ex) {
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************/
|
|
|
|
|
|
|
|
})();
|
|
|
|
|
|
|
|
/******************************************************************************/
|