-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
156 lines (126 loc) · 6.5 KB
/
index.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!--
Copyright 2022 Wriar
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>L + RATIO GENERATOR</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/limonte-sweetalert2/11.7.1/sweetalert2.all.min.js"></script>
<style>
.colored-toast.swal2-icon-error {
background-color: #f27474 !important;
}
.colored-toast .swal2-title {
color: white;
}
.colored-toast .swal2-html-container {
color: white;
}
</style>
</head>
<body>
<div class="container">
<h1>L+RATIO GENERATOR</h1><br>
<button onclick="newGen();" type="button" class="btn btn-outline-primary">Generate New L+RATIO</button><br><br>
<label for="numberInsult">Number of additions (whole number 1-30):</label>
<input type="number" id="numberInsult" name="numberInsult" min="1" max="30" value="6">
<br><br><hr>
<div id="finishGen" style="display: none;">
<h3 id="lRatioText"></h3>
<button id="btnCopy" style="display: none;" onclick="copyText();" type="button" class="btn btn-outline-success"><i id="copyCheck" style="display: none;" class="bi bi-check"></i> Copy to Clipboard</button>
<span><strong>OR...</strong></span><br>
<button onclick="shareToTwitter();" type="button" class="btn btn-primary"><i class="bi bi-twitter"></i> kek</button>
<br>
<hr id="hr1" style="display: none;">
<br><br><br>
</div>
<span class="muted">This code was a speedrun which was completed in 15 minutes 55 seconds.</span><br>
<span class="muted">If you want to download this website <b>right click -> save as</b>.</span>
</div>
<script>
const Toast = Swal.mixin({
toast: true,
position: 'top-right',
iconColor: 'white',
customClass: {
popup: 'colored-toast'
},
showConfirmButton: false,
timer: 750,
})
function fire(icon, title) {
Toast.fire({
icon: icon,
title: title
})
}
var currentOutput;
function newGen() {
var numberInsults = document.getElementById('numberInsult').value;
var totalInt = parseInt(numberInsults)
//Quality Checks
if (totalInt > 30 || totalInt < 1 || totalInt == null || isNaN(totalInt)) {
fire('error', 'Please enter a whole number (integer) to generate between 1-30')
console.log("[FAIL] User must enter valid number in range.")
} else {
console.log("Total insults to generate: " + totalInt)
//Add any other ratio stuff to this array with a COMMA and QUOTES (follow the example)
var texts = ["Didn't Ask", "U fell off", "blocked", "unfollowed", "reported", "cringe", "bozo",
"go touch grass", "didn't ask", "cope", "dont care", "on sus", "seethe", "skill issue",
"fatherless", "condensed", "pngtuber", "dream stan", "log off", "dilate", "cancelled",
"no ♥", "karen", "stfu", "stay mad", "ip address: 171.663.99.177", "beta", "denied", "backpilled",
"nolife", "warm applesauce", "*you're", "league player", "bts stan", "genshin player",
"trashcan", "discord mod", "no wenchces", "xbox player", "fuze main", "bottom tier", "discord light mode",
"redditor", "asbestos", "irrelevant", "stfu", "mid", "exposed"
]
const shuffled = texts.sort(() => 0.5 - Math.random());
//Splice random array into length for random text
let selected = shuffled.slice(0, totalInt);
//Construct Random Text. It is zero-index list - so be sure to splice it as the number of words and base it off 0 when accessing the array.
var outputText = "L + Ratio";
var arrayIterations = 0
for (const element of selected) {
outputText = outputText + " + " + element
arrayIterations += 1; //use compound assignment
}
console.log("[PASS] Total Array Iterations: " + arrayIterations);
//Declare in Global Scope
currentOutput = outputText;
document.getElementById('lRatioText').innerHTML = outputText;
document.getElementById('hr1').style.display = "block";
document.getElementById('btnCopy').style.display = "block";
document.getElementById('finishGen').style.display = "block";
}
}
function copyText() {
var copyText = document.getElementById("lRatioText").innerHTML;
// document.getElementById('copyCheck').style.display = "block";
document.getElementById('btnCopy').innerHTML = "<i id='copyCheck' class='bi bi-check'></i> Copied!"
navigator.clipboard.writeText(copyText);
}
function shareToTwitter() {
//haha yes
var url = "https://wriar.github.io/L-Ratio-Generator/";
var text = currentOutput;
window.open('http://twitter.com/share?url='+encodeURIComponent(url)+'&text='+encodeURIComponent(text), '', 'left=0,top=0,width=550,height=450,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
}
</script>
</body>
</html>