on master help sign in
Improved 404 catch
commit6c3d7832bdb036663c7d97d2aa2662bdae08b4ab authorDevine Lu Linvega <aliceffekt@gmail.com> dateMon 29 Jul 2019, 09:56 (7 years ago) parent32c8070
4 files changed+20−13
links/main.css+3−3 scripts/hallway.js+2−2 scripts/portal.js+2−2 scripts/wiki.js+13−6
links/main.css+3−3
@@ -1,7 +1,7 @@
11* { margin:0;padding:0;border:0;outline:0;text-decoration:none;font-weight:inherit;font-style:inherit;color:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;list-style:none;border-collapse:collapse;border-spacing:0; -webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
22
33body { background:#f4f4f4; padding:0px; margin:0px; }
4−body > div { display:block; background: #111;min-height: calc(100vh - 60px);width: calc(100vw - 60px);margin: 15px;color: #333;padding: 15px;font-family:'input_mono_regular', 'Monospaced','Courier New',courier;font-size:11px; position: relative; border-radius: 2px; color:white;}
4+body > div { display:block; background: #111;min-height: calc(100vh - 60px);width: calc(100vw - 60px);margin: 15px;color: #333;padding: 15px;font-family:'input_mono_regular', 'Monospaced','Courier New',courier;font-size:11px; position: relative; border-radius: 2px; color:white; overflow: hidden;}
55body div ul { max-width: 800px; border-bottom: 2px solid white;padding-bottom: 15px;margin-bottom:15px; overflow: hidden;}
66body div p { display:block; padding:0px 5px; line-height: 20px; max-width: 600px}
77body div p a { text-decoration: underline;}
@@ -18,6 +18,7 @@ body #sidebar > * li span.right { color:#555; float:right; }
1818body #sidebar > * li span.right:after { content: " msgs"; }
1919body #sidebar #channels li:before, body #sidebar #categories li:before { content:'/'; }
2020body #sidebar #users li:before { content:'@'; }
21+body #footer { padding-left: 60px;background-image: url(../icon.white.svg);background-size: 40px;background-repeat: no-repeat;background-position: 0px 15px;border-top: 2px solid white;padding-top: 15px; margin-top:15px;}
2122
2223@media only screen and (min-width:200px) and (max-width: 800px) {
2324 body #hallway #sidebar { position: absolute;top: 0px;right: 0px;padding: 15px;width: 200px;display: none;background-color: #000; }
@@ -44,7 +45,6 @@ body #hallway .entry.highlight .author { color:#555; }
4445body #hallway .entry:hover .author { color:#ccc; }
4546body #hallway .entry:hover .date { color:#ccc; }
4647body #hallway .entry:hover .body { color:#ccc; border-bottom-color: #555 }
47−body #hallway p { padding-left: 60px;background-image: url(../icon.white.svg);background-size: 40px;background-repeat: no-repeat;background-position: 0px 0px; }
4848body #hallway ul { max-width: 100%; }
4949body #hallway ul li:last-child { border-bottom:0px; }
5050
@@ -79,7 +79,7 @@ body #portal ul li a:hover { text-decoration: underline; }
7979
8080/* Wiki */
8181
82−body #wiki #entry { max-width: calc(100% - 230px); }
82+body #wiki #entry { max-width: calc(100% - 230px); margin-bottom: 30px }
8383body #wiki ul.term { border-bottom: 0px; margin-bottom: 0px; padding-bottom: 0px}
8484body #wiki ul.term li.name { margin-bottom: 5px }
8585body #wiki ul.term li a.author { color:#555; }
scripts/hallway.js+2−2
@@ -20,7 +20,7 @@ function Hallway (sites) {
2020 }
2121
2222 this.start = function () {
23− this.el.innerHTML = 'hello.'
23+ this.el.innerHTML = 'Loading..'
2424 this.fetchFeeds()
2525 }
2626
@@ -54,7 +54,7 @@ function Hallway (sites) {
5454 ${Object.keys(tags).slice(0, 15).reduce((acc, val) => acc + `<li onclick='filter("${val}")' class='${hallway.finder.filter === val ? 'selected' : ''}' href='#${val}'>#${val} <span class='right'>${tags[val]}</span></li>\n`, '')}
5555 </ul>
5656 </div>
57− <p>The <b>Hallway</b> is a decentralized forum, to join the conversation, simply create yourself a <a href="https://twtxt.readthedocs.io/en/stable/user/twtxtfile.html">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>`
57+ <p id='footer'>The <b>Hallway</b> is a decentralized forum, to join the conversation, simply create yourself a <a href="https://twtxt.readthedocs.io/en/stable/user/twtxtfile.html">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>`
5858
5959 if (feeds) {
6060 this.cache = feeds
scripts/portal.js+2−2
@@ -12,7 +12,7 @@ function Portal (sites) {
1212 }
1313
1414 function _buttons () {
15− return `<p class='buttons'><a href='#random' onClick="portal.reload('random')">Random</a> | <a href='https://github.com/XXIIVV/webring'>Information</a> <a id='icon' href='#random' onClick="portal.reload('random')"></a> | <a href="hallway.html">The Hallway</a> | <a id="opml">OPML</a></p>`
15+ return `<p class='buttons'><a href='#random' onClick="portal.reload('random')">Random</a> | <a href='https://github.com/XXIIVV/webring'>Information</a> <a id='icon' href='#random' onClick="portal.reload('random')"></a> | <a href="hallway.html">The Hallway</a> | <a href="wiki.html">The Wiki</a> | <a id="opml">OPML</a></p>`
1616 }
1717
1818 function _directory (sites) {
@@ -25,7 +25,7 @@ function Portal (sites) {
2525 }
2626
2727 function _redirect (site) {
28− return `<p>Redirecting to <a href="${site.url}">${site.url}</a></p><meta http-equiv="refresh" content="3; url=${site.url}">
28+ return `<p id='footer'>Redirecting to <a href="${site.url}">${site.url}</a></p><meta http-equiv="refresh" content="3; url=${site.url}">
2929 <p class='buttons'><a href='#' onClick="portal.reload('')">Directory</a> | <a href='#${site.url}' onClick="portal.reload('random')">Skip</a> | <a href='#random' onClick="portal.reload('random')">Random</a> | <a href='https://github.com/XXIIVV/webring'>Information</a> <a id='icon' href='#random' onClick="portal.reload('random')"></a></p>`
3030 }
3131
scripts/wiki.js+13−6
@@ -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 = () => {