You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2021/09/19 22:01:00 UTC

[incubator-ponymail-foal] 01/04: refactor letter checks, add "misc" category

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git

commit f3df17f9781abb0ce1b6882a9ff64ead93e6c97f
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Sep 19 16:58:39 2021 -0500

    refactor letter checks, add "misc" category
---
 webui/js/source/list-index.js | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/webui/js/source/list-index.js b/webui/js/source/list-index.js
index ad782dd..bf55617 100644
--- a/webui/js/source/list-index.js
+++ b/webui/js/source/list-index.js
@@ -34,7 +34,7 @@ function list_index(state, json) {
             }
         }
     } else {
-        let letters = 'abcdefghijklmnopqrstuvwxyz';
+        let letters = 'abcdefghijklmnopqrstuvwxyz#';
         for (var i = 0; i < letters.length; i++) {
             let letter = letters[i].toUpperCase();
             let li = new HTML('li', {
@@ -48,7 +48,7 @@ function list_index(state, json) {
     let list_ul = document.getElementById('list_index_wide_lists');
     list_ul.textContent = "";
     for (let domain_name in list_json.lists) {
-        if (domain_name.toLowerCase().startsWith(letter.toLowerCase())) {
+        if (is_letter(domain_name, letter)) {
             console.log(domain_name);
             let li = new HTML('li', {});
             let a = new HTML('a', {
@@ -64,6 +64,11 @@ function list_index(state, json) {
 let preferred_lists = ['dev', 'users'];
 let preferred_no_lists = ['security'];
 
+function is_letter(domain, letter) {
+    if (letter == '#' && domain.match(/^([^a-zA-Z]+)/)) return true
+    else return domain.toLowerCase().startsWith(letter.toLowerCase());
+}
+
 function best_list(entries) {
     let x = 0;
     let pick = 'dev';