[tbb-commits] [tor-browser] 07/33: fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser

gitolite role git at cupani.torproject.org
Tue May 3 22:40:15 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1
in repository tor-browser.

commit c61bd180a8ade14fd4f0136e732179a9326b9ef9
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Thu Apr 7 15:22:38 2022 +0200

    fixup! squash! Bug 27476: Implement about:torconnect captive portal within Tor Browser
    
    Bug 40876: add optgroups to country selector
---
 .../torconnect/content/aboutTorConnect.js          | 30 +++++++++-------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/browser/components/torconnect/content/aboutTorConnect.js b/browser/components/torconnect/content/aboutTorConnect.js
index 3945da741f9ea..3d66913ab1c97 100644
--- a/browser/components/torconnect/content/aboutTorConnect.js
+++ b/browser/components/torconnect/content/aboutTorConnect.js
@@ -187,7 +187,6 @@ class AboutTorConnect {
     locationNodes.sort((left, right) =>
       left.textContent.localeCompare(right.textContent)
     );
-
     this.elements.locationDropdownSelect.append(
       selectCountryRegion,
       ...locationNodes
@@ -204,14 +203,13 @@ class AboutTorConnect {
     for (const code of specialLocations) {
       const option = document.createElement("option");
       option.value = code;
-
+      option.className = "frequent-location";
       // codes (partially) come from rdsys service, so make sure we have a
       // string defined for it
       let name = this.locations[code];
       if (!name) {
         name = code;
       }
-
       option.textContent = name;
       locationNodes.push(option);
     }
@@ -220,28 +218,24 @@ class AboutTorConnect {
       left.textContent.localeCompare(right.textContent)
     );
 
-    const disabledDividerNode = document.createElement("option");
-    disabledDividerNode.setAttribute("disabled", true);
-    disabledDividerNode.className = "divider";
+    const specialGroup = document.createElement("optgroup");
+    specialGroup.setAttribute("label", TorStrings.torConnect.frequentLocations);
+    specialGroup.className = "frequent-location";
+    const locationGroup = document.createElement("optgroup");
+    locationGroup.setAttribute("label", TorStrings.torConnect.otherLocations);
+    locationGroup.className = "frequent-location";
+    // options[0] is "Select Country or Region"
     this.elements.locationDropdownSelect.options[0].after(
+      specialGroup,
       ...locationNodes,
-      disabledDividerNode
+      locationGroup
     );
   }
 
   removeSpecialLocations() {
     const select = this.elements.locationDropdownSelect;
-    if (select.querySelector(".divider") === null) {
-      return;
-    }
-
-    while (select.options.length > 1) {
-      // Skip the "select country/region" option
-      const opt = select.options[1];
-      opt.remove();
-      if (opt.className === "divider") {
-        break;
-      }
+    for (const option of select.querySelectorAll(".frequent-location")) {
+      option.remove();
     }
   }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list