code review

This commit is contained in:
gorhill 2015-04-07 13:27:46 -04:00
parent c6668391e0
commit aa8b5850b8
2 changed files with 10 additions and 9 deletions

View File

@ -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)

View File

@ -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();
}