+ <%
+ const subKeys = (userSubs && Object.keys(userSubs)) || [];
+ const subCount = subKeys.length;
+ const groups = {};
+ subKeys.forEach(function(channelID){
+ const c = userSubs[channelID] || {};
+ const nm = (c.channelName || '').trim();
+ const first = (nm[0] || '#').toUpperCase();
+ const key = /^[A-Z]$/.test(first) ? first : '#';
+ if(!groups[key]) groups[key] = [];
+ groups[key].push({ id: channelID, c: c });
+ });
+ const letters = Object.keys(groups).sort();
+ letters.forEach(function(L){
+ groups[L].sort(function(a,b){
+ const an = (a.c.channelName||'').toLowerCase();
+ const bn = (b.c.channelName||'').toLowerCase();
+ return an.localeCompare(bn,'en',{sensitivity:'base'});
+ });
+ });
+ %>
+
+
+
+
-
0 subscriptions
+
+
<%= subCount %> <%= subCount === 1 ? 'subscription' : 'subscriptions' %>
-
-
-
No subscriptions found.
+
+
+
+
+
+
+
+
+
-
- <% if (userSubs && Object.keys(userSubs).length) { %>
- <% Object.keys(userSubs).forEach(function(channelID){ const c = userSubs[channelID]; %>
-
-

-
<%= c.channelName %>
-
-
unsub
-
view
+
+
+
+
+
+ <% letters.forEach(function(L){ %>
+
<%= L %>
+
+ <% groups[L].forEach(function(entry){ const c = entry.c; const channelID = entry.id; %>
+
+

+
<%= c.channelName %>
+
-
- <% }) %>
- <% } %>
+ <% }) %>
+
+ <% }) %>
+
+
+
+
No subscriptions found.
+
+
+
+
+
+
+