mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-23 19:03:02 +01:00
fixed request count indicators for incrementally built popup
This commit is contained in:
parent
1103beb21f
commit
92e26cb3d7
@ -196,27 +196,32 @@ var updateDynamicFilterCell = function(scope, des, type, rule) {
|
||||
}
|
||||
cell.toggleClass('ownRule', ownRule);
|
||||
|
||||
if ( scope !== '.' || des === '*' ) {
|
||||
return;
|
||||
}
|
||||
if ( popupData.hostnameDict.hasOwnProperty(des) === false ) {
|
||||
// IMPORTANT: It is completely assumed the first node is a TEXT_NODE, so
|
||||
// ensure this in the HTML file counterpart when you make
|
||||
// changes
|
||||
var textNode = cell.nodeAt(0).firstChild;
|
||||
|
||||
// Since this may be a cell from a reused row, we need to clear text
|
||||
// content if we can't compute request counts.
|
||||
if ( scope !== '.' || des === '*' || popupData.hostnameDict.hasOwnProperty(des) === false ) {
|
||||
textNode.nodeValue = ' ';
|
||||
return;
|
||||
}
|
||||
|
||||
var hnDetails = popupData.hostnameDict[des];
|
||||
var aCount = hnDetails.allowCount;
|
||||
var bCount = hnDetails.blockCount;
|
||||
if ( aCount === 0 && bCount === 0 ) {
|
||||
textNode.nodeValue = ' ';
|
||||
return;
|
||||
}
|
||||
|
||||
// https://github.com/gorhill/uBlock/issues/471
|
||||
aCount = Math.min(Math.ceil(Math.log(aCount + 1) / Math.LN10), 3);
|
||||
bCount = Math.min(Math.ceil(Math.log(bCount + 1) / Math.LN10), 3);
|
||||
// IMPORTANT: It is completely assumed the first node is a TEXT_NODE, so
|
||||
// ensure this in the HTML file counterpart when you make
|
||||
// changes
|
||||
cell.nodeAt(0).firstChild.nodeValue = threePlus.slice(0, aCount) +
|
||||
sixSpace.slice(aCount + bCount) +
|
||||
threeMinus.slice(0, bCount);
|
||||
textNode.nodeValue = threePlus.slice(0, aCount) +
|
||||
sixSpace.slice(aCount + bCount) +
|
||||
threeMinus.slice(0, bCount);
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
|
@ -28,9 +28,9 @@
|
||||
<div id="refresh" class="fa"></div>
|
||||
</div><!-- DO NOT REMOVE --><div>
|
||||
<div id="dynamicFilteringContainer">
|
||||
<div><span data-i18n="popupAnyRulePrompt"></span><span data-src="/" data-des="*" data-type="*"> </span><span data-src="." data-des="*" data-type="*"></span></div>
|
||||
<div><span data-i18n="popupImageRulePrompt"></span><span data-src="/" data-des="*" data-type="image"> </span><span data-src="." data-des="*" data-type="image"></span></div>
|
||||
<div><span data-i18n="popup3pAnyRulePrompt"></span><span data-src="/" data-des="*" data-type="3p"> </span><span data-src="." data-des="*" data-type="3p"></span></div>
|
||||
<div><span data-i18n="popupAnyRulePrompt"></span><span data-src="/" data-des="*" data-type="*"> </span><span data-src="." data-des="*" data-type="*"> </span></div>
|
||||
<div><span data-i18n="popupImageRulePrompt"></span><span data-src="/" data-des="*" data-type="image"> </span><span data-src="." data-des="*" data-type="image"> </span></div>
|
||||
<div><span data-i18n="popup3pAnyRulePrompt"></span><span data-src="/" data-des="*" data-type="3p"> </span><span data-src="." data-des="*" data-type="3p"> </span></div>
|
||||
<div><span data-i18n="popupInlineScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="inline-script"> </span><span data-src="." data-des="*" data-type="inline-script"> </span></div>
|
||||
<div><span data-i18n="popup1pScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="1p-script"> </span><span data-src="." data-des="*" data-type="1p-script"> </span></div>
|
||||
<div><span data-i18n="popup3pScriptRulePrompt"></span><span data-src="/" data-des="*" data-type="3p-script"> </span><span data-src="." data-des="*" data-type="3p-script"> </span></div>
|
||||
|
Loading…
Reference in New Issue
Block a user