Skip to content

Commit 99ac01c

Browse files
committed
further fix to gorhill#55: less strict conditions to allow collapsing
1 parent 4435924 commit 99ac01c

File tree

3 files changed

+27
-24
lines changed

3 files changed

+27
-24
lines changed

js/popup.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ var HTTPSBPopup = {
218218
groupsSnapshot: [],
219219
domainListSnapshot: 'do not leave this initial string empty',
220220

221-
mouseenterHandlers: {},
222-
223221
matrixHeaderPrettyNames: {
224222
'all': '',
225223
'cookie': '',
@@ -509,7 +507,7 @@ function getCollapseState(domain) {
509507
}
510508

511509
function toggleCollapseState(element) {
512-
var element = $(element);
510+
element = $(element);
513511
if ( element.parents('#matHead.collapsible').length > 0 ) {
514512
toggleMainCollapseState(element);
515513
} else {
@@ -524,7 +522,6 @@ function toggleMainCollapseState(element) {
524522
$('#matList .matSection.collapsible').toggleClass('collapsed', collapsed);
525523
setUserSetting('popupCollapseDomains', collapsed);
526524

527-
var mainCollapseState = getUserSetting('popupCollapseDomains');
528525
var specificCollapseStates = getUserSetting('popupCollapseSpecificDomains') || {};
529526
var domains = Object.keys(specificCollapseStates);
530527
var i = domains.length;
@@ -558,9 +555,10 @@ function toggleSpecificCollapseState(element) {
558555

559556
/******************************************************************************/
560557

561-
// Update visual of matrix cells(s)
558+
// Update color of matrix cells(s)
559+
// Color changes when rules change
562560

563-
function updateMatrixCells() {
561+
function updateMatrixColors() {
564562
var cells = $('.matrix .matRow.rw > .matCell');
565563
var i = cells.length;
566564
var cell;
@@ -573,6 +571,14 @@ function updateMatrixCells() {
573571

574572
/******************************************************************************/
575573

574+
// Update request count of matrix cells(s)
575+
// Count changes when number of distinct requests changes
576+
577+
function updateMatrixCounts() {
578+
}
579+
580+
/******************************************************************************/
581+
576582
// Update behavior of matrix:
577583
// - Whether a section is collapsible or not. It is collapsible if:
578584
// - It has at least one subdomain AND
@@ -582,11 +588,16 @@ function updateMatrixCells() {
582588
function updateMatrixBehavior() {
583589
var sections = $('.matSection', HTTPSBPopup.matrixList);
584590
var i = sections.length;
585-
var section, subdomainRows;
591+
var section, subdomainRows, j, subdomainRow;
586592
while ( i-- ) {
587593
section = $(sections[i]);
588594
subdomainRows = section.children('.l2:not(.g3)');
589-
section.toggleClass('collapsible', subdomainRows.length > 0 && subdomainRows.children('.gdt,.rdt').length === 0);
595+
j = subdomainRows.length;
596+
while ( j-- ) {
597+
subdomainRow = $(subdomainRows[j]);
598+
subdomainRow.toggleClass('collapsible', subdomainRow.children('.gdt,.rdt').length === 0);
599+
}
600+
section.toggleClass('collapsible', subdomainRows.filter('.collapsible').length > 0);
590601
}
591602
}
592603

@@ -609,7 +620,7 @@ function handleFilter(button, leaning) {
609620
httpsb.graylistTemporarily(HTTPSBPopup.scopeURL, type, hostname);
610621
}
611622
updateMatrixStats();
612-
updateMatrixCells();
623+
updateMatrixColors();
613624
updateMatrixBehavior();
614625
handleFilterMessage(button, leaning);
615626
}
@@ -1127,7 +1138,7 @@ function toggleScopePage() {
11271138
getHTTPSB().createPageScopeIfNotExists(HTTPSBPopup.pageURL);
11281139
}
11291140
updateMatrixStats();
1130-
updateMatrixCells();
1141+
updateMatrixColors();
11311142
updateMatrixBehavior();
11321143
}
11331144

@@ -1219,7 +1230,7 @@ function blankMessage() {
12191230
function revert() {
12201231
getHTTPSB().revertPermissions();
12211232
updateMatrixStats();
1222-
updateMatrixCells();
1233+
updateMatrixColors();
12231234
updateMatrixBehavior();
12241235
}
12251236

@@ -1276,17 +1287,6 @@ function bindToTabHandler(tabs) {
12761287

12771288
/******************************************************************************/
12781289

1279-
function mouseenterHandler() {
1280-
var handler = mouseenterHandlers[this.id];
1281-
if ( handler ) {
1282-
handler(this);
1283-
} else {
1284-
blankMessage();
1285-
}
1286-
}
1287-
1288-
/******************************************************************************/
1289-
12901290
// make menu only when popup html is fully loaded
12911291

12921292
function initAll() {

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "__MSG_extName__",
4-
"version": "0.6.0",
4+
"version": "0.6.1",
55
"description": "__MSG_extShortDesc__",
66
"icons": {
77
"128": "icon_128.png"

popup.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@
148148
.matrix .matSection.collapsible.collapsed .matRow.meta {
149149
display: block;
150150
}
151-
.matrix .matSection.collapsible.collapsed .matRow:not(.meta) {
151+
.matrix .matSection.collapsible.collapsed .matRow.l1:not(.meta) {
152+
display: none;
153+
}
154+
.matrix .matSection.collapsible.collapsed .matRow.l2.collapsible {
152155
display: none;
153156
}
154157

0 commit comments

Comments
 (0)