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: '', externalHostsFiles: '',
iconBadgeEnabled: false, iconBadgeEnabled: false,
maxLoggedRequests: 1000, maxLoggedRequests: 1000,
popupCollapseAllDomains: false,
popupCollapseBlacklistedDomains: false,
popupScopeLevel: 'domain', popupScopeLevel: 'domain',
processHyperlinkAuditing: true, processHyperlinkAuditing: true,
processReferer: false, processReferer: false,

2
src/js/messaging.js

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

12
src/js/popup.js

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

Loading…
Cancel
Save