@@ -28,7 +28,7 @@ function Wiki (sites) {
2828 this.start = () => {
2929 console.log('Wiki', 'Starting..')
3030 this.loc = window.location.hash.substr(1).replace(/\+/g, ' ').toUpperCase()
31− // this.el.innerHTML = 'hello.'
31+ this._entry.innerHTML = 'Loading..'
3232 }
3333
3434 this.refresh = () => {
@@ -46,17 +46,18 @@ function Wiki (sites) {
4646 }
4747 this._entry.innerHTML = html
4848 } else {
49− let html = `Unknown: ${this.loc}`
49+ let html = `Unknown: ${this.loc}. Retun <a onclick='wiki.go("")'>home</a>, or try a <a onclick='wiki.go("${this.random()}")'>random page</a>.`
5050 this._entry.innerHTML = html
5151 }
5252 } else {
53− this._entry.innerHTML = 'Click a /topic to get started.'
53+ this._entry.innerHTML = `Click a /topic to get started, or try a <a onclick='wiki.go("${this.random()}")'>random page</a>.`
5454 }
5555 // Sidebar
56− this._categories.innerHTML = Object.keys(this.categories).reduce((acc, id) => { return `${acc}<li onclick='wiki.go("${id}")' class='${wiki.at(id) ? 'selected' : ''}'>${id.substr(0, 20)} <span class='right'>${this.categories[id].length}</span></li>` }, '')
56+ this._categories.innerHTML = Object.keys(this.categories).reduce((acc, id) => { return this.categories[id].length > 5 ? `${acc}<li onclick='wiki.go("${id}")' class='${wiki.at(id) ? 'selected' : ''}'>${id.substr(0, 20)} <span class='right'>${this.categories[id].length}</span></li>` : acc }, '')
57+ this._entry.innerHTML += `<p id='footer'>The <b>Wiki</b> is a decentralized encyclopedia, to join the conversation, simply create yourself an <a href="https://wiki.xxiivv.com/Indental">twtxt</a> feed and <a href="https://github.com/XXIIVV/Webring/">add it</a> to your entry in the <a href="index.html">webring</a>.</p>`
5758 }
5859
59− this.go = (q) => {
60+ this.go = (q = this.loc) => {
6061 this.loc = q
6162 window.location.hash = q.toUrl()
6263 this.refresh()
@@ -66,8 +67,14 @@ function Wiki (sites) {
6667 return this.loc.toUpperCase() === q.toUpperCase()
6768 }
6869
70+ this.random = () => {
71+ const keys = Object.keys(this.categories)
72+ const target = Math.floor(Math.random() * keys.length)
73+ return keys[target]
74+ }
75+
6976 this.templateTerm = (name, entry) => {
70− return '<ul class="term"><li class="name"><b>' + name.toLowerCase() + '</b></li>' + entry.reduce((acc, item) => { return `${acc}<li>${item.value} <a class='author' href='${item.origin.url}'> — @${item.origin.author}</a></li>` }, '') + '</ul>'
77+ return '<ul class="term"><li class="name"><b>' + name.toLowerCase() + '</b></li>' + entry.reduce((acc, item) => { return `${acc}<li>${item.value} <a class='author' target='_blank' href='${item.origin.url}'> — @${item.origin.author}</a></li>` }, '') + '</ul>'
7178 }
7279
7380 this.fetch = () => {