-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsendedit.html
100 lines (78 loc) · 2.5 KB
/
sendedit.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
<html>
<head>
<style>
body {
background-color: rgb(0, 0, 0);
}
h1 {
color: white;
}
.button {
background-color: #6e6b67;
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
width: 17%;
display: inline-block;
font-size: 16px;
transition: all 0.2s ease-in-out;
box-shadow: 0 5px 15px rgba(145, 92, 182, .4);
border-color: white;
border-width: 1px;
border-style: dotted;
}
button:hover {
cursor: pointer;
background:#bbb;
color: black;
border-color: black;
border-width: 1px;
border-style: dotted;
}
</style>
<script>
loc = window.location.href;
loc = loc.replace('https://skparab1.github.io/server/sendedit.html?message=','')
num = localStorage.getItem('postnumber');
//console.log('loc',loc);
(async () => {
const data1 = await fetch('./data.json').then(r => r.json());
messages = data1.data[1];
usernames = data1.data[0];
messages = JSON.stringify(messages);
usernames = JSON.stringify(usernames);
usernames = usernames.replace('{"name":"','');
usernames = usernames.replace('"}','');
messages = messages.replace('{"message":"','');
messages = messages.replace('"}','');
var messagesnew = messages.split('&nextentry&');
num = parseInt(num) - 1;
var entry = messagesnew[num];
console.log(messagesnew);
console.log(num);
console.log(messagesnew[num]);
var oldcontent = localStorage.getItem('oldcontent');
console.log('before splitting',entry);
var splitentry = entry.split('¤ttime=');
console.log('after splitting',splitentry);
var newentry = loc;
newentry = loc+'¤ttime='+splitentry[1];
console.log('sending message is this ',newentry);
newentry = newentry.replace('(edited)','');
newentry = newentry + '(edited)';
console.log('sending message is this ',newentry);
messages = messages.replace(entry,newentry);
localStorage.setItem('usernames',usernames);
localStorage.setItem('messages',messages);
console.log('sending message is this ',messages);
window.open('https://skparab1.github.io/sendmsg','_self');
})();
</script>
</head>
<body>
<h1>Sending edited message</h1>
<img src="loading.gif" alt="loading" style="width: 20%; text-align: center;">
</body>
</html>