on master help sign in
Basic working copy
02e3c7bDevine Lu Linvega
links/main.css+9−2
@@ -6,10 +6,10 @@ body div ul { max-width: 800px; border-bottom: 2px solid white;padding-bottom: 1
6body div p { display:block; padding:0px 5px; line-height: 20px; max-width: 600px}
6body div p { display:block; padding:0px 5px; line-height: 20px; max-width: 600px}
7body div p a { text-decoration: underline;}
7body div p a { text-decoration: underline;}
8body div p a:hover { text-decoration: underline; }
8body div p a:hover { text-decoration: underline; }
9−body div p b { font-weight: normal; font-family: 'input_mono_medium' }
9+body b { font-weight: normal; font-family: 'input_mono_medium' }
10body div p.readme { max-width:500px; }
10body div p.readme { max-width:500px; }
11
11
12−body #sidebar { position: absolute;top: 0px;right: 0px;padding: 15px;width: 200px; overflow: hidden; height: calc(100vh - 75px);}
12+body #sidebar { position: absolute;top: 0px;right: 0px;padding: 15px;width: 200px; overflow: hidden;}
13body #sidebar > * { border-bottom: 0px; line-height: 16px; padding-bottom: 0px }
13body #sidebar > * { border-bottom: 0px; line-height: 16px; padding-bottom: 0px }
14body #sidebar > * li { text-transform: lowercase; }
14body #sidebar > * li { text-transform: lowercase; }
15body #sidebar > * li.selected { background: white; color:black; }
15body #sidebar > * li.selected { background: white; color:black; }
@@ -79,4 +79,11 @@ body #portal ul li a:hover { text-decoration: underline; }
79
79
80/* Wiki */
80/* Wiki */
81
81
82+body #wiki #entry { max-width: calc(100% - 230px); }
83+body #wiki ul.term { border-bottom: 0px; margin-bottom: 0px; padding-bottom: 0px}
84+body #wiki ul.term li.name { margin-bottom: 5px }
85+body #wiki ul.term li a.author { color:#555; }
86+
87+
88+
82
89
scripts/wiki.js+12−4
@@ -38,7 +38,11 @@ function Wiki (sites) {
38 let html = `term: ${this.loc}`
38 let html = `term: ${this.loc}`
39 this._entry.innerHTML = html
39 this._entry.innerHTML = html
40 } else if (this.categories[this.loc]) {
40 } else if (this.categories[this.loc]) {
41− let html = `category: ${this.loc}`
41+ let html = ''
42+ for (const id in this.categories[this.loc]) {
43+ const name = this.categories[this.loc][id].name
44+ html += `${this.templateTerm(name, this.index[name])}<br />`
45+ }
42 this._entry.innerHTML = html
46 this._entry.innerHTML = html
43 } else {
47 } else {
44 let html = `Unknown: ${this.loc}`
48 let html = `Unknown: ${this.loc}`
@@ -48,7 +52,7 @@ function Wiki (sites) {
48 this._entry.innerHTML = 'Click a /topic to get started.'
52 this._entry.innerHTML = 'Click a /topic to get started.'
49 }
53 }
50 // Sidebar
54 // 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>` }, '')
55+ 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>` }, '')
52 }
56 }
53
57
54 this.go = (q) => {
58 this.go = (q) => {
@@ -60,6 +64,10 @@ function Wiki (sites) {
60 return this.loc.toUpperCase() === q.toUpperCase()
64 return this.loc.toUpperCase() === q.toUpperCase()
61 }
65 }
62
66
67+ this.templateTerm = (name, entry) => {
68+ 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>'
69+ }
70+
63 this.fetch = () => {
71 this.fetch = () => {
64 console.log('Wiki', 'Fetching..')
72 console.log('Wiki', 'Fetching..')
65 for (const site of sites) {
73 for (const site of sites) {
@@ -77,11 +85,11 @@ function Wiki (sites) {
77 if (!this.index[name]) {
85 if (!this.index[name]) {
78 this.index[name] = []
86 this.index[name] = []
79 }
87 }
80− this.index[name].push({ value, cat, origin })
88+ this.index[name].push({ name, value, cat, origin })
81 if (!this.categories[cat]) {
89 if (!this.categories[cat]) {
82 this.categories[cat] = []
90 this.categories[cat] = []
83 }
91 }
84− this.categories[cat].push({ value, cat, origin })
92+ this.categories[cat].push({ name, value, cat, origin })
85 }
93 }
86
94
87 this.parse = (site, content) => {
95 this.parse = (site, content) => {