6 this._el = document.createElement('div')
8 this._sidebar = document.createElement('div')
9 this._sidebar.id = 'sidebar'
10 this._categories = document.createElement('ul')
11 this._categories.id = 'categories'
12 this._names = document.createElement('div')
13 this._names.id = 'names'
18 this.install = (host) => {
19 console.log('Wiki', 'Installing..')
21 this._el.appendChild(this._names)
22 this._sidebar.appendChild(this._categories)
23 this._el.appendChild(this._sidebar)
24 host.appendChild(this._el)
28 console.log('Wiki', 'Starting..')
29 // this.el.innerHTML = 'hello.'
32 this.refresh = () => {
33 console.log(Object.keys(this.index).length + ' terms')
38 for (const id in this.categories) {
39 html += `<li>${id} <span class='right'>${this.categories[id].length}</span></li>`
41 this._categories.innerHTML = `${html}`
45 console.log('Wiki', 'Fetching..')
46 for (const site of sites) {
47 if (!site.wiki || !site.author) { continue }
48 fetch(site.wiki, { cache: 'no-store' }).then(x => x.text()).then((content) => {
49 this.parse(site, content)
52 console.warn(`${site.wiki}`, err)
57 this.add = (name, value, cat, origin) => {
58 if (!this.index[name]) {
61 this.index[name].push({ value, cat, origin })
62 if (!this.categories[cat]) {
63 this.categories[cat] = []
65 this.categories[cat].push({ value, cat, origin })
68 this.parse = (site, content) => {
69 console.log('Wiki', 'Parsing ' + site.wiki)
70 const cats = indental(this.filter(content))
71 for (const cat in cats) {
72 const terms = cats[cat]
73 for (const name in terms) {
74 this.add(name, terms[name], cat, site)
79 this.filter = (lines) => {
80 return lines.split('\n').filter((line) => { return line.indexOf(' = `') < 0 && line.trim().length > 1 }).join('\n')
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list