mirror of https://github.com/gorhill/uBlock.git
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
|
||||
// 1 = 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) {
|
||||
var changed = false;
|
||||
|
||||
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 ) {
|
||||
if ( this.hnSwitches.toggleZ(details.name, details.hostname, !!details.deep, details.state) ) {
|
||||
this.saveHostnameSwitches();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue