mirror of https://github.com/gorhill/uBlock.git
[mv3] Prevent enabling more filter lists than allowed
Related issue: - https://github.com/uBlockOrigin/uBOL-issues/issues/56#issuecomment-1627692213
This commit is contained in:
parent
3f7b7fe266
commit
634fdde465
|
@ -144,6 +144,11 @@ p {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.noMoreRuleset .listEntry:not(.checked) {
|
||||||
|
opacity: 0.5;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
/* touch-screen devices */
|
/* touch-screen devices */
|
||||||
:root.mobile .listEntry .fa-icon {
|
:root.mobile .listEntry .fa-icon {
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
|
|
|
@ -191,6 +191,7 @@ function onMessage(request, sender, callback) {
|
||||||
callback({
|
callback({
|
||||||
defaultFilteringMode,
|
defaultFilteringMode,
|
||||||
enabledRulesets,
|
enabledRulesets,
|
||||||
|
maxNumberOfEnabledRulesets: dnr.MAX_NUMBER_OF_ENABLED_STATIC_RULESETS,
|
||||||
rulesetDetails: Array.from(rulesetDetails.values()),
|
rulesetDetails: Array.from(rulesetDetails.values()),
|
||||||
autoReload: rulesetConfig.autoReload === 1,
|
autoReload: rulesetConfig.autoReload === 1,
|
||||||
firstRun,
|
firstRun,
|
||||||
|
|
|
@ -221,10 +221,12 @@ const renderWidgets = function() {
|
||||||
qs$('#autoReload input[type="checkbox"').checked = cachedRulesetData.autoReload;
|
qs$('#autoReload input[type="checkbox"').checked = cachedRulesetData.autoReload;
|
||||||
|
|
||||||
// Compute total counts
|
// Compute total counts
|
||||||
|
let rulesetCount = 0;
|
||||||
let filterCount = 0;
|
let filterCount = 0;
|
||||||
let ruleCount = 0;
|
let ruleCount = 0;
|
||||||
for ( const liEntry of qsa$('#lists .listEntry[data-listkey]') ) {
|
for ( const liEntry of qsa$('#lists .listEntry[data-listkey]') ) {
|
||||||
if ( qs$(liEntry, 'input[type="checkbox"]:checked') === null ) { continue; }
|
if ( qs$(liEntry, 'input[type="checkbox"]:checked') === null ) { continue; }
|
||||||
|
rulesetCount += 1;
|
||||||
const stats = rulesetStats(liEntry.dataset.listkey);
|
const stats = rulesetStats(liEntry.dataset.listkey);
|
||||||
if ( stats === undefined ) { continue; }
|
if ( stats === undefined ) { continue; }
|
||||||
ruleCount += stats.ruleCount;
|
ruleCount += stats.ruleCount;
|
||||||
|
@ -234,6 +236,10 @@ const renderWidgets = function() {
|
||||||
.replace('{{ruleCount}}', ruleCount.toLocaleString())
|
.replace('{{ruleCount}}', ruleCount.toLocaleString())
|
||||||
.replace('{{filterCount}}', filterCount.toLocaleString())
|
.replace('{{filterCount}}', filterCount.toLocaleString())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
dom.cl.toggle(dom.body, 'noMoreRuleset',
|
||||||
|
rulesetCount === cachedRulesetData.maxNumberOfEnabledRulesets
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -292,7 +298,9 @@ dom.on('#autoReload input[type="checkbox"', 'change', ev => {
|
||||||
async function applyEnabledRulesets() {
|
async function applyEnabledRulesets() {
|
||||||
const enabledRulesets = [];
|
const enabledRulesets = [];
|
||||||
for ( const liEntry of qsa$('#lists .listEntry[data-listkey]') ) {
|
for ( const liEntry of qsa$('#lists .listEntry[data-listkey]') ) {
|
||||||
if ( qs$(liEntry, 'input[type="checkbox"]:checked') === null ) { continue; }
|
const checked = qs$(liEntry, 'input[type="checkbox"]:checked') !== null;
|
||||||
|
dom.cl.toggle(liEntry, 'checked', checked);
|
||||||
|
if ( checked === false ) { continue; }
|
||||||
enabledRulesets.push(liEntry.dataset.listkey);
|
enabledRulesets.push(liEntry.dataset.listkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue