-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
389 lines (355 loc) · 10.8 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
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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
<head>
<script src="/register-sw.js"></script>
<script src="/colors.js"></script>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="Innate">
<link rel="apple-touch-icon" sizes="180x180" href="/favicon.ico">
<link rel="apple-touch-icon" sizes="152x152" href="/favicon.ico">
<link rel="apple-touch-icon" sizes="120x120" href="/favicon.ico">
<link rel="apple-touch-icon" sizes="76x76" href="/favicon.ico">
<link rel="apple-touch-startup-image" href="/favicon.ico">
<script src="/innate-config.js"></script>
<title>Innate - Chat Freely</title>
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" />
<meta name="description" content="Stop scrolling, start chatting with Innate, the ultimate chatting website for any purpose. Dive into lively conversations, create groups for your school or friend circle, and be whoever you want to be. Connect, discuss, and explore limitless possibilities!">
<meta name="keywords" content="chatting website, online chat platform, group discussions, social interaction, virtual communities, messaging platform, communication hub, online conversations, friend groups, school groups, chat rooms, chat community, chatting network, online forum, connect with others">
<meta name="theme-color" content="#000000">
</head>
<div id="navbar">
<a onclick="groups();" style="float:left;border-radius: 0 0 10px 0;" class="navitem">
<img src="/images/groups-light.png" class="navimage" style="height: 5vh;">
</a>
<a onclick="dms();" style="float:left;border-radius: 0 0 10px 0;" class="navitem">
<img src="/images/dms-light.png" class="navimage" style="height: 5vh;">
<div id="unread"></div>
</a>
<a onclick="signout();" style="float:right; border-radius: 0 0 0 10px;" class="navitem">
<img src="/images/logout-light.png" class="navimage" style="height: 5vh;">
</a>
<a onclick="options();" style="float:right; border-radius: 0 0 0 10px;" class="navitem">
<img src="/images/settings-light.png" class="navimage" style="height: 5vh;">
</a>
<a onclick="newgroup();" style="float:left; border-radius: 0 0 0 10px;" class="navitem">
<img src="/images/new-light.png" class="navimage" style="height: 5vh;">
</a>
<a onclick="embedpage();" style="float:left; border-radius: 0 0 0 10px;" class="navitem">
<img src="/images/embed-light.png" class="navimage" style="height: 5vh;">
</a>
</div>
<iframe id="chat"></iframe>
<iframe id="groups"></iframe>
<iframe id="dmframe"></iframe>
<style>
#groups,#dmframe{
width:100%;
height:100%;
position:absolute;
left:-100%;
bottom:0px;
border:0px;
transition: 0.3s all;
}
#unread{
width: 40%;
background: red;
position: relative;
bottom: 100%;
height: 40%;
border-radius: 50%;
left: 70%;
display: none;
}
#chat{
display:block;
transition: opacity 0.5s ease-in-out;
width:100%;
height:100%;
position:absolute;
left:0px;
bottom:0px;
border:0px;
opacity: 1;
}
.hidden {
opacity: 0 !important;
}
#navbar{
z-index:999999;
width:100%;
position:absolute;
left:0px;
top:0px;
}
.navitem{
float:right;
text-decoration:none;
margin:10px;
height:5vh;
background:transparent;
cursor:pointer;
}
::-webkit-scrollbar {
width: 10px;
color: var(--primary);
}
::-webkit-scrollbar-thumb:hover {
background: var(--secondary);
color: var(--secondary);
}
::-webkit-scrollbar-thumb {
border-radius: 10px;
color: var(--primary);
background: var(--primary);
}
::placeholder{
color:var(--primary);
}
#messageinput{
width:70%;
position:absolute;
text-align:left;
left:15%;
bottom:10px;
padding:10px;
font-size:25px;
color:var(--primary);
border-color:var(--primary);
background:transparent;
border-radius:25px;
outline:none;
height: 9vh;
}
#messages{
height:75vh;
position:absolute;
left:0px;
top:10%;
width:100%;
overflow-x:hidden;
overflow-y:scroll;
}
@keyframes fadeout{
0%{
opacity:1;
}
100%{
opacity: 0;
}
}
@keyframes fadein{
0%{
opacity:0;
}
100%{
opacity: 1;
}
}
.messagebox{
margin-left:5px;
margin-right:5px;
display:flex;
flex-direction:column;
margin-bottom:15px;
}
.messagetext{
max-width: 40%;
width:fit-content;
background: var(--secondary);
padding-left: 5px !important;
padding: 7px;
border-radius: 0px 10px 10px 10px;
color: var(--primary);
}
.usertext{
margin-left: 5px;
margin-bottom:3px;
color: var(--primary);
}
body{
background:var(--bg);
overflow:hidden;
animation-duration: 0.8s;
animation: none;
}
</style>
<script defer>
if (localStorage.getItem("darkMode")=="yes"){
var images=document.getElementsByClassName("navimage");
for (var i=0;i<images.length;i++){
images[i].src=images[i].src.replace("light","dark");
}
}
var inDM=localStorage.getItem("inDM") || false;
var dmframe=document.getElementById("dmframe");
var groupsframe=document.getElementById("groups");
window.addEventListener('load', (event) => {
document.getElementById("groups").src="/groups";
document.getElementById("dmframe").src="/groups?dm=yes";
});
function getText(file){
return new Promise((resolve) => {
fetch(file)
.then((response) => {
return response.text();
})
.then((txt) => {
resolve(txt.trim());
});
});
}
var canSwitch=true;
function switchTo(link) {
if (canSwitch){
canSwitch=false;
var frame=document.getElementById("chat");
frame.style.animation="fadeout 0.5s forwards";
function animationEnding(){
frame.src=link;
frame.addEventListener("load",loadStarting);
}
function loadStarting(){
canSwitch=true;
frame.style.animation="fadein 0.5s forwards";
frame.style.opacity="1";
}
frame.addEventListener("animationend",animationEnding);
}
}
function newgroup(){
if (document.getElementById("chat").src!=window.location.href+"new"){
groupsframe.style.left="-100%";
dmframe.style.left="-100%";
switchTo("/new");
} else {
switchTo("/chat/?group="+groupinuse+"&password="+passwordinuse);
}
}
function options(){
if (document.getElementById("chat").src!=window.location.href+"settings"){
groupsframe.style.left="-100%";
dmframe.style.left="-100%";
switchTo("/settings");
} else {
switchTo("/chat/?group="+groupinuse+"&password="+passwordinuse);
}
}
function embedpage(){
if (document.getElementById("chat").src!=window.location.href+"embed"){
groupsframe.style.left="-100%";
dmframe.style.left="-100%";
switchTo(document.getElementById("chat").src="/embed");
} else {
switchTo("/chat/?group="+groupinuse+"&password="+passwordinuse);
}
}
document.getElementById("chat").style.opacity="1";
function groups(){
var groups=document.getElementById("groups");
dmframe.style.left="-100%";
if (groupsframe.style.left=="-100%"){
groupsframe.style.left="0%";
} else {
groupsframe.style.left="-100%";
}
}
function dms(){
groupsframe.style.left="-100%";
if (dmframe.style.left=="-100%"){
dmframe.style.left="0%";
} else {
dmframe.style.left="-100%";
}
}
var groupinuse=localStorage.getItem("groupname");
var dminuse=localStorage.getItem("targetuser");
var currentgroup=groupinuse;
var currentdm=dminuse;
var passwordinuse=localStorage.getItem("grouppassword");
if (passwordinuse=="" || passwordinuse==null){
passwordinuse="none";
}
if (groupinuse==null){
groupinuse="general";
passwordinuse="none";
}
document.getElementById("chat").src="/chat/?group="+groupinuse+"&password="+passwordinuse;
async function verify(){
var verify=await getText(localStorage.getItem("server")+"group.php/?val=v&group="+groupinuse+"&password="+passwordinuse);
if (verify!="Valid"){
groups();
} else {
switchTo("/chat/?group="+groupinuse+"&password="+passwordinuse);
groupsframe.style.left="-100%";
dmframe.style.left="-100%";
}
}
verify();
function signout(){
localStorage.removeItem("username");
localStorage.removeItem("password");
window.location.href="/welcome";
}
var clientuser=localStorage.getItem("username");
var clientpassword=localStorage.getItem("password");
if (clientuser==undefined || clientuser==null){
window.location.href="/welcome";
}
async function checklogin(){
var verify=await getText(localStorage.getItem("server")+"user.php/?val=r&user="+clientuser+"&password="+clientpassword);
if (verify!="Valid"){
signout();
}
}
checklogin();
setInterval(()=>{
currentgroup=localStorage.getItem("groupname");
currentdm=localStorage.getItem("targetuser");
var messageToAlert=localStorage.getItem("alert");
if (localStorage.getItem("refresh")){
localStorage.removeItem("refresh");
document.getElementById('groups').contentWindow.location.reload();
document.getElementById('dmframe').contentWindow.location.reload();
}
if (currentgroup!=groupinuse && currentgroup!=null && currentdm==null){
groupinuse=currentgroup;
dminuse=null;
localStorage.setItem("refresh","yes");
passwordinuse=localStorage.getItem("grouppassword");
document.getElementById("groups").style.left="-100%";
document.getElementById('groups').contentWindow.location.reload();
checklogin();
verify();
}
if (currentdm!=dminuse && currentdm!=null && currentgroup==null){
dminuse=currentdm;
groupinuse=null;
localStorage.setItem("refresh","yes");
document.getElementById("dmframe").style.left="-100%";
document.getElementById('dmframe').contentWindow.location.reload();
switchTo("/chat/?dm=yes&targetuser="+dminuse);
}
if (messageToAlert){
alert(messageToAlert);
localStorage.removeItem("alert");
}
},10);
setInterval(()=>{
if (document.getElementById("dmframe").style.left=="-100%"){
document.getElementById("dmframe").contentWindow.location.reload();
}
},4000);
async function updateRead(){
var response=await getText(localStorage.getItem("server")+"unread.php?val=r¤tuser="+clientuser+"&up="+clientpassword);
var parts=response.split("|");
for (var i=0;i<parts.length;i++){
if (parts[i].split(":")[1]=="unread" && parts[i].split(":")[0]!=""){
document.getElementById("unread").style.display="block";
break;
} else {
document.getElementById("unread").style.display="none";
}
}
}
setInterval(updateRead,700);
</script>