mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-15 07:22:28 +02:00
code review
This commit is contained in:
parent
c6668391e0
commit
aa8b5850b8
@ -196,6 +196,15 @@ HnSwitches.prototype.toggleBranchZ = function(switchName, targetHostname, newSta
|
|||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
|
HnSwitches.prototype.toggleZ = function(switchName, hostname, deep, newState) {
|
||||||
|
if ( deep === true ) {
|
||||||
|
return this.hnSwitches.toggleBranchZ(switchName, hostname, newState);
|
||||||
|
}
|
||||||
|
return this.hnSwitches.toggleOneZ(switchName, hostname, newState);
|
||||||
|
};
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
// 0 = inherit from broader scope, up to default state
|
// 0 = inherit from broader scope, up to default state
|
||||||
// 1 = non-default state
|
// 1 = non-default state
|
||||||
// 2 = forced default state (to override a broader non-default state)
|
// 2 = forced default state (to override a broader non-default state)
|
||||||
|
@ -319,15 +319,7 @@ var matchWhitelistDirective = function(url, hostname, directive) {
|
|||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
µBlock.toggleHostnameSwitch = function(details) {
|
µBlock.toggleHostnameSwitch = function(details) {
|
||||||
var changed = false;
|
if ( this.hnSwitches.toggleZ(details.name, details.hostname, !!details.deep, details.state) ) {
|
||||||
|
|
||||||
if ( details.deep === true ) {
|
|
||||||
changed = this.hnSwitches.toggleBranchZ(details.name, details.hostname, details.state);
|
|
||||||
} else {
|
|
||||||
changed = this.hnSwitches.toggleOneZ(details.name, details.hostname, details.state);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( changed ) {
|
|
||||||
this.saveHostnameSwitches();
|
this.saveHostnameSwitches();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user