-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathamongus.html
126 lines (117 loc) · 3.71 KB
/
amongus.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
<!DOCTYPE html>
<html>
<head>
<title>Among Us Invite</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
<meta charset="utf-8">
</head>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@590&display=swap" rel="stylesheet">
<body>
<div id="db">
<h1>You received an invite!</h1>
<p>Among Us</p>
<input id="rc" oninput="this.value = this.value.toUpperCase()" placeholder="Room Code" readonly></input>
<button onclick="quickJoin();" id="btn" class="button-d">Join!</button>
</div>
<div style="display: none;" id="ii">
<h1>😏</h1>
<button onclick="var myAudio = new Audio('amongusfiles/connecting.wav'); myAudio.play();" class="button-d">ok then...</button>
</div>
<div style="display: none;" id="ui">
<h1>Dang it!</h1>
<p>There was an error parsing the invite link.</p>
<button class="button-d">Big L</button>
</div>
</body>
<script>
var t = new URL(window.location).searchParams.get("invite");
try{
var code = atob(t);
if (t == '' || t == null){
document.getElementById("db").setAttribute("style", "display: none;");
document.getElementById("ii").setAttribute("style", "");
} else{
document.getElementById("rc").value = code;
}
}catch(err){
document.getElementById("db").setAttribute("style", "display: none;");
document.getElementById("ui").setAttribute("style", "");
}
function quickJoin(){
var myAudio = new Audio('amongusfiles/complete.wav'); myAudio.play();
if (getMobileOperatingSystem() == "Android"){
alert("You're on Android, make sure you have the app installed.");
return;
}
if(getMobileOperatingSystem() != "Android"){
/* Get the text field */
var copyText = document.getElementById("rc");
/* Select the text field */
copyText.select();
copyText.setSelectionRange(0, 99999); /* For mobile devices */
/* Copy the text inside the text field */
document.execCommand("copy");
document.getElementById("btn").value = "Joining...";
setTimeout(function(){ alert("Code Copied! Just open the Among Us app and paste the code.") }, 2000);
}
}
function getMobileOperatingSystem() {
var userAgent = navigator.userAgent || navigator.vendor || window.opera;
// Windows Phone must come first because its UA also contains "Android"
if (/windows phone/i.test(userAgent)) {
return "Windows Phone";
}
if (/android/i.test(userAgent)) {
return "Android";
}
// iOS detection from: http://stackoverflow.com/a/9039885/177710
if (/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
return "iOS";
}
return "unknown";
}
</script>
<style>
body{
margin:0;
padding:0;
background-color: rgba(0,0,0,0.8);
font-family: 'Quicksand', sans-serif;
color: white;
text-align: center;
}
input{
width: 80%;
padding: 10px;
font-family: 16px;
background-color: rgba(0,0,0,0.5);
border: solid 1px rgba(255,255,255,0.5);
border-radius: 7px;
color: white;
font-family: 'Quicksand';
-webkit-tap-highlight-color: rgba(0,0,0,0);
outline: none;
}
.button-d{
position: fixed;
bottom: 20px;
left: 50%;
transform: translateX(-50%) scale(1);
padding: 10px;
padding-left: 20px;
padding-right: 20px;
background-color: rgba(0,255,100,1);
font-family: 'Quicksand';
font-size: 18px;
border: 0;
border-radius: 20px;
outline: none;
transition: transform 0.1s ease-out;
}
.button-d:active{
transform: translateX(-50%) scale(0.9);
transition: transform 0.2s ease-out;
}
</style>
</html>