-
Notifications
You must be signed in to change notification settings - Fork 0
/
touch.html
90 lines (90 loc) · 3.87 KB
/
touch.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<!docType html>
<html lang="en">
<head>
<noscript>
<div class="content noscript">
<h1>Get out of the 90's!</h1>
<hr>
<h2>This site needs my sh*tty Javascript in order to run properly.</h2>
<p>If you wish to use any of the active elements of this page,</p>
<p>please use a newer browser, or enable Javascript in your settings.</p>
<p>Conventiently, I have a list of the latest supported browser for each operating system here.</p>
</div>
</noscript>
<link rel="icon" type="image/png" href="./img/logo.svg">
<link rel="stylesheet" href="./css/bootstrap-custom.css">
<script src="./js/popper.min.js"></script>
<script src="./js/jquery.min.js"></script>
<script src="./js/bootstrap.bundle.js"></script>
<script src="./js/bootstrap.js"></script>
<script src="./js/siri.js"></script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Generate men on mobile.">
<meta name="keywords" content="Siri, siri-chan, developer, unity, design, Github Pages, .io, siri.tv">
<meta name="author" content="Kira 'Siri' Kurami">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Random Men: On The Go! | siri-chan.github.io</title>
</head>
<body>
<div id = "h"></div>
<div class="content">
<br>
<br>
<button onclick="regenerate()" class="btn btn-warning" id="btn">Generate a Random Man</button>
<p></p>
<p><a href="https://github.com/Siri-chan/men">or see them all.</a></p>
<p> </p>
<span id="man"></span>
<script>
var generated = false;
var generationCount = 0;
function regenerate() {
var man = document.getElementById("man")
generationCount++;
document.getElementById("btn").textContent = "Generate your " + formatTH(generationCount + 1) + " man?"
man.innerHTML = "<img src=\"" + pickMan() + "\"width=" + (window.innerWidth - window.innerWidth/3) + ">"
if(!generated){
generated = true;
}
}
function pickMan() {
//using https://raw.githubusercontent.com/Siri-chan/men/main/<title>.jpg
//Math.floor is zero-inclusive
var num = Math.floor(Math.random() * 233);
console.log(num);
if (num == 232) {
console.log("gif");
return "https://raw.githubusercontent.com/Siri-chan/men/numbered/232.gif";
}
if (num > 229) {
console.log("webp");
return "https://raw.githubusercontent.com/Siri-chan/men/numbered/" + num + ".webp";
}
if (num > 211) {
console.log("png");
return "https://raw.githubusercontent.com/Siri-chan/men/numbered/" + num + ".png";
}
console.log("jpg");
return "https://raw.githubusercontent.com/Siri-chan/men/numbered/" + num + ".jpg";
}
function formatTH(number){
switch (number % 10) {
case 1:
if(number == 11) return "11th"
return number+"st";
case 2:
if (number == 12) return "12th"
return number + "nd";
case 3:
if (number == 13) return "13th"
return number + "rd";
default:
return number + "th";
}
}
</script>
</div>
<div id="f"></div>
</body>
</html>