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'
19 this.install = (host) => {
20 console.log('Wiki', 'Installing..')
22 this._el.appendChild(this._names)
23 this._sidebar.appendChild(this._categories)
24 this._el.appendChild(this._sidebar)
25 host.appendChild(this._el)
29 console.log('Wiki', 'Starting..')
30 // this.el.innerHTML = 'hello.'
33 this.refresh = () => {
34 console.log(Object.keys(this.index).length + ' terms')
37 for (const id in this.categories) {
38 html += `<li onclick='wiki.go("${id}")' class='${wiki.at(id) ? 'selected' : ''}'>${id} <span class='right'>${this.categories[id].length}</span></li>`
40 this._categories.innerHTML = `${html}`
48 this.at = (q = '') => {
49 return this.loc.toLowerCase() === q.toLowerCase()
53 console.log('Wiki', 'Fetching..')
54 for (const site of sites) {
55 if (!site.wiki || !site.author) { continue }
56 fetch(site.wiki, { cache: 'no-store' }).then(x => x.text()).then((content) => {
57 this.parse(site, content)
60 console.warn(`${site.wiki}`, err)
65 this.add = (name, value, cat, origin) => {
66 if (!this.index[name]) {
69 this.index[name].push({ value, cat, origin })
70 if (!this.categories[cat]) {
71 this.categories[cat] = []
73 this.categories[cat].push({ value, cat, origin })
76 this.parse = (site, content) => {
77 console.log('Wiki', 'Parsing ' + site.wiki)
78 const cats = indental(this.filter(content))
79 for (const cat in cats) {
80 const terms = cats[cat]
81 for (const name in terms) {
82 this.add(name, terms[name], cat, site)
87 this.filter = (lines) => {
88 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