on master help sign in
Added filtering
3d3eec8Devine Lu Linvega
scripts/wiki.js+2
@@ -57,6 +57,7 @@ function Wiki (sites) {
57
57
58 this.go = (q) => {
58 this.go = (q) => {
59 this.loc = q
59 this.loc = q
60+ window.location.hash = q.toUrl()
60 this.refresh()
61 this.refresh()
61 }
62 }
62
63
@@ -106,4 +107,5 @@ function Wiki (sites) {
106 this.filter = (lines) => {
107 this.filter = (lines) => {
107 return lines.split('\n').filter((line) => { return line.indexOf(' = `') < 0 && line.trim().length > 1 }).join('\n')
108 return lines.split('\n').filter((line) => { return line.indexOf(' = `') < 0 && line.trim().length > 1 }).join('\n')
108 }
109 }
110+ String.prototype.toUrl = function () { return this.toLowerCase().replace(/ /g, '+').replace(/[^0-9a-z\+\:\-\.\/\~]/gi, '').trim() }
109}
111}