Browse Source

fix #852

pull/2/head
gorhill 7 years ago
parent
commit
28d2f0b66e
No known key found for this signature in database GPG Key ID: 25E1490B761470C2
  1. 2
      src/js/background.js
  2. 2
      src/js/messaging.js
  3. 12
      src/js/popup.js

2
src/js/background.js

@ -117,6 +117,8 @@ return {
externalHostsFiles: '',
iconBadgeEnabled: false,
maxLoggedRequests: 1000,
popupCollapseAllDomains: false,
popupCollapseBlacklistedDomains: false,
popupScopeLevel: 'domain',
processHyperlinkAuditing: true,
processReferer: false,

2
src/js/messaging.js

@ -146,6 +146,8 @@ var matrixSnapshot = function(pageStore, details) {
var r = {
appVersion: vAPI.app.version,
blockedCount: pageStore.requestStats.blocked.all,
collapseAllDomains: µmuser.popupCollapseAllDomains,
collapseBlacklistedDomains: µmuser.popupCollapseBlacklistedDomains,
diff: [],
domain: pageStore.pageDomain,
headerIndices: Array.from(headerIndices),

12
src/js/popup.js

@ -373,7 +373,7 @@ function getCollapseState(domain) {
if ( typeof states === 'object' && states[domain] !== undefined ) {
return states[domain];
}
return getUISetting('popupCollapseDomains') === true;
return matrixSnapshot.collapseAllDomains === true;
}
function toggleCollapseState(elem) {
@ -388,7 +388,7 @@ function toggleMainCollapseState(uelem) {
var matHead = uelem.ancestors('#matHead.collapsible').toggleClass('collapsed');
var collapsed = matHead.hasClass('collapsed');
uDom('#matList .matSection.collapsible').toggleClass('collapsed', collapsed);
setUISetting('popupCollapseDomains', collapsed);
setUserSetting('popupCollapseAllDomains', collapsed);
var specificCollapseStates = getUISetting('popupCollapseSpecificDomains') || {};
var domains = Object.keys(specificCollapseStates);
@ -409,7 +409,7 @@ function toggleSpecificCollapseState(uelem) {
var section = uelem.ancestors('.matSection.collapsible').toggleClass('collapsed'),
domain = expandosFromNode(section).domain,
collapsed = section.hasClass('collapsed'),
mainCollapseState = getUISetting('popupCollapseDomains') === true,
mainCollapseState = matrixSnapshot.collapseAllDomains === true,
specificCollapseStates = getUISetting('popupCollapseSpecificDomains') || {};
if ( collapsed !== mainCollapseState ) {
specificCollapseStates[domain] = collapsed;
@ -605,7 +605,7 @@ var createMatrixRow = function() {
function renderMatrixHeaderRow() {
var matHead = uDom('#matHead.collapsible');
matHead.toggleClass('collapsed', getUISetting('popupCollapseDomains') === true);
matHead.toggleClass('collapsed', matrixSnapshot.collapseAllDomains === true);
var cells = matHead.descendants('.matCell'), cell, expandos;
cell = cells.nodeAt(0);
expandos = expandosFromNode(cell);
@ -1033,7 +1033,7 @@ function makeMatrixGroup4(group) {
var groupDiv = createMatrixGroup().addClass('g4');
createMatrixSection()
.addClass('g4Meta')
.toggleClass('g4Collapsed', !!getUISetting('popupHideBlacklisted'))
.toggleClass('g4Collapsed', !!matrixSnapshot.collapseBlacklistedDomains)
.appendTo(groupDiv);
makeMatrixMetaRow(computeMatrixGroupMetaStats(group), 'g4')
.appendTo(groupDiv);
@ -1518,7 +1518,7 @@ uDom('#matList').on('click', '.g4Meta', function() {
var collapsed = uDom(this)
.toggleClass('g4Collapsed')
.hasClass('g4Collapsed');
setUISetting('popupHideBlacklisted', collapsed);
setUserSetting('popupCollapseBlacklistedDomains', collapsed);
});
/******************************************************************************/

Loading…
Cancel
Save