1
0
Fork 0
mirror of https://github.com/gorhill/uMatrix.git synced 2024-09-29 08:41:11 +13:00
This commit is contained in:
gorhill 2016-08-11 09:18:15 -04:00
parent 83b342d4e4
commit e21f87a5f6
2 changed files with 8 additions and 5 deletions

View file

@ -1061,15 +1061,18 @@ function updateScopeCell() {
/******************************************************************************/ /******************************************************************************/
function updateMatrixSwitches() { function updateMatrixSwitches() {
var switches = matrixSnapshot.tSwitches; var count = 0,
enabled,
switches = matrixSnapshot.tSwitches;
for ( var switchName in switches ) { for ( var switchName in switches ) {
if ( switches.hasOwnProperty(switchName) === false ) { if ( switches.hasOwnProperty(switchName) === false ) {
continue; continue;
} }
uDom('#mtxSwitch_' + switchName).toggleClass('switchTrue', switches[switchName]); if ( (enabled = switches[switchName]) ) { count += 1; }
uDom('#mtxSwitch_' + switchName).toggleClass('switchTrue', enabled);
} }
var count = matrixSnapshot.blockedCount; uDom('#buttonMtxSwitches').descendants('span.badge').text(count.toLocaleString());
count = matrixSnapshot.blockedCount;
var button = uDom('#mtxSwitch_matrix-off'); var button = uDom('#mtxSwitch_matrix-off');
button.descendants('span.badge').text(count.toLocaleString()); button.descendants('span.badge').text(count.toLocaleString());
button.attr('data-tip', button.attr('data-tip').replace('{{count}}', count)); button.attr('data-tip', button.attr('data-tip').replace('{{count}}', count));

View file

@ -31,7 +31,7 @@
<div class="dropdown-menu-capture"></div> <div class="dropdown-menu-capture"></div>
<button id="mtxSwitch_matrix-off" type="button" class="fa scopeRel tip-anchor-left" data-i18n-tip="matrixMtxButtonTip">&#xf011;<span class="badge"></span></button> <button id="mtxSwitch_matrix-off" type="button" class="fa scopeRel tip-anchor-left" data-i18n-tip="matrixMtxButtonTip">&#xf011;<span class="badge"></span></button>
<div style="display: inline-block; position: relative"> <div style="display: inline-block; position: relative">
<button id="buttonMtxSwitches" type="button" class="dropdown-menu-button fa scopeRel" tabindex="-1">&#xf142;</button> <button id="buttonMtxSwitches" type="button" class="dropdown-menu-button fa scopeRel" tabindex="-1">&#xf142;<span class="badge"></span></button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<ul id="mtxSwitches"> <ul id="mtxSwitches">
<li id="mtxSwitch_ua-spoof" class="dropdown-menu-entry" data-i18n="matrixSwitchUASpoof"> <li id="mtxSwitch_ua-spoof" class="dropdown-menu-entry" data-i18n="matrixSwitchUASpoof">