@@ -9,8 +9,8 @@ function Wiki (sites) {
9 this._sidebar.id = 'sidebar'
9 this._sidebar.id = 'sidebar'
10 this._categories = document.createElement('ul')
10 this._categories = document.createElement('ul')
11 this._categories.id = 'categories'
11 this._categories.id = 'categories'
12− this._names = document.createElement('div')
12+ this._entry = document.createElement('div')
13− this._names.id = 'names'
13+ this._entry.id = 'entry'
15 this.loc = ''
15 this.loc = ''
16 this.index = {}
16 this.index = {}
@@ -19,7 +19,7 @@ function Wiki (sites) {
19 this.install = (host) => {
19 this.install = (host) => {
20 console.log('Wiki', 'Installing..')
20 console.log('Wiki', 'Installing..')
21 this.fetch()
21 this.fetch()
22− this._el.appendChild(this._names)
22+ this._el.appendChild(this._entry)
23 this._sidebar.appendChild(this._categories)
23 this._sidebar.appendChild(this._categories)
24 this._el.appendChild(this._sidebar)
24 this._el.appendChild(this._sidebar)
25 host.appendChild(this._el)
25 host.appendChild(this._el)
@@ -32,12 +32,23 @@ function Wiki (sites) {
33 this.refresh = () => {
33 this.refresh = () => {
34 console.log(Object.keys(this.index).length + ' terms')
34 console.log(Object.keys(this.index).length + ' terms')
35− // Sidebar
35+ // Main
37+ if (this.categories[this.index]) {
36− let html = ''
38+ let html = `term: ${this.loc}`
39+ this._entry.innerHTML = html
37− for (const id in this.categories) {
40+ } else if (this.categories[this.loc]) {
38− html += `<li onclick='wiki.go("${id}")' class='${wiki.at(id) ? 'selected' : ''}'>${id} <span class='right'>${this.categories[id].length}</span></li>`
41+ let html = `category: ${this.loc}`
42+ this._entry.innerHTML = html
44+ let html = `Unknown: ${this.loc}`
45+ this._entry.innerHTML = html
48+ this._entry.innerHTML = 'Click a /topic to get started.'
40− this._categories.innerHTML = `${html}`
50+ // Sidebar
51+ this._categories.innerHTML = Object.keys(this.categories).reduce((acc, id) => { return `${acc}<li onclick='wiki.go("${id}")' class='${wiki.at(id) ? 'selected' : ''}'>${id} <span class='right'>${this.categories[id].length}</span></li>` }, '')
43 this.go = (q) => {
54 this.go = (q) => {
@@ -46,7 +57,7 @@ function Wiki (sites) {
48 this.at = (q = '') => {
59 this.at = (q = '') => {
49− return this.loc.toLowerCase() === q.toLowerCase()
60+ return this.loc.toUpperCase() === q.toUpperCase()
52 this.fetch = () => {
63 this.fetch = () => {