Skip to content

Commit 7011d5e

Browse files
committed
Fixed issue where first initPopup iteration would hide summary-menu, even if there are multiple pills.
1 parent 40fb499 commit 7011d5e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

popup.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function updatePreloadersDisplay() {
758758
relevantSummaries.forEach(summary => {
759759
let summaryElement = document.createElement('div');
760760
summaryElement.className = 'mt-2';
761-
summaryElement.textContent = `Generating summary for ${summary.title}. This could take up to a minute for longer policies. Feel free to close the extension whilst you wait.`;
761+
summaryElement.textContent = `Generating summary for ${summary.title}. This could take up to 2 minutes for longer policies. Feel free to close the extension whilst you wait.`;
762762
preloaderContainer.appendChild(summaryElement);
763763
});
764764

@@ -1104,7 +1104,6 @@ function initPopup() {
11041104

11051105
let pillId = termType.toLowerCase().replace(/[^a-z0-9]/g, '-') + '-menu';
11061106
let pillElement = document.getElementById(`${pillId}`);
1107-
console.log(pillElement);
11081107

11091108
if (!pillElement) {
11101109
console.log("creating pill: " + pillId);
@@ -1156,7 +1155,6 @@ function initPopup() {
11561155
pillButton.innerHTML = pillButton.innerHTML.replace(' <span style="vertical-align: middle; font-size: small;">\u00D7</span>', '');
11571156
// Show all policyDivs when a pill is untoggled
11581157
let policyDivs = document.querySelectorAll('div[id$="-menu"]');
1159-
console.log(policyDivs);
11601158
for (let i = 0; i < policyDivs.length; i++) {
11611159
if (policyDivs[i].id !== 'summary-menu') {
11621160
document.getElementById(policyDivs[i].id.replace('-menu', '')).style.display = 'block';
@@ -1169,7 +1167,6 @@ function initPopup() {
11691167
}
11701168
}
11711169
}
1172-
createdPills[pillId] = true;
11731170
});
11741171
}
11751172
// count the number of immediate div elements inside the #summaries-container, excluding any divs with class .aiQuestionFormContainer
@@ -1180,7 +1177,9 @@ function initPopup() {
11801177
// if there is less than 2 div elements inside the #summaries-container, hide the summary menu
11811178
if (divCount < 2) {
11821179
document.querySelector('#summary-menu').style.display = 'none';
1183-
}
1180+
} else {
1181+
document.querySelector('#summary-menu').style.display = 'flex';
1182+
}
11841183
}
11851184
});
11861185
updatePremiumFeaturesVisibility();

0 commit comments

Comments
 (0)