Spaces:
Runtime error
Runtime error
stanley
commited on
Commit
·
0ff3fbd
1
Parent(s):
f20cc58
syntax
Browse files- .env +0 -0
- index.html +21 -52
.env
ADDED
|
File without changes
|
index.html
CHANGED
|
@@ -315,39 +315,29 @@ html, body {
|
|
| 315 |
|
| 316 |
<script>
|
| 317 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
|
| 319 |
-
|
| 320 |
-
|
| 321 |
-
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
|
| 325 |
-
|
| 326 |
-
function toggleToolbar() {
|
| 327 |
-
console.log("Hamburger menu button clicked");
|
| 328 |
-
const toolbar = document.getElementById("toolbar");
|
| 329 |
-
const hamburgerMenu = document.getElementById("hamburger-menu");
|
| 330 |
-
if (toolbar.style.display === "none" || toolbar.style.display === "") {
|
| 331 |
-
toolbar.style.display = "block";
|
| 332 |
-
hamburgerMenu.classList.add("open");
|
| 333 |
-
} else {
|
| 334 |
-
toolbar.style.display = "none";
|
| 335 |
-
hamburgerMenu.classList.remove("open");
|
| 336 |
-
}
|
| 337 |
-
}
|
| 338 |
-
|
| 339 |
-
function aws(name, x, y) {
|
| 340 |
-
return `coming from javascript ${name} ${x} ${y}`;
|
| 341 |
-
}
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
|
| 346 |
const { initializeApp } = firebase;
|
| 347 |
|
| 348 |
const { getStorage, ref, listAll, getDownloadURL, getMetadata, uploadBytesResumable } = firebase.storage;
|
| 349 |
|
| 350 |
-
|
| 351 |
const firebaseConfig = {
|
| 352 |
apiKey: "AIzaSyCxG7s_Wg6RAC4AQ5ZpkCgt0XcnSqcwt-A",
|
| 353 |
authDomain: "nyucapstone-7c22c.firebaseapp.com",
|
|
@@ -359,11 +349,7 @@ html, body {
|
|
| 359 |
databaseURL: "https://nyucapstone-7c22c-default-rtdb.firebaseio.com/",
|
| 360 |
};
|
| 361 |
|
| 362 |
-
|
| 363 |
-
|
| 364 |
const fireapp = initializeApp(firebaseConfig);
|
| 365 |
-
|
| 366 |
-
|
| 367 |
function uploadImageToFirebase(base64_str, time_str) {
|
| 368 |
return new Promise((resolve, reject) => {
|
| 369 |
alert("starting to upload");
|
|
@@ -377,18 +363,11 @@ html, body {
|
|
| 377 |
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
| 378 |
}
|
| 379 |
|
| 380 |
-
|
| 381 |
const analytics = firebase.analytics();
|
| 382 |
-
|
| 383 |
const byteArray = new Uint8Array(byteNumbers);
|
| 384 |
const blob = new Blob([byteArray], {type: "image/png"});
|
| 385 |
-
|
| 386 |
-
|
| 387 |
const storage = firebase.storage(fireapp);
|
| 388 |
-
|
| 389 |
-
|
| 390 |
const storageRef = firebase.storage().ref(`images/${time_str}.png`);
|
| 391 |
-
|
| 392 |
const uploadTask = storageRef.put(blob);
|
| 393 |
|
| 394 |
alert("sucessful upload to firebae");
|
|
@@ -420,12 +399,7 @@ function overrideW2uiStyles() {
|
|
| 420 |
return;
|
| 421 |
}
|
| 422 |
toolbar.style.backgroundColor = "#0C0F19";
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
const toolbarButtons = document.querySelectorAll(".w2ui-toolbar .w2ui-scroll-wrapper .w2ui-tb-button");
|
| 428 |
-
|
| 429 |
toolbarButtons.forEach(button => {
|
| 430 |
button.style.border = "4px solid rgb(67, 55, 201)";
|
| 431 |
button.style.backgroundColor = "#1F2937";
|
|
@@ -433,13 +407,10 @@ function overrideW2uiStyles() {
|
|
| 433 |
button.style.fontSize = "16px";
|
| 434 |
button.style.fontWeight = 600;
|
| 435 |
|
| 436 |
-
|
| 437 |
const nestedText = button.querySelector("div.w2ui-tb-text:nth-child(1)");
|
| 438 |
if (nestedText) {
|
| 439 |
nestedText.style.color = "rgb(255, 255, 255)";
|
| 440 |
}
|
| 441 |
-
|
| 442 |
-
|
| 443 |
// Add event listeners for mouseover and mouseout events
|
| 444 |
button.addEventListener("mouseenter", () => {
|
| 445 |
button.style.backgroundColor = "#4B5563";
|
|
@@ -579,13 +550,8 @@ function overrideW2uiStyles() {
|
|
| 579 |
cancelButtonElement.style.display = "flex";
|
| 580 |
cancelButtonElement.style.alignItems = "center";
|
| 581 |
cancelButtonElement.style.justifyContent = "center";
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
}
|
| 586 |
|
| 587 |
-
|
| 588 |
-
|
| 589 |
// Execute style function to start checking
|
| 590 |
overrideW2uiStyles();
|
| 591 |
|
|
@@ -751,7 +717,10 @@ async def draw_canvas() -> None:
|
|
| 751 |
# window.parent.postMessage({ type: "displayLatestImageOnCanvas", image: latest_image }, "*")
|
| 752 |
# else:
|
| 753 |
# print("No latest image found in Firebase.")
|
| 754 |
-
|
|
|
|
|
|
|
|
|
|
| 755 |
|
| 756 |
|
| 757 |
# new draw_canvas scale method
|
|
|
|
| 315 |
|
| 316 |
<script>
|
| 317 |
|
| 318 |
+
// alert("starting js");
|
| 319 |
+
|
| 320 |
+
function toggleToolbar() {
|
| 321 |
+
console.log("Hamburger menu button clicked");
|
| 322 |
+
const toolbar = document.getElementById("toolbar");
|
| 323 |
+
const hamburgerMenu = document.getElementById("hamburger-menu");
|
| 324 |
+
if (toolbar.style.display === "none" || toolbar.style.display === "") {
|
| 325 |
+
toolbar.style.display = "block";
|
| 326 |
+
hamburgerMenu.classList.add("open");
|
| 327 |
+
} else {
|
| 328 |
+
toolbar.style.display = "none";
|
| 329 |
+
hamburgerMenu.classList.remove("open");
|
| 330 |
+
}
|
| 331 |
+
}
|
| 332 |
|
| 333 |
+
function aws(name, x, y) {
|
| 334 |
+
return `coming from javascript ${name} ${x} ${y}`;
|
| 335 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 336 |
|
| 337 |
const { initializeApp } = firebase;
|
| 338 |
|
| 339 |
const { getStorage, ref, listAll, getDownloadURL, getMetadata, uploadBytesResumable } = firebase.storage;
|
| 340 |
|
|
|
|
| 341 |
const firebaseConfig = {
|
| 342 |
apiKey: "AIzaSyCxG7s_Wg6RAC4AQ5ZpkCgt0XcnSqcwt-A",
|
| 343 |
authDomain: "nyucapstone-7c22c.firebaseapp.com",
|
|
|
|
| 349 |
databaseURL: "https://nyucapstone-7c22c-default-rtdb.firebaseio.com/",
|
| 350 |
};
|
| 351 |
|
|
|
|
|
|
|
| 352 |
const fireapp = initializeApp(firebaseConfig);
|
|
|
|
|
|
|
| 353 |
function uploadImageToFirebase(base64_str, time_str) {
|
| 354 |
return new Promise((resolve, reject) => {
|
| 355 |
alert("starting to upload");
|
|
|
|
| 363 |
byteNumbers[i] = byteCharacters.charCodeAt(i);
|
| 364 |
}
|
| 365 |
|
|
|
|
| 366 |
const analytics = firebase.analytics();
|
|
|
|
| 367 |
const byteArray = new Uint8Array(byteNumbers);
|
| 368 |
const blob = new Blob([byteArray], {type: "image/png"});
|
|
|
|
|
|
|
| 369 |
const storage = firebase.storage(fireapp);
|
|
|
|
|
|
|
| 370 |
const storageRef = firebase.storage().ref(`images/${time_str}.png`);
|
|
|
|
| 371 |
const uploadTask = storageRef.put(blob);
|
| 372 |
|
| 373 |
alert("sucessful upload to firebae");
|
|
|
|
| 399 |
return;
|
| 400 |
}
|
| 401 |
toolbar.style.backgroundColor = "#0C0F19";
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
const toolbarButtons = document.querySelectorAll(".w2ui-toolbar .w2ui-scroll-wrapper .w2ui-tb-button");
|
|
|
|
| 403 |
toolbarButtons.forEach(button => {
|
| 404 |
button.style.border = "4px solid rgb(67, 55, 201)";
|
| 405 |
button.style.backgroundColor = "#1F2937";
|
|
|
|
| 407 |
button.style.fontSize = "16px";
|
| 408 |
button.style.fontWeight = 600;
|
| 409 |
|
|
|
|
| 410 |
const nestedText = button.querySelector("div.w2ui-tb-text:nth-child(1)");
|
| 411 |
if (nestedText) {
|
| 412 |
nestedText.style.color = "rgb(255, 255, 255)";
|
| 413 |
}
|
|
|
|
|
|
|
| 414 |
// Add event listeners for mouseover and mouseout events
|
| 415 |
button.addEventListener("mouseenter", () => {
|
| 416 |
button.style.backgroundColor = "#4B5563";
|
|
|
|
| 550 |
cancelButtonElement.style.display = "flex";
|
| 551 |
cancelButtonElement.style.alignItems = "center";
|
| 552 |
cancelButtonElement.style.justifyContent = "center";
|
|
|
|
|
|
|
|
|
|
| 553 |
}
|
| 554 |
|
|
|
|
|
|
|
| 555 |
// Execute style function to start checking
|
| 556 |
overrideW2uiStyles();
|
| 557 |
|
|
|
|
| 717 |
# window.parent.postMessage({ type: "displayLatestImageOnCanvas", image: latest_image }, "*")
|
| 718 |
# else:
|
| 719 |
# print("No latest image found in Firebase.")
|
| 720 |
+
|
| 721 |
+
|
| 722 |
+
|
| 723 |
+
from PIL import ImageOps
|
| 724 |
|
| 725 |
|
| 726 |
# new draw_canvas scale method
|