Haraka-Wildduck Docker Mail Server with NodeJS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.5 KiB

4 years ago
  1. <h2 class="sub-header"><span class="glyphicon glyphicon-inbox" aria-hidden="true"></span> Create folder</h2>
  2. <form method="post" action="/webmail/create">
  3. <input type="hidden" name="_csrf" value="{{csrfToken}}">
  4. {{> mailbox}}
  5. <div class="form-group">
  6. <button type="submit" class="btn btn-success"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> Create</button>
  7. </div>
  8. </form>
  9. <script>
  10. document.addEventListener('DOMContentLoaded', function() {
  11. var stream = new EventSource('/api/events');
  12. stream.onmessage = function(e) {
  13. var data, row, star, redrawTimer;
  14. try {
  15. data = JSON.parse(e.data);
  16. } catch (E) {
  17. return;
  18. }
  19. switch (data.command) {
  20. case 'COUNTERS': {
  21. if (data.mailbox) {
  22. if(FAVICON && data.mailbox === INBOX_ID){
  23. FAVICON.badge(data.unseen);
  24. }
  25. [].slice.call(document.querySelectorAll('.unseen-counter-' + data.mailbox)).forEach(function(row){
  26. if(data.unseen){
  27. row.style.display = 'block';
  28. row.textContent = data.unseen;
  29. }else {
  30. row.style.display = 'none';
  31. row.textContent = 0;
  32. }
  33. });
  34. }
  35. break;
  36. }
  37. }
  38. };
  39. });
  40. </script>