-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewProject.ejs
More file actions
350 lines (312 loc) · 10.6 KB
/
newProject.ejs
File metadata and controls
350 lines (312 loc) · 10.6 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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
<!DOCTYPE html>
<html>
<head>
<title>Coco.ink</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="/Coco Icon/Old Coco Icon.ico">
<link href="/CSS/homepage.css" rel="stylesheet">
<link href="/CSS/header.css" rel="stylesheet">
<link href="https://vjs.zencdn.net/8.16.1/video-js.css" rel="stylesheet" />
<link href="/CSS/general.css" rel="stylesheet">
<style>
body {
background-color: grey;
font-family: Arial, Helvetica, sans-serif;
background-image: url("/Images/Background Dark.png");
margin: 0px;
padding: 0px;
/*height: 3000px;*/
width: 100%;
/*max-width: 1200px;*/
}
#webpage {
position: absolute;
margin-top: 50px;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
}
.products {
display: grid;
grid-template-columns: 1fr;
margin-left: 12px;
margin-right: 12px;
bottom: 0;
}
/*#header {}*/
.header {
display: flex;
flex: 1;
height: 44px;
position: fixed;
z-index: 100;
margin-bottom: 50px;
background-color: lightgrey;
top: 0;
right: 0;
left: 0;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.418);
padding-top: 12px;
padding-left: 12px;
padding-bottom: 12px;
padding-right: 12px;
/* From https://css.glass */
background: rgba(211, 211, 211, 0.75);
/*border-radius: 16px;*/
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(5.2px);
-webkit-backdrop-filter: blur(5.2px);
border: 1px solid rgba(211, 211, 211, 0.548);
border-bottom: 2px solid rgba(211, 211, 211, 0.548);
}
/*.box-product {
background-color: rgb(247, 243, 243);
/* grid-template-columns: 100px 1fr; */
/* width: 300px;
height: 300px; *
/*padding: 30px 3px 30px 40px;*
/* display: grid; *
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.418);
width: 300px;
height: 300px;
overflow-y: scroll;
overflow-x: scroll;
}*/
.box-product {
background-color: wheat;
/*margin-bottom: 50px;*/
border-radius: 30px;
padding: 12px;
margin: 12px;
margin-top: 100px;
box-shadow: 5px 5px 10px rgba(0, 0, 0, 0.418);
overflow-y: auto;
display: grid;
grid-template-columns: 1fr 4fr;
}
#Coco {
z-index: 101;
height: 38px;
padding-bottom: -20px;
padding-right: -100px;
opacity: 1;
transition: height 1.0s;
transition: opacity 1.0s;
/**/
transition: opacity 1.0s ease-in-out, height 1.0s ease-in-out;
/**/
}
#Coco:hover {
opacity: 0.10;
cursor: pointer;
height: 50px;
transition: opacity 1.0s;
transition: height 1.0s;
/**/
transition: opacity 1.0s ease-in-out, height 1.0s ease-in-out;
/**/
}
.product-img {
height: 120px;
width: 120px;
margin-left: 40px;
max-width: 100%;
}
.Welcome-text-left {
color: rgb(80, 80, 80);
font-size: 40px;
display: inline;
float: left;
}
/*
.Announcement {
background-color: wheat;
margin-top: 100px;
margin-bottom: 50px;
}
*/
</style>
</head>
<body>
<div id="webpage">
<div id="header">
<header class="header">
<!--<button onclick="cocoSound();">Test</button>-->
<a href="/CocoBox/" style="margin-right: 5px !important;"><img id="Coco" src="/Stickers/CocoBox.svg" onmouseover="const audio = new Audio(`/Coco.wav`); audio.play()"></a>
<div class="left-header">
<% if (false) { %>
<div></div>
<a class="content-only-a" href="/Games/">
<button class="special-button">Games</button>
</a>
<button class="special-button">Productivity</button>
<button class="special-button">Creation</button>
<button class="special-button">Develop</button>
<% } else { %>
<a class="content-only-a" href="/users/new/project/">
<button class="special-button">Create New</button>
</a>
<a class="content-only-a" href="/CocoBox/featured/">
<button class="special-button">Featured</button>
</a>
<a class="content-only-a" href="/Search/?type=project&date=now&tags=all">
<button class="special-button">Search</button>
</a>
<% } %>
</div>
<div id="user-controls" class="right-header">
<% if (user !=null && user !=="" ) { %>
<ul style="align-items: center; justify-content: center; color: goldenrod;">
Welcome back <a href="/users/<%= user.username %>">
<%= user.username %>
</a>!
</ul>
<a class="content-only-a" href="/manage">
<button class="special-button header-right">Manage account</button>
</a>
<% if (user.role==="admin" ) { %>
<a class="content-only-a" href="/admin/">
<button class="special-button">Open Admin Panel</button>
</a>
<% } %>
<% } else { %>
<a class="content-only-a" href="/login/">
<button id="sign-in" class="special-button header-right">Sign In</button>
</a>
<a class="content-only-a" href="/register/">
<button class="special-button">Create Account</button>
</a>
<% } %>
</div>
</header>
</div>
<div id="welcome">
<div id="intro" class="info-box">
<p class="Welcome-text center">Create New Project</p>
<form id="form" class="center">
<h2>Project title</h2>
<input type="text" placeholder="Enter project title" id="title">
<h2>Project type</h2>
<select id="type">
<option>CocoScript</option>
<option>Video</option>
<option>Picture</option>
<option>Audio</option>
</select>
<h3>Create: <input type="submit" value="Create" class="special-button" onclick="createProject();"></h3>
<div id="Response"></div>
</form>
</div>
<footer class="box-product">
<div id="footer-content">
<p>Coco.ink © 2025 Coco Ink Software. All rights reserved.</p>
</div>
<h4>
Want to know more about me? <a href="/faq">FactsAndQuestions</a>.
You can also see my <a href="/family">family</a>.
</h4>
</footer>
</div>
<div id="error-container" class="error-container-hide">
Some Scripts Have Probably Crashed
<div id="e" class="error big-box"></div>
</div>
<!---->
<script src="/Ambler.mp3Sound.js"></script>
<script src="/JS/global.js"></script>
<!---->
<script>
document.addEventListener("DOMContentLoaded", () => {
/* Aa *
showError(); /* Aa */
/* Aa */
showMessage();
});
function showError() {
document.getElementById("e").innerHTML = `Oops! Something Crashed!`;
var errorContainer = document.getElementById("error-container");
errorContainer.classList.remove("error-container-hide");
errorContainer.classList.add("error-container-show");
}
function hideError() {
document.getElementById("e").innerHTML = ``;
var errorContainer = document.getElementById("error-container");
errorContainer.classList.remove("error-container-show");
errorContainer.classList.add("error-container-hide");
}
function showMessage(messageAtIndex) {
var messageBox;
switch (messageAtIndex) {
case 5:
//
break;
}
}
window.document.getElementById("form").addEventListener("submit", event => {
event.preventDefault();
});
</script>
<script>
console.log(`At: ${window.location.pathname}`);
if (window.location.pathname.includes('index.html')) window.location.href = window.location.pathname.replace('index.html', '');
</script>
<!--<script src="/Scripts/spawnNewstuff.js" type="module"></script>-->
<script src="https://unpkg.com/dayjs@1.11.10/dayjs.min.js"></script>
<!--<script type="module" src="/Scripts/bodyScripts.js"></script>-->
<script src="https://vjs.zencdn.net/8.16.1/video.min.js"></script>
<script>
const errorMessageContainer = document.getElementById("error-container");
function clearError() {
errorMessageContainer.classList.remove("error-container-show");
errorMessageContainer.classList.add("error-container-hide");
document.getElementById("e").innerHTML = ``;
var errorContainer = document.getElementById("error-container");
errorContainer.classList.remove("error-container-show");
errorContainer.classList.add("error-container-hide");
};
clearError();
async function createProject() {
const payload = {
type: document.getElementById("type").value,
title: document.getElementById("title").value
};
const res = await fetch("/api/create/new/project/", {
method: "POST",
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(payload)
});
const data = await res.json();
console.log(data);
if (res.status != 200) {
document.getElementById("Response").innerHTML =
`Failed to create new project! Error: ${data.status}`;
return;
}
document.getElementById("Response").innerHTML =
`Your new project is available at <a href="/projects/${data.id}/">/projects/${data.id}/</a>`;
if (payload.type === "Video" || payload.type === "Picture" || payload.type === "CocoScript" || payload.type === "Audio") {
const projectId = data.id;
const fileInput = document.createElement("input");
fileInput.type = "file";
fileInput.onchange = () => {
const formData = new FormData();
formData.append("file", fileInput.files[0]);
fetch(`/api/projects/${projectId}/upload`, {
method: "POST",
body: formData
})
.then(res => res.json())
.then(uploadRes => {
console.log("Upload response:", uploadRes);
});
};
fileInput.click();
}
}
</script>
</body>
</html>