Prevent random choosing the same person
This commit is contained in:
parent
e7fb4c8a38
commit
7197acae41
|
@ -10,6 +10,13 @@
|
|||
window.onload = function() {
|
||||
var users = [ {{ range .Users }} "{{ . }}", {{ end }} ];
|
||||
|
||||
var current = window.location.search.substr(1);
|
||||
var index = users.indexOf(current);
|
||||
|
||||
if (index >= 0) {
|
||||
users.splice(index, 1);
|
||||
}
|
||||
|
||||
var user = users[Math.floor(Math.random() * users.length)];
|
||||
|
||||
window.location.href = "https://southlondon.cc/~" + user;
|
||||
|
|
Loading…
Reference in New Issue