mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-10 09:07:54 +01: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:
parent
a15c3564ef
commit
bc641fc024
6 changed files with 19 additions and 8 deletions
|
@ -211,7 +211,7 @@ body.needSave #revertRules {
|
|||
font-size: 1.6em;
|
||||
}
|
||||
|
||||
#basicTools:not(.canPick) .needPick {
|
||||
#basicTools .needPick:not(.canPick) {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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) ) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -628,6 +628,10 @@ onBroadcast(msg => {
|
|||
);
|
||||
};
|
||||
|
||||
µb.userFiltersAreEnabled = function() {
|
||||
return this.selectedFilterLists.includes(this.userFiltersPath);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
µb.autoSelectRegionalFilterLists = function(lists) {
|
||||
|
|
Loading…
Reference in a new issue