-
Notifications
You must be signed in to change notification settings - Fork 0
/
indextest.html
311 lines (295 loc) · 9.82 KB
/
indextest.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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
<style>
body {
font-size: 12px;
background: transparent !important;
border-style: none;
font-family: helvetica, arial, sans-serif;
}
.download {
cursor: pointer
}
.name {
text-align: center;
font-size: 15px;
}
#instants_container {
margin: 30px auto 0;
text-align: center;
border-style: none;
}
.instant {
position: relative;
vertical-align: top;
width: 94px;
border-style: none;
text-align: center;
display: inline-block;
margin-bottom: 30px;
margin-right: 5px;
margin-left: 5px;
word-wrap: break-word;
}
.small-button {
width: 94px;
height: 89px;
margin-bottom: 0px;
margin-right: 0px;
margin-left: 3px;
margin-top: 0px;
border-style: none;
position: absolute;
background: url(https://felixs-alt.github.io/3kh0/projects/soundboard/img/button.png) no-repeat;
cursor: pointer
}
.small-button:active {
background: url(https://felixs-alt.github.io/3kh0/projects/soundboard/img/button-pressed.png);
cursor: grab;
}
.small-button-background {
width: 86px;
height: 84px;
margin-top: 3px;
margin-left: 6px;
position: absolute;
}
.small-button-shadow {
width: 94px;
height: 89px;
margin-bottom: 5px;
background: url(https://felixs-alt.github.io/3kh0/projects/soundboard/img/button-shadow.png) no-repeat;
}
.circle {
border-radius: 50%;
}
.flex-container {
display: flex;
flex-wrap: wrap;
background-color: white;
}
div.control {
position: fixed;
bottom: 0;
left: 0;
width: auto;
padding: 3px;
border: 3px solid #000;
background: #ffffff;
}
.woah {
cursor: pointer
}
#multiplier {
color: red;
animation-timing-function: linear;
}
@keyframes mymove2 {
0% {background-color: red;}
20% {background-color: orange;}
40% {background-color: yellow;}
60% {background-color: green;}
80% {background-color: blue;}
100% {background-color: red;}
}
@keyframes mymove {
0% {color: red;}
20% {color: orange;}
40% {color: yellow;}
60% {color: green;}
80% {color: blue;}
100% {color: red;}
}
</style>
<head>
<script src="https://accounts.google.com/gsi/client" async defer></script>
</head>
<body>
<input style="color:MediumSeaGreen;" id="mySubmit" maxlength="20" placeholder="Change Username"></input>
<button style="color:MediumSeaGreen;" id="save">Save</button>
<button style="color:MediumSeaGreen;" id="rebirth">Rebirth (10,000 clicks required)</button>
<div id="buttonDiv"></div>
<p style="color:MediumSeaGreen;" id="usertxt"></p>
<h3 style="color:MediumSeaGreen;" id="clicksToday"></h3>
<h1 style="color:rgb(255, 0, 0);" id="multiplier"></h1>
<div class="sound">
<div id="button-background"class="circle small-button-background" style="background-color: #339900;"></div>
<audio autoplay class="sound" id="fart" src="https://felixs-alt.github.io/3kh0/projects/soundboard/sounds/fart.mp3" preload="auto"></audio>
<button id="cButton" class="small-button"></button>
<div class="small-button-shadow"></div>
<h1 style="color:MediumSeaGreen;" id="clicks"></h1>
</div>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.10.1/firebase-firestore.js"></script>
<script type="module">
import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.17.2/firebase-analytics.js";
import { initializeApp } from
"https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";
import { getAuth, onAuthStateChanged } from
"https://www.gstatic.com/firebasejs/9.17.2/firebase-auth.js";
import { getFirestore, doc, getDoc, getDocs, collection, addDoc, setDoc, updateDoc, deleteDoc } from "https://www.gstatic.com/firebasejs/9.17.2/firebase-firestore.js";
const firebaseConfig = {
apiKey: "AIzaSyDSYXQ6Hqw0DXHP9tChpeJTgqnRYz_-Myo",
authDomain: "leaderboard-85e6d.firebaseapp.com",
projectId: "leaderboard-85e6d",
storageBucket: "leaderboard-85e6d.appspot.com",
messagingSenderId: "74908748170",
appId: "1:74908748170:web:7e8b9b0a28b7e175c1a073",
measurementId: "G-5RRW1VCDP0"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
const db = getFirestore(app);
const auth = getAuth(app);
if (localStorage.id == null){localStorage.id = "PlaceHold"}
if (localStorage.getItem("username") === null) {localStorage.username = "Anonymous"}
const docRef = doc(db, "users", localStorage.id);
const docSnap = await getDoc(docRef);
const userData = docSnap.data()
if (docSnap.exists()) {
console.log("user connected to database")
}else{
await setDoc(doc(db, "users", localStorage.id), {
id: localStorage.id,
username: localStorage.username,
clicks: Number(localStorage.clicks)
});
const docRef = doc(db, "users", localStorage.id);
const userData = docSnap.data()
localStorage.clear()
localStorage.id = docSnap.id
location.reload()
}
if (localStorage.gStat === undefined||localStorage.getItem("gStat") === null) {localStorage.gStat = false}
onAuthStateChanged(auth, (user) => async function(){
if (user) {
console.log(user);
const Payload = user
console.log(Payload.email)
if (localStorage.gStat == "false"){
console.log("Updating Data")
const gdocRef = doc(db, "users", Payload.email);
const gdocSnap = await getDoc(gdocRef);
const gdocData = gdocSnap.data()
if (gdocSnap.exists()) {
await deleteDoc(doc(db, "users", localStorage.id));
localStorage.clear()
localStorage.id = Payload.email
localStorage.username = gdocData.username
localStorage.clicks = gdocData.clicks
localStorage.rebirths = gdocData.rebirths
localStorage.gStat = "true"
location.reload()
}else{
await deleteDoc(doc(db, "users", localStorage.id));
await setDoc(doc(db, "users", Payload.email), {
id: Payload.email,
username: localStorage.username,
clicks: Number(localStorage.clicks),
data: Payload
});
localStorage.id = Payload.email
}
localStorage.gStat = "true"
}
}
});
if (localStorage.getItem("rebirths") === null) {
localStorage.rebirths = 1
if (localStorage.getItem("username") === null) {
localStorage.username = "Anonymous"
}
if (localStorage.getItem("timestamp") === null) {
localStorage.timestamp = Date.now()+86400000
console.log(Date.now())
localStorage.multiplier = localStorage.rebirths
}
await updateDoc(docRef, {rebirths: 1})
} else {await updateDoc(docRef, {rebirths: localStorage.rebirths})} if (localStorage.getItem("clicks") === null) {
localStorage.clicks = 0
}
document.getElementById("multiplier").innerText = localStorage.rebirths+"x"
if (localStorage.id == "PlaceHold" || localStorage.id == undefined ) {
try {
const docRef = await addDoc(collection(db, "users"), {
username: localStorage.username,
clicks: Number(localStorage.clicks),
});
localStorage.id = docRef.id
console.log("Document written with ID: ", docRef.id);
} catch (e) {
console.error("Error adding document: ", e);
}
} if (localStorage.id == "3MgZIrFHNjCusEQO5alm") {
console.log("trolled")
window.location = "/trolled.html"
}
if (localStorage.clicksToday == null) {
localStorage.clicksToday = 0
}
if (localStorage.timestamp < Date.now()){
localStorage.timestamp = Date.now()+86400000
localStorage.clicksToday = 0
localStorage.multiplier = localStorage.rebirths
}
async function update(){
await updateDoc(docRef, {
clicks: Number(localStorage.clicks) + Number(localStorage.multiplier),
id: localStorage.id,
rebirths: localStorage.rebirths
});
}
setInterval(update,10000)
await updateDoc(docRef, {id: localStorage.id})
if (localStorage.clicks != userData.clicks) {localStorage.clicks = userData.clicks}
document.getElementById("rebirth").onclick = async function() {
if (Number(localStorage.clicks) >= 10000) {
localStorage.rebirths = Number(localStorage.rebirths)+1
localStorage.clicks = 0
localStorage.multiplier = localStorage.rebirths
localStorage.clicksToday = 0
localStorage.timestamp = Date.now()+86400000
await updateDoc(docRef, {rebirths: localStorage.rebirths})
}}
document.getElementById('usertxt').innerHTML = "username: "+localStorage.username
document.getElementById('clicks').innerHTML = localStorage.clicks+" clicks";
document.getElementById("save").onclick = async function() {
var x = document.getElementById("mySubmit").value;
localStorage.username = x
await updateDoc(docRef, {
username: x
});
document.getElementById('usertxt').innerHTML = "username: "+localStorage.username
};
document.getElementById("cButton").onclick = async function() {
if (localStorage.clicksToday >= 750) {
document.getElementById("button-background").style.animation="mymove2 3s linear infinite";
document.getElementById("multiplier").style.animation="mymove 3s linear infinite";
localStorage.multiplier = Number(localStorage.rebirths)*3
document.getElementById("multiplier").innerText = localStorage.multiplier+"x"
} else {
document.getElementById("button-background").style.animation="mymove2 0s linear";
document.getElementById("multiplier").style.animation="mymove 0s linear";
localStorage.multiplier = localStorage.rebirths
document.getElementById("multiplier").innerText = localStorage.rebirths+"x"
}
if (localStorage.getItem("clicks") == "NaN") {
localStorage.clicks = localStorage.clicksToday
}
document.getElementById('fart').load();
document.getElementById('clicks').innerHTML = Number(localStorage.clicks) + Number(localStorage.multiplier) + " Clicks";
localStorage.clicks = Number(localStorage.clicks) + Number(localStorage.multiplier);
if (localStorage.timestamp > Date.now()) {
document.getElementById('clicksToday').innerHTML = Number(localStorage.clicksToday)+1+" Clicks Today";
localStorage.clicksToday = Number(localStorage.clicksToday)+1
} else {
console.log("deez")
localStorage.timestamp = Date.now()+86400000
localStorage.clicksToday = 0
localStorage.measurementId = 1
localStorage.multiplier = localStorage.rebirths
document.getElementById('multiplier').style.animation="mymove 0s linear";
document.getElementsByClassName('small-button-background').style.animation="mymove 0s linear";
}
}
</script>
</body>