avoid dom changes if possible

This commit is contained in:
gorhill 2015-01-01 07:29:28 -05:00
parent c252bc8ff4
commit 619b89e6a6
1 changed files with 10 additions and 3 deletions

View File

@ -173,8 +173,13 @@ var syncDynamicFilterCell = function(scope, des, type, result) {
return; return;
} }
var hnDetails = stats.hostnameDict[des]; var hnDetails = stats.hostnameDict[des];
var aCount = Math.min(Math.ceil(Math.log10(hnDetails.allowCount + 1)), 3); var aCount = hnDetails.allowCount;
var bCount = Math.min(Math.ceil(Math.log10(hnDetails.blockCount + 1)), 3); var bCount = hnDetails.blockCount;
if ( aCount === 0 && bCount === 0 ) {
return;
}
aCount = Math.min(Math.ceil(Math.log10(aCount + 1)), 3);
bCount = Math.min(Math.ceil(Math.log10(bCount + 1)), 3);
// IMPORTANT: It is completely assumed the first node is a TEXT_NODE, so // IMPORTANT: It is completely assumed the first node is a TEXT_NODE, so
// ensure this in the HTML file counterpart when you make // ensure this in the HTML file counterpart when you make
// changes // changes
@ -279,7 +284,9 @@ var renderPopup = function(details) {
); );
} }
//if ( stats.dynamicFilteringEnabled ) {
syncAllDynamicFilters(); syncAllDynamicFilters();
//}
uDom('#total-blocked').html(html.join('')); uDom('#total-blocked').html(html.join(''));
uDom('#switch .fa').toggleClass('off', stats.pageURL === '' || !stats.netFilteringSwitch); uDom('#switch .fa').toggleClass('off', stats.pageURL === '' || !stats.netFilteringSwitch);