on master help sign in
add in forgotten random
a651d20ckipp01
links/main.css+1
@@ -58,6 +58,7 @@ body #wiki { background: #ccc; color:#333; }
58body #wiki main { display: flex; }
58body #wiki main { display: flex; }
59body #wiki main { flex: 1; }
59body #wiki main { flex: 1; }
60body #wiki main { max-width: calc(100% - 230px); }
60body #wiki main { max-width: calc(100% - 230px); }
61+body #wiki main a { text-decoration: underline; }
61body #wiki main h1 { font-size: 1.3em; margin: 5px 0; font-weight: bold; }
62body #wiki main h1 { font-size: 1.3em; margin: 5px 0; font-weight: bold; }
62body #wiki main div.related { border-bottom: 1px solid white; margin-bottom: 10px; }
63body #wiki main div.related { border-bottom: 1px solid white; margin-bottom: 10px; }
63body #wiki #main { width: 100%; }
64body #wiki #main { width: 100%; }
scripts/wiki.js+6−1
@@ -40,6 +40,11 @@ const Wiki = sites => {
40 ? 'selected'
40 ? 'selected'
41 : ''
41 : ''
42
42
43+ const randomTerm = () => {
44+ const keys = Object.keys(entries)
45+ return keys[Math.floor(Math.random() * keys.length)]
46+ }
47+
43 const formatSideBarCat = (key, entries) => (currentHtml, cat) => {
48 const formatSideBarCat = (key, entries) => (currentHtml, cat) => {
44 const catLength = Object.keys(entries[cat]).length
49 const catLength = Object.keys(entries[cat]).length
45 const newHtml = `<li class='${selected(key, cat)}'}'>
50 const newHtml = `<li class='${selected(key, cat)}'}'>
@@ -98,7 +103,7 @@ const Wiki = sites => {
98 : ''
103 : ''
99 main.innerHTML = `<div class='related'><h1>${key}</h1>${relatedHtml}</div>${items}`
104 main.innerHTML = `<div class='related'><h1>${key}</h1>${relatedHtml}</div>${items}`
100 } else {
105 } else {
101− const html = `Click a /topic to get started, or try a random page`
106+ const html = `Click a /topic to get started, or try a <a href='#${randomTerm()}'>random page</a>`
102 const stats = `The wiki contains ${terms.size} terms in ${Object.keys(entries).length} categories, from ${authors.size} authors.`
107 const stats = `The wiki contains ${terms.size} terms in ${Object.keys(entries).length} categories, from ${authors.size} authors.`
103 main.innerHTML = `${html}<br />${stats}`
108 main.innerHTML = `${html}<br />${stats}`
104 }
109 }