on master help sign in
Minor cleanup
ae6fc2dDevine Lu Linvega
index.html+1
@@ -12,6 +12,7 @@
12<body>
12<body>
13 <script>
13 <script>
14 const portal = new Portal(sites);
14 const portal = new Portal(sites);
15+ portal.install(document.body);
15 portal.start();
16 portal.start();
16 </script>
17 </script>
17</body>
18</body>
links/fonts.css+8−15
@@ -1,22 +1,15 @@
1/* Input Mono */
1/* Input Mono */
2
2
3@font-face {
3@font-face {
4− font-family: 'input_mono_regular';
4+ font-family: 'input_mono_regular';
5− src: url('../media/fonts/input_mono_regular.ttf') format('truetype');
5+ src: url('../media/fonts/input_mono_regular.ttf') format('truetype');
6− font-weight: normal;
6+ font-weight: normal;
7− font-style: normal;
7+ font-style: normal;
8}
8}
9
9
10@font-face {
10@font-face {
11− font-family: 'input_mono_medium';
11+ font-family: 'input_mono_medium';
12− src: url('../media/fonts/input_mono_medium.ttf') format('truetype');
12+ src: url('../media/fonts/input_mono_medium.ttf') format('truetype');
13− font-weight: normal;
14− font-style: normal;
15−}
16−
17−@font-face {
18− font-family: 'input_mono_thin';
19− src: url('../media/fonts/input_mono_thin.ttf') format('truetype');
20− font-weight: normal;
13+ font-weight: normal;
21− font-style: normal;
14+ font-style: normal;
22}
15}
media/fonts/input_mono_thin.ttfdeleted

Binary file not shown.

scripts/portal.js+28−35
@@ -4,31 +4,41 @@ function Portal(sites)
4{
4{
5 this.el = document.createElement("div");
5 this.el = document.createElement("div");
6 this.sites = sites;
6 this.sites = sites;
7−
7+
8+ // Templates
9+
8− this.install = function()
10+ function _readme()
9 {
11 {
10− document.body.appendChild(this.el);
12+ return `<p class='readme'>This webring is an attempt to inspire artists & developers to build their own website and share traffic among each other. The ring welcomes personalized websites such as <b>diaries, wikis & portfolios</b>.</p><p>To add yourself to the ring, submit a <a href='https://github.com/XXIIVV/webring/edit/master/index.html' target='_blank'>Pull Request</a>.<br />If you found a broken link, please <a href='https://github.com/XXIIVV/webring/issues/new' target='_blank'>report it</a>.</p>`
11 }
13 }
12−
14+
13− this.start = function()
15+ function _buttons()
14 {
16 {
15− this.install();
17+ 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></p>`
16− this.el.innerHTML = window.location.hash && window.location.hash.length > 4 ? this.redirect() : this.directory();
17 }
18 }
18
19
19− this.readme = function()
20+ function _directory(sites)
20 {
21 {
21− return `<p class='readme'>This webring is an attempt to inspire artists & developers to build their own website and share traffic among each other. The ring welcomes personalized websites such as <b>diaries, wikis & portfolios</b>.</p><p>To add yourself to the ring, submit a <a href='https://github.com/XXIIVV/webring/edit/master/index.html' target='_blank'>Pull Request</a>.<br />If you found a broken link, please <a href='https://github.com/XXIIVV/webring/issues/new' target='_blank'>report it</a>.</p>`
22+ return `
23+ <ul>${sites.reduce((acc,val,id) => { return `${acc}<li>${id}) <a href='${val}'>${val.split("//")[1]}</a></li>`; },"")}</ul>\n${_readme()}${_buttons()}`
22 }
24 }
25+
26+ function _redirect(target)
27+ {
28+ return `<p>Redirecting to <b>${target}</b></p><meta http-equiv="refresh" content="3; url=${target}">
29+ <p class='buttons'><a href='#' onClick="portal.reload('')">Directory</a> | <a href='#${target}' 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+ }
31+
32+ //
23
33
24− this.buttons = function()
34+ this.install = function(host)
25 {
35 {
26− 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></p>`
36+ host.appendChild(this.el);
27 }
37 }
28
38
29− this.directory = function()
39+ this.start = function()
30 {
40 {
31− return `<ul>${this.sites.reduce((acc,val,id) => { return `${acc}<li>${id}) <a href='${val}'>${val.split("//")[1]}</a></li>`},"")}</ul>\n${this.readme()}${this.buttons()}`
41+ this.el.innerHTML = window.location.hash && window.location.hash.length > 4 ? _redirect(this.next()) : _directory(this.sites);
32 }
42 }
33
43
34 this.reload = function()
44 this.reload = function()
@@ -38,44 +48,27 @@ function Portal(sites)
38
48
39 this.navigate = function(target)
49 this.navigate = function(target)
40 {
50 {
41− setTimeout(() => {
42− window.location.href = target
51+ setTimeout(() => { window.location.href = target; },3000)
43− },3000)
44− }
45−
46− this.location = function()
47− {
48− return window.location.hash.replace("#","").trim();
49 }
52 }
50
53
51 this.locate = function()
54 this.locate = function()
52 {
55 {
53− const hash = this.location();
56+ const hash = window.location.hash.replace("#","").trim();
54
57
55 if(hash == "random"){
58 if(hash == "random"){
56 return Math.floor(Math.random()*this.sites.length)
59 return Math.floor(Math.random()*this.sites.length)
57 }
60 }
58
61
59 for(const id in this.sites){
62 for(const id in this.sites){
60− const site = this.sites[id];
61− if(site.indexOf(hash) >-1){
63+ if(this.sites[id].indexOf(hash) >-1){
62 return parseInt(id)
64 return parseInt(id)
63 }
65 }
64 }
66 }
65− return -1
67+ return -1;
66 }
68 }
67
69
68− this.next = function(loc)
70+ this.next = function(loc = this.locate())
69 {
71 {
70 return loc == this.sites.length-1 ? this.sites[0] : this.sites[loc+1];
72 return loc == this.sites.length-1 ? this.sites[0] : this.sites[loc+1];
71 }
73 }
72−
73− this.redirect = function()
74− {
75− const location = this.locate();
76− const target = this.next(location);
77− this.navigate(target)
78− return `<p>Redirecting to <b>${target}</b></p><meta http-equiv="refresh" content="3; url=${target}">
79− <p class='buttons'><a href='#' onClick="portal.reload('')">Directory</a> | <a href='#${target}' 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>`
80− }
81}
74}
scripts/sites.js+64−61
@@ -1,63 +1,66 @@
1+'use strict';
2+
3+// Don't forget the comma! No trailing slashes
1// protocole://url.domain.ext
4// protocole://url.domain.ext
5+
2const sites = [
6const sites = [
3− "https://wiki.xxiivv.com"
7+ "https://wiki.xxiivv.com"
4− , "http://estevancarlos.com"
8+ , "http://estevancarlos.com"
5− , "https://electro.pizza"
9+ , "https://electro.pizza"
6− , "https://monochromatic.co"
10+ , "https://monochromatic.co"
7− , "https://joshavanier.github.io"
11+ , "https://joshavanier.github.io"
8− , "http://kaemura.com"
12+ , "http://kaemura.com"
9− , "https://liamcooke.com"
13+ , "https://liamcooke.com"
10− , "https://electricgecko.de"
14+ , "https://electricgecko.de"
11− , "https://wichniow.ski"
15+ , "https://wichniow.ski"
12− , "https://hraew.autophagy.io"
16+ , "https://hraew.autophagy.io"
13− , "https://evenunto.net"
17+ , "https://evenunto.net"
14− , "https://anxl.faith"
18+ , "https://anxl.faith"
15− , "https://xvw.github.io"
19+ , "https://xvw.github.io"
16− , "https://heracl.es"
20+ , "https://heracl.es"
17− , "https://felipecortez.net"
21+ , "https://felipecortez.net"
18− , "http://luminghao.com"
22+ , "http://luminghao.com"
19− , "https://theiceshelf.com"
23+ , "https://theiceshelf.com"
20− , "https://turelio.github.io"
24+ , "https://turelio.github.io"
21− , "https://spaceshipsin.space"
25+ , "https://spaceshipsin.space"
22− , "http://log.lectronice.com"
26+ , "http://log.lectronice.com"
23− , "https://craze.co.uk"
27+ , "https://craze.co.uk"
24− , "https://shaneckel.com"
28+ , "https://shaneckel.com"
25− , "https://cblgh.org"
29+ , "https://cblgh.org"
26− , "https://ellugar.co"
30+ , "https://ellugar.co"
27− , "http://hur.bet"
31+ , "http://hur.bet"
28− , "http://chigby.org"
32+ , "http://chigby.org"
29− , "https://longest.voyage"
33+ , "https://longest.voyage"
30− , "https://palomakop.tv"
34+ , "https://palomakop.tv"
31− , "https://travisshears.com"
35+ , "https://travisshears.com"
32− , "https://v-os.ca"
36+ , "https://v-os.ca"
33− , "http://secretinternet.club"
37+ , "http://secretinternet.club"
34− , "https://jmandel.xyz"
38+ , "https://jmandel.xyz"
35− , "https://systems.ws"
39+ , "https://systems.ws"
36− , "https://jamesin.space"
40+ , "https://jamesin.space"
37− , "https://nathanwentworth.co"
41+ , "https://nathanwentworth.co"
38− , "https://eswat.ca"
42+ , "https://eswat.ca"
39− , "https://uonai.space"
43+ , "https://uonai.space"
40− , "http://controls.ee"
44+ , "http://controls.ee"
41− , "https://wasin.io"
45+ , "https://wasin.io"
42− , "https://inns.studio"
46+ , "https://inns.studio"
43− , "http://kokorobot.ca"
47+ , "http://kokorobot.ca"
44− , "https://ameyama.com"
48+ , "https://ameyama.com"
45− , "https://wake.st"
49+ , "https://wake.st"
46− , "https://xarene.la"
50+ , "https://xarene.la"
47− , "https://alex.zyzhang.me"
51+ , "https://alex.zyzhang.me"
48− , "http://bildwissenschaft.vortok.info"
52+ , "http://bildwissenschaft.vortok.info"
49− , "https://jakofranko.github.com"
53+ , "https://jakofranko.github.com"
50− , "https://aeriform.io"
54+ , "https://aeriform.io"
51− , "http://blog.lucasdidthis.com"
55+ , "http://blog.lucasdidthis.com"
52− , "http://npisanti.com"
56+ , "http://npisanti.com"
53− , "https://underscorediscovery.ca"
57+ , "https://underscorediscovery.ca"
54− , "https://drisc.io"
58+ , "https://drisc.io"
55− , "https://neufv.website"
59+ , "https://neufv.website"
56− , "https://simbolo.xyz"
60+ , "https://simbolo.xyz"
57− , "https://ricky.codes"
61+ , "https://ricky.codes"
58− , "https://maxdeviant.com"
62+ , "https://maxdeviant.com"
59− , "https://tynandebold.com"
63+ , "https://tynandebold.com"
60− , "http://gytis.co"
64+ , "http://gytis.co"
61− , "https://nomand.co"
65+ , "https://nomand.co"
62− ];
66+];
63− // Don't forget the comma! No trailing slashes