1
0
mirror of https://github.com/gorhill/uBlock.git synced 2024-07-08 04:49:12 +02:00

Prevent access to picker when "My filters" is not enabled

Related issue:
https://github.com/uBlockOrigin/uBlock-issues/issues/3076
This commit is contained in:
Raymond Hill 2024-01-16 08:31:46 -05:00
parent a15c3564ef
commit bc641fc024
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
6 changed files with 19 additions and 8 deletions

View File

@ -211,7 +211,7 @@ body.needSave #revertRules {
font-size: 1.6em;
}
#basicTools:not(.canPick) .needPick {
#basicTools .needPick:not(.canPick) {
visibility: hidden;
}

View File

@ -139,6 +139,8 @@ vAPI.commands.onCommand.addListener(async command => {
switch ( command ) {
case 'launch-element-picker':
if ( µb.userFiltersAreEnabled() === false ) { break; }
/* fall through */
case 'launch-element-zapper': {
µb.epickerArgs.mouse = false;
µb.elementPickerExec(

View File

@ -200,7 +200,11 @@ let currentBits = 0;
const update = function(tabId = undefined) {
let newBits = 0;
if ( µb.userSettings.contextMenuEnabled && tabId !== undefined ) {
if (
µb.userSettings.contextMenuEnabled &&
µb.userFiltersAreEnabled() &&
tabId !== undefined
) {
const pageStore = µb.pageStoreFromTabId(tabId);
if ( pageStore && pageStore.getNetFilteringSwitch() ) {
if ( pageStore.shouldApplySpecificCosmeticFilters(0) ) {

View File

@ -369,6 +369,7 @@ const popupDataFromTabId = function(tabId, tabTitle) {
fontSize: µbhs.popupFontSize,
godMode: µbhs.filterAuthorMode,
netFilteringSwitch: false,
userFiltersAreEnabled: µb.userFiltersAreEnabled(),
rawURL: tabContext.rawURL,
pageURL: tabContext.normalURL,
pageHostname: rootHostname,

View File

@ -614,11 +614,11 @@ const renderPopup = function() {
}
}
dom.cl.toggle(
'#basicTools',
'canPick',
popupData.canElementPicker === true && isFiltering
);
const canPick = popupData.canElementPicker && isFiltering;
dom.cl.toggle('#gotoZap', 'canPick', canPick);
dom.cl.toggle('#gotoPick', 'canPick', canPick && popupData.userFiltersAreEnabled);
dom.cl.toggle('#gotoReport', 'canPick', canPick);
let blocked, total;
if ( popupData.pageCounts !== undefined ) {
@ -675,7 +675,7 @@ const renderPopup = function() {
total ? Math.min(total, 99).toLocaleString() : ''
);
// Unprocesseed request(s) warning
// Unprocessed request(s) warning
dom.cl.toggle(dom.root, 'warn', popupData.hasUnprocessedRequest === true);
dom.cl.toggle(dom.html, 'colorBlind', popupData.colorBlindFriendly === true);

View File

@ -628,6 +628,10 @@ onBroadcast(msg => {
);
};
µb.userFiltersAreEnabled = function() {
return this.selectedFilterLists.includes(this.userFiltersPath);
};
/******************************************************************************/
µb.autoSelectRegionalFilterLists = function(lists) {