5 this.el = document.createElement("div");
8 this.install = function()
10 document.body.appendChild(this.el);
13 this.start = function()
16 this.el.innerHTML = window.location.hash && window.location.hash.length > 4 ? this.redirect() : this.directory();
19 this.readme = function()
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>`
24 this.buttons = function()
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>`
29 this.directory = function()
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()}`
34 this.reload = function()
36 setTimeout(()=>{ window.location.reload() },500)
39 this.navigate = function(target)
42 window.location.href = target
46 this.location = function()
48 return window.location.hash.replace("#","").trim();
51 this.locate = function()
53 const hash = this.location();
56 return Math.floor(Math.random()*this.sites.length)
59 for(const id in this.sites){
60 const site = this.sites[id];
61 if(site.indexOf(hash) >-1){
68 this.next = function(loc)
70 return loc == this.sites.length-1 ? this.sites[0] : this.sites[loc+1];
73 this.redirect = function()
75 const location = this.locate();
76 const target = this.next(location);
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>`
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list