From 7b99c3bf1e1d6d3068b82b66837ed430ec8b0dd3 Mon Sep 17 00:00:00 2001 From: SharkPool <139097378+SharkPool-SP@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:35:30 -0800 Subject: [PATCH] Update startup.js --- scripts/startup.js | 79 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) diff --git a/scripts/startup.js b/scripts/startup.js index 06eb279..2c2528a 100644 --- a/scripts/startup.js +++ b/scripts/startup.js @@ -64,7 +64,20 @@ function refreshTagList() { } function showLoadingGUI() { + const css = document.createElement("link"); + css.setAttribute("rel", "stylesheet"); + css.setAttribute("href", "css/loader.css"); + document.head.appendChild(css); + const holder = document.createElement("div"); + holder.classList.add("overlay"); + const loadCirc = document.createElement("div"); + loadCirc.classList.add("load-circle"); + loadCirc.innerHTML = ``; + + holder.appendChild(loadCirc); + document.body.appendChild(holder); + return holder; } function showMediaRules() { @@ -125,7 +138,69 @@ function showMediaRules() { } function showMediaEditor(namespace, fileType) { + const media = uploadData.media[namespace]; + + const css = document.createElement("link"); + css.setAttribute("rel", "stylesheet"); + css.setAttribute("href", "css/media-editor.css"); + document.head.appendChild(css); + const holder = document.createElement("div"); + holder.classList.add("overlay"); + const editor = document.createElement("div"); + editor.classList.add("editor"); + editor.innerHTML = ` +
Promotion Media Editor
+
+
+ ${ fileType === "mp4" ? + `` : `` + } +
+
Aspect Ratio
+
+ +
+
Important Checks
+
+ selected size +
+ video length + `; + + editor.querySelector(`div[class="exit-btn"]`).addEventListener("click", (e) => { + const anim = editor.animate( + [{ transform: "translate(-50%, -50%) scale(1)" }, { transform: "translate(-50%, -50%) scale(0)" }], { duration: 250, easing: "ease-in" } + ); + anim.onfinish = () => { + css.remove(); + holder.remove(); + }; + e.stopPropagation(); + }); + + holder.appendChild(editor); + document.body.appendChild(holder); + editor.animate( + [{ transform: "translate(-50%, -50%) scale(0)" }, { transform: "translate(-50%, -50%) scale(1)" }], { duration: 300, easing: "ease-in-out" } + ); } /* Internal Utils */ @@ -219,9 +294,9 @@ document.querySelector("form").addEventListener("submit", async (e) => { e.preventDefault(); if (e.target.checkValidity()) { console.log("Submitting Data..."); - showLoadingGUI(); + const loadScreen = showLoadingGUI(); const urlData = constructPost(); - // TODO finish this + // TODO send post, then end loadScreen, prevent submit button from working again } }); document.addEventListener("DOMContentLoaded", () => {