-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubmit
More file actions
99 lines (94 loc) · 3.19 KB
/
Submit
File metadata and controls
99 lines (94 loc) · 3.19 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Anonymous Confessions</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f9f9f9;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
h1 {
color: #333;
}
form {
background-color: #fff;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
textarea {
width: 100%;
height: 100px;
margin-bottom: 10px;
border-radius: 5px;
border: 1px solid #ccc;
padding: 10px;
font-size: 16px;
}
button {
padding: 10px 20px;
background-color: #007BFF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0056b3;
}
.character-count {
text-align: right;
color: #555;
}
</style>
<script>
async function handleSubmit(event) {
event.preventDefault();
const textarea = document.getElementById('confession');
const url = 'https://script.google.com/macros/s/AKfycbzvQwtPiwhym6OtXhvjk6cABNL5DZuIQ0Ma-mj9zQjrQqXBOqVi2VjZ5DW8GIG0cvbfNQ/exec'; // Replace with your Google Apps Script URL
if (textarea.value.length > 200) {
alert('Confession exceeds 200 characters!');
} else {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
body: `confession=${encodeURIComponent(textarea.value)}`
});
const result = await response.json();
if (result.status === 'success') {
alert('Confession submitted successfully!');
textarea.value = '';
updateCharacterCount();
} else {
alert('Error submitting confession.');
}
}
}
function updateCharacterCount() {
const textarea = document.getElementById('confession');
const charCount = document.getElementById('char-count');
const maxLength = 200;
const currentLength = textarea.value.length;
charCount.textContent = `${currentLength}/${maxLength}`;
}
</script>
</head>
<body>
<h1>Anonymous Confessions</h1>
<form onsubmit="handleSubmit(event)">
<textarea id="confession" oninput="updateCharacterCount()" maxlength="200" placeholder="Enter your confession..."></textarea>
<div class="character-count" id="char-count">0/200</div>
<button type="submit">Submit</button>
</form>
</body>
</html>