@@ -9,6 +9,8 @@ const Wiki = sites => {
9 const authors = new Set()
9 const authors = new Set()
10 const terms = new Set()
10 const terms = new Set()
12+ const encodeUrl = text => text.replace(/ /g, '+').trim().toLowerCase()
12 const cleanEntry = entry => {
14 const cleanEntry = entry => {
13 const temp = document.createElement('div')
15 const temp = document.createElement('div')
14 temp.textContent = entry
16 temp.textContent = entry
@@ -63,7 +65,7 @@ const Wiki = sites => {
63 const formatSideBarCat = (key, entries) => (currentHtml, cat) => {
65 const formatSideBarCat = (key, entries) => (currentHtml, cat) => {
64 const catLength = Object.keys(entries[cat]).length
66 const catLength = Object.keys(entries[cat]).length
65 const newHtml = `<li class='${selected(key, cat)}'}'>
67 const newHtml = `<li class='${selected(key, cat)}'}'>
66− <a href='#${cat}' data-msgs='${catLength}'>${cat.toLowerCase()}</a>
68+ <a href='#${encodeUrl(cat)}' data-msgs='${catLength}'>${cat.toLowerCase()}</a>
68 return `${currentHtml}${newHtml}`
70 return `${currentHtml}${newHtml}`
@@ -118,6 +120,7 @@ const Wiki = sites => {
120 const refresh = key => {
122 const refresh = key => {
121 if (key) {
124 if (key) {
122 if (entries[key] === undefined) return
125 if (entries[key] === undefined) return
123 const items = Object.keys(entries[key]).sort().reduce(formatEntries(entries[key]), '')
126 const items = Object.keys(entries[key]).sort().reduce(formatEntries(entries[key]), '')
@@ -162,11 +165,13 @@ const Wiki = sites => {
168+const decodeUrl = text => text.replace(/\+/g, ' ').trim().toUpperCase()
165const stripHash = hash => {
170const stripHash = hash => {
166 const decoded = decodeURIComponent(hash)
171 const decoded = decodeURIComponent(hash)
167− return decoded.charAt(0) === '#' ? decoded.substring(1) : decoded
172+ return decoded.charAt(0) === '#' ? decodeUrl(decoded.substring(1)) : decoded
170window.addEventListener('hashchange', () => {
175window.addEventListener('hashchange', () => {
171− wiki.refresh(stripHash(window.location.hash).toUpperCase())
176+ wiki.refresh(stripHash(window.location.hash))