-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
237 lines (221 loc) · 7.74 KB
/
index.html
File metadata and controls
237 lines (221 loc) · 7.74 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>OnlyRust</title>
<style>
/* Basic styling */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #333;
color: #fff;
padding: 20px 0;
text-align: center;
position: relative; /* Needs to be improved 'Coins' button */
}
header h1 {
margin: 0;
font-size: 2em;
}
.navigation-buttons {
margin-top: 20px;
}
.navigation-buttons button {
margin: 5px;
padding: 10px 20px;
background-color: #f5deb3; /* Beige color */
color: #333;
border: none;
cursor: pointer;
border-radius: 20px; /* Cool round edges (took longer than i thought tbh) */
font-size: 16px;
transition: background-color 0.3s ease; /* Color transitions */
}
.navigation-buttons button:hover {
background-color: #e0cba9; /* Lighter beige on hover */
}
.container {
width: 80%;
margin: auto;
padding: 20px;
}
main {
text-align: center;
}
.login-container, .about-container, .home-container, .create-account-container {
text-align: center;
display: none;
padding: 20px;
border: 1px solid #ccc;
border-radius: 5px;
background-color: #fff;
margin-bottom: 20px;
}
.login-container h2, .about-container h2, .home-container h2, .create-account-container h2 {
margin-bottom: 15px;
}
.login-form, .create-account-form {
width: 300px;
margin: 0 auto;
}
.login-form input, .create-account-form input {
width: 100%;
padding: 12px;
margin-bottom: 15px;
border-radius: 5px;
border: 1px solid #ccc;
box-sizing: border-box;
font-size: 16px;
}
.login-form button, .create-account-form button {
width: 100%;
padding: 12px;
background-color: #333;
color: #fff;
border: none;
cursor: pointer;
border-radius: 5px;
font-size: 16px;
}
footer {
background-color: #333;
color: #fff;
text-align: center;
padding: 10px 0;
width: 100%;
position: fixed;
bottom: 0;
}
</style>
</head>
<body>
<header>
<h1>Clowns Unite</h1>
<button onclick="showCoinsPage()" style="position: absolute; left: 10px; top: 20px;">Coins</button>
<div class="navigation-buttons">
<button onclick="showHomePage()">Home</button>
<button onclick="showLoginPage()">Login</button>
<button onclick="showAboutPage()">About Us</button>
</div>
</header>
<!-- Search Bar -->
<div style="text-align: center; margin-top: 20px;">
<form id="searchForm">
<label for="search">Search Up a User:</label>
<input type="text" id="search" name="search" placeholder="Enter username">
<input type="submit" value="Search">
</form>
<p id="searchResult"></p>
</div>
<!-- End of Search Bar -->
<div class="container">
<main>
<!-- Login Page -->
<div class="login-container" id="login-page">
<h2>Login</h2>
<form class="login-form">
<input type="text" placeholder="Username"><br>
<input type="password" placeholder="Password"><br>
<button type="submit">Login</button>
</form>
<div class="create-account-container" id="create-account-page" style="display: none;">
<h2>Create an Account</h2>
<form class="create-account-form" onsubmit="createAccount(event)">
<input type="text" id="create-username" placeholder="Username" required><br>
<input type="email" id="create-email" placeholder="Email" required><br>
<input type="password" id="create-password" placeholder="Password" required><br>
<button type="submit">Create Account</button>
</form>
</div>
<button onclick="toggleCreateAccount()">Create Account</button>
</div>
<!-- Home Page, About Us remain unchanged -->
<div class="home-container" id="home-page">
<h2>Home</h2>
<p>Hello people who run the Honors program.</p>
</div>
<div class="about-container" id="about-page">
<h2>About Us</h2>
<p>Welcome to our project OnlyRust, a subscription-based media-sharing platform that allows files to be stored on the cloud, with other users able to access them. Theres also a currency system, by which users can pay to access certain files (and you get unlimited free money!!!!!). Your accounts will be safe and secure with our password hashing system! Functionality will be laser-fast with the speedy rust! And most of all, youll be able to "pay" for all exclusive access to the deepest darkest most exclusive files on the internet!</p>
</div>
</main>
</div>
<footer>
<p>OnlyRust</p>
</footer>
<script>
function showHomePage() {
hideAllContainers();
document.getElementById("home-page").style.display = "block";
}
function showLoginPage() {
hideAllContainers();
document.getElementById("login-page").style.display = "block";
}
function showAboutPage() {
hideAllContainers();
document.getElementById("about-page").style.display = "block";
}
function toggleCreateAccount() {
var createAccountPage = document.getElementById("create-account-page");
createAccountPage.style.display = (createAccountPage.style.display === "none" || createAccountPage.style.display === "") ? "block" : "none";
}
function hideAllContainers() {
var containers = document.querySelectorAll('.login-container, .about-container, .home-container, .create-account-container');
containers.forEach(function(container) {
container.style.display = "none";
});
}
function showCoinsPage() {
alert('Coins page will be displayed or some coin-related action will be triggered.');
}
function createSubscribeButton(subscribeCallback) {
const subscribeButton = document.createElement('button');
subscribeButton.textContent = 'Subscribe';
subscribeButton.addEventListener('click', subscribeCallback);
return subscribeButton;
}
document.getElementById("searchForm").addEventListener("submit", function(event) {
event.preventDefault(); // default behavior
const searchValue = document.getElementById("search").value;
fetch(`/search_user?username=${encodeURIComponent(searchValue)}`)
.then(response => {
if (response.ok) {
return response.text(); // assume contains text data
} else {
return response.text();
}
})
.then(data => {
const searchResult = document.getElementById("searchResult");
searchResult.innerText = data; // display the search result
// Create and append the subscribe button
const subscribeButton = createSubscribeButton(() => {
if (data === 'User Found!') {
searchResult.innerText = 'You have subscribed!';
} else {
searchResult.innerText = 'Cannot subscribe - User not found';
}
});
searchResult.appendChild(subscribeButton);
})
.catch(error => {
console.error('Error:', error);
document.getElementById("searchResult").innerText = 'Error occurred while searching';
});
});
function createAccount(event) {
event.preventDefault();
const username = document.getElementById('create-username').value;
const email = document.getElementById('create-email').value;
const password = document.getElementById('create-password').value;
alert(`Creating account...\nUsername: ${username}\nEmail: ${email}\nPassword: ${password}`);
}
</script>
</body>
</html>