aboutsummaryrefslogtreecommitdiff
path: root/src/views/subs.pug
blob: 86de6048c6181b37e037aa463bd7bd661af611d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
include ../mixins/sub
include ../mixins/header
include ../mixins/head

doctype html
html
  +head("subscriptions")
  +subMgmt()
  script.
    function newSubItem(sub) {
      const p = document.createElement("p");
      const a = document.createElement("a");
      a.href = `/r/${sub}`;
      a.innerText = `r/${sub}`;
      p.appendChild(a);
      return p;
    }

    function buildSubList() {
      var subList = document.getElementById('subList');
      getSubs().forEach((sub)=>{
        subList.appendChild(newSubItem(sub));
      });
    }

    document.addEventListener('DOMContentLoaded', buildSubList);
  body
    main#content
      +header(user)
      div.hero
        h1 subscriptions
        p
          each s in subs 
            a(href=`/r/${s.subreddit}`) 
              | r/#{s.subreddit}
            br