-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.html
147 lines (144 loc) · 4.84 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ASMS</title>
<style>
body{
background-color: #1f2226;
text-align: center;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
}
.title{
color: #fff;
font-size: 42px;
margin: 0;
padding: 32px;
}
.group{
background-color: #16181c;
border-radius: 16px;
padding: 16px;
text-align: start;
width: 80%;
margin: auto;
}
.input-group{
display: flex;
flex-direction: column-reverse;
gap: 2px;
}
.input-group > input, textarea{
padding: 12px;
font-size: 18px;
outline: 0;
border-radius: 8px;
border: 0;
background-color: #1f2226;
border: 2px solid #fff;
border-radius: 8px;
color: #fff;
resize: vertical;
max-height: 195px;
}
textarea{
min-height: 85px;
}
.group > .input-group{
margin: 10px 0;
}
.group > input[type="submit"]{
background-color: #1f2226;
border: 2px solid #fff;
border-radius: 8px;
color: #fff;
cursor: pointer;
font-size: 16px;
margin: 10px 0;
padding: 8px 16px;
transition: all 0.2s ease-in-out;
}
label{
color: #fff;
font-size: 16px;
margin: 0;
padding: 0;
transition: all 0.2s ease-in-out;
font-weight: bold;
}
.msg{
background-color: #96b96f;
padding: 16px;
text-align: center;
font-weight: bolder;
font-size: larger;
border-radius: 14px;
}
::selection
{
background-color: rgba(1, 1, 1, 0.17);
}
/* Chrome, Safari, Edge, Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Firefox */
input[type=number] {
-moz-appearance: textfield;
}
</style>
</head>
<body>
<h1 class="title">Anonymous SMS</h1>
<form action="#" class="group" onsubmit="event.preventDefault();send();">
<div class="msg"></div>
<div class="input-group">
<input type="number" id="phone" placeholder="Phone Number">
<label for="phone">Phone Number</label>
</div>
<div class="input-group">
<textarea type="text" id="text" placeholder="Text"></textarea>
<label for="phone">Message</label>
</div>
<input type="submit" value="Submit">
</form>
<script>
document.querySelector('.msg').style.display = "none";
// document.querySelector('.msg').innerHTML = "SMS Sent!";
const phone = document.querySelector('#phone');
const text = document.querySelector('#text');
function send(){
let phone_number = "+" + phone.value;
let message = text.value;
const data = {phone: phone_number,message: message,key: "textbelt"};
const requestOptions = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify(data)
};
fetch("https://textbelt.com/text", requestOptions).then(response => response.json()).then(data => {
console.log(data.success)
if(data.success){
document.querySelector('.msg').style.display = "block";
document.querySelector('.msg').innerHTML = "SMS Sent!";
document.querySelector('.msg').style.backgroundColor = "#96b96f";
setTimeout(() => {
document.querySelector('.msg').style.display = "none";
}, 5000);
} else{
document.querySelector('.msg').style.display = "block";
document.querySelector('.msg').innerHTML = "SMS Failed!";
document.querySelector('.msg').style.backgroundColor = "#cd3528";
alert("ERROR: "+data.error);
setTimeout(() => {
document.querySelector('.msg').style.display = "none";
}, 5000);
}
}).catch(error => console.error('Error:', error));
}
</script>
</body>
</html>