-
Notifications
You must be signed in to change notification settings - Fork 1
/
sendmsg.html
118 lines (95 loc) · 3.76 KB
/
sendmsg.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
<html>
<head>
<title>Skparab1 Forum - Sending Message</title>
<style>
body {
background-color: rgb(0, 0, 0);
}
h1 {
color: white;
}
</style>
<script type="module">
import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
// this is now obsolete and not being used anymore
try {
var oldusernames;
var oldmessages;
// getting the current data
(async () => {
const data1 = await fetch('./data.json').then(r => r.json());
oldusernames = data1.data[0];
oldmessages = data1.data[1];
oldusernames = JSON.stringify(oldusernames);
oldmessages = JSON.stringify(oldmessages);
oldusernames = oldusernames.replace('{"name":"','');
oldusernames = oldusernames.replace('"}','');
oldmessages = oldmessages.replace('{"message":"','');
oldmessages = oldmessages.replace('"}','');
// ?name=skparab1&message=t
var loc = window.location.href; //get the url
var data;
// https://skparab1.github.io/server/sendmsg.html?
data = loc.replace('https://skparab1.github.io/server/sendmsg.html?',''); //extract the metadata
data = data.replace('file:///Users/homemac/Desktop/Programming/Other%20programs/server/ui/sender.html?',''); // this is for test
data = data.split('&');
var username = data[0].replace('name=','');
var message = data[1].replace('message=','');
var rname = data[2].replace('rname=','');
var sendusernames = '&=' + username;
var sendmessages = '&nextentry&' + message;
//if (sendusernames.length > 256){
// sendusernames = sendusernames.substring(sendusernames.length-256,sendusernames.length)
//}
//if (sendmessages.length > 256){
// sendmessages = sendmessages.substring(sendmessages.length-256,sendmessages.length)
//}
var today = new Date();
var date = today.getFullYear()+'/'+(today.getMonth()+1)+'/'+today.getDate();
var hour = parseInt(today.getHours());
var suffix;
if (hour > 12){
hour = hour - 12;
suffix = 'PM';
} else if (hour == 12){
suffix = 'PM';
} else {
suffix = 'AM';
}
hour = String(hour);
if (hour.length == 1){
hour = '0'+hour;
}
var minute = String(today.getMinutes());
if (minute.length == 1){
minute = '0'+minute;
}
var second = String(today.getSeconds());
if (second.length == 1){
second = '0'+second;
}
var time = hour + ":" + minute + ":" + second + ' '+suffix;
var datetime = date+' at '+time;
sendusernames = sendusernames + '&n'+rname;
sendmessages = sendmessages + '¤ttime='+datetime;
localStorage.setItem('usernames',sendusernames);
localStorage.setItem('messages',sendmessages);
localStorage.setItem('hr',hour);
localStorage.setItem('min',minute);
localStorage.setItem('suf',suffix);
localStorage.setItem('lastdate',date);
window.open('https://skparab1.github.io/sendmsg','_self');
})();
} catch (error) {
localStorage.setItem('sent',error);
window.open('https://skparab1.github.io/server/frontend.html','_self');
}
//var redirect = setTimeout(window.open('https://skparab1.github.io/ui',"_self")[6000]);
</script>
</head>
<body>
<h1>Sending ur message...</h1>
<img src="loading.gif" alt="loading" style="width: 20%; text-align: center;">
<h1>If you are not redirected within a few seconds click <a href="https://skparab1.github.io/server/frontend.html">here</a></h1>
</body>
</html>