on master help sign in
Improved 404 catch
6c3d783Devine Lu Linvega
links/main.css+3−3
@@ -1,7 +1,7 @@
1* { 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;}
1* { 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;}
2
2
3body { background:#f4f4f4; padding:0px; margin:0px; }
3body { 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;}
5body div ul { max-width: 800px; border-bottom: 2px solid white;padding-bottom: 15px;margin-bottom:15px; overflow: hidden;}
5body div ul { max-width: 800px; border-bottom: 2px solid white;padding-bottom: 15px;margin-bottom:15px; overflow: hidden;}
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;}
@@ -18,6 +18,7 @@ body #sidebar > * li span.right { color:#555; float:right; }
18body #sidebar > * li span.right:after { content: " msgs"; }
18body #sidebar > * li span.right:after { content: " msgs"; }
19body #sidebar #channels li:before, body #sidebar #categories li:before { content:'/'; }
19body #sidebar #channels li:before, body #sidebar #categories li:before { content:'/'; }
20body #sidebar #users li:before { content:'@'; }
20body #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;}
21
22
22@media only screen and (min-width:200px) and (max-width: 800px) {
23@media only screen and (min-width:200px) and (max-width: 800px) {
23 body #hallway #sidebar { position: absolute;top: 0px;right: 0px;padding: 15px;width: 200px;display: none;background-color: #000; }
24 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; }
44body #hallway .entry:hover .author { color:#ccc; }
45body #hallway .entry:hover .author { color:#ccc; }
45body #hallway .entry:hover .date { color:#ccc; }
46body #hallway .entry:hover .date { color:#ccc; }
46body #hallway .entry:hover .body { color:#ccc; border-bottom-color: #555 }
47body #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; }
48body #hallway ul { max-width: 100%; }
48body #hallway ul { max-width: 100%; }
49body #hallway ul li:last-child { border-bottom:0px; }
49body #hallway ul li:last-child { border-bottom:0px; }
50
50
@@ -79,7 +79,7 @@ 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); }
82+body #wiki #entry { max-width: calc(100% - 230px); margin-bottom: 30px }
83body #wiki ul.term { border-bottom: 0px; margin-bottom: 0px; padding-bottom: 0px}
83body #wiki ul.term { border-bottom: 0px; margin-bottom: 0px; padding-bottom: 0px}
84body #wiki ul.term li.name { margin-bottom: 5px }
84body #wiki ul.term li.name { margin-bottom: 5px }
85body #wiki ul.term li a.author { color:#555; }
85body #wiki ul.term li a.author { color:#555; }
scripts/hallway.js+2−2
@@ -20,7 +20,7 @@ function Hallway (sites) {
20 }
20 }
21
21
22 this.start = function () {
22 this.start = function () {
23− this.el.innerHTML = 'hello.'
23+ this.el.innerHTML = 'Loading..'
24 this.fetchFeeds()
24 this.fetchFeeds()
25 }
25 }
26
26
@@ -54,7 +54,7 @@ function Hallway (sites) {
54 ${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`, '')}
54 ${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`, '')}
55 </ul>
55 </ul>
56 </div>
56 </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>`
58
58
59 if (feeds) {
59 if (feeds) {
60 this.cache = feeds
60 this.cache = feeds
scripts/portal.js+2−2
@@ -12,7 +12,7 @@ function Portal (sites) {
12 }
12 }
13
13
14 function _buttons () {
14 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>`
16 }
16 }
17
17
18 function _directory (sites) {
18 function _directory (sites) {
@@ -25,7 +25,7 @@ function Portal (sites) {
25 }
25 }
26
26
27 function _redirect (site) {
27 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}">
29 <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>`
29 <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>`
30 }
30 }
31
31
scripts/wiki.js+13−6
@@ -28,7 +28,7 @@ function Wiki (sites) {
28 this.start = () => {
28 this.start = () => {
29 console.log('Wiki', 'Starting..')
29 console.log('Wiki', 'Starting..')
30 this.loc = window.location.hash.substr(1).replace(/\+/g, ' ').toUpperCase()
30 this.loc = window.location.hash.substr(1).replace(/\+/g, ' ').toUpperCase()
31− // this.el.innerHTML = 'hello.'
31+ this._entry.innerHTML = 'Loading..'
32 }
32 }
33
33
34 this.refresh = () => {
34 this.refresh = () => {
@@ -46,17 +46,18 @@ function Wiki (sites) {
46 }
46 }
47 this._entry.innerHTML = html
47 this._entry.innerHTML = html
48 } else {
48 } 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>.`
50 this._entry.innerHTML = html
50 this._entry.innerHTML = html
51 }
51 }
52 } else {
52 } 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>.`
54 }
54 }
55 // Sidebar
55 // 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>`
57 }
58 }
58
59
59− this.go = (q) => {
60+ this.go = (q = this.loc) => {
60 this.loc = q
61 this.loc = q
61 window.location.hash = q.toUrl()
62 window.location.hash = q.toUrl()
62 this.refresh()
63 this.refresh()
@@ -66,8 +67,14 @@ function Wiki (sites) {
66 return this.loc.toUpperCase() === q.toUpperCase()
67 return this.loc.toUpperCase() === q.toUpperCase()
67 }
68 }
68
69
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+
69 this.templateTerm = (name, entry) => {
76 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>'
71 }
78 }
72
79
73 this.fetch = () => {
80 this.fetch = () => {