This commit is contained in:
Devine Lu Linvega 2018-08-29 12:57:26 +12:00
parent 8638e42330
commit d499c0d1c1
3 changed files with 14 additions and 12 deletions

View File

@ -9,8 +9,8 @@ permalink: /404.html
</head> </head>
<body style='background:black'> <body style='background:black'>
<script> <script>
var parts = window.location.pathname.split("/") let parts = window.location.pathname.split("/")
var target = parts.slice(-1); let target = parts.slice(-1);
parts.splice(-1) parts.splice(-1)
document.location.href = parts.join("/")+"/#"+target document.location.href = parts.join("/")+"/#"+target
</script> </script>

View File

@ -11,7 +11,7 @@
<body> <body>
<script> <script>
// protocole://url.domain.ext // protocole://url.domain.ext
var sites = [ let sites = [
"https://wiki.xxiivv.com" "https://wiki.xxiivv.com"
, "http://estevancarlos.com" , "http://estevancarlos.com"
, "https://electro.pizza" , "https://electro.pizza"
@ -73,7 +73,7 @@
, "https://ricky.codes" , "https://ricky.codes"
// Don't forget the comma! No trailing slashes // Don't forget the comma! No trailing slashes
] ]
var portal = new Portal(sites); let portal = new Portal(sites);
portal.start(); portal.start();
</script> </script>
</body> </body>

View File

@ -1,3 +1,5 @@
'use strict';
function Portal(sites) function Portal(sites)
{ {
this.el = document.createElement("div"); this.el = document.createElement("div");
@ -26,10 +28,10 @@ function Portal(sites)
this.directory = function() this.directory = function()
{ {
var html = "" let html = ""
for(var id in this.sites){ for(let id in this.sites){
var site = this.sites[id] let site = this.sites[id]
html += `<ln>${id}) <a href='${site}'>${site.split("//")[1]}</a></ln>` html += `<ln>${id}) <a href='${site}'>${site.split("//")[1]}</a></ln>`
} }
return `<list>${html}</list>\n${this.readme()}${this.buttons()}` return `<list>${html}</list>\n${this.readme()}${this.buttons()}`
@ -54,14 +56,14 @@ function Portal(sites)
this.locate = function() this.locate = function()
{ {
var hash = this.location(); let hash = this.location();
if(hash == "random"){ if(hash == "random"){
return Math.floor(Math.random()*this.sites.length) return Math.floor(Math.random()*this.sites.length)
} }
for(var id in this.sites){ for(let id in this.sites){
var site = this.sites[id]; let site = this.sites[id];
if(site.indexOf(hash) >-1){ if(site.indexOf(hash) >-1){
return parseInt(id) return parseInt(id)
} }
@ -76,8 +78,8 @@ function Portal(sites)
this.redirect = function() this.redirect = function()
{ {
var location = this.locate(); let location = this.locate();
var target = this.next(location); let target = this.next(location);
this.navigate(target) this.navigate(target)
return `<p>Redirecting to <b>${target}</b></p><meta http-equiv="refresh" content="3; url=${target}"> return `<p>Redirecting to <b>${target}</b></p><meta http-equiv="refresh" content="3; url=${target}">
<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>` <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>`