aboutsummaryrefslogtreecommitdiff
path: root/src/views/subs.pug
blob: 038cd154059030c06f8b33a911061dee96450806 (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
include ../mixins/sub

doctype html
html
  head
    meta(charset='UTF-8')
    title reddit
    link(rel='stylesheet', href='/styles.css')

  +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
      h1 subscriptions
      div#subList