import { settingsState } from "./listeners/SettingsState"; import { animate, stagger } from "motion"; import stringToHTML from "./stringToHTML"; export async function DeleteWhatsNew() { const bkelement = document.getElementById("whatsnewbk"); const popup = document.querySelector(".whatsnewContainer") as HTMLElement; if (!settingsState.animations) { bkelement?.remove(); return; } animate( [popup, bkelement!], { opacity: [1, 0], scale: [1, 0] }, { ease: [0.22, 0.03, 0.26, 1] }, ).then(() => { bkelement?.remove(); }); } export function OpenMinecraftServerPopup() { if (!document.querySelector('link[href*="minecraftia"]')) { const fontLink = document.createElement("link"); fontLink.href = "https://fonts.cdnfonts.com/css/minecraftia"; fontLink.rel = "stylesheet"; document.head.appendChild(fontLink); } const background = document.createElement("div"); background.id = "whatsnewbk"; background.classList.add("whatsnewBackground"); const container = document.createElement("div"); container.classList.add("whatsnewContainer"); var header: any = stringToHTML( /* html */ `

Minecraft Server

The official BetterSEQTA+ Minecraft Server

`, ).firstChild; let imagecont = document.createElement("div"); imagecont.classList.add("whatsnewImgContainer"); let video = document.createElement("video"); let source = document.createElement("source"); source.setAttribute( "src", "https://raw.githubusercontent.com/Jones8683/BetterSEQTA-Plus/main/src/resources/server-video.mp4", ); video.autoplay = true; video.muted = true; video.loop = true; video.appendChild(source); video.classList.add("whatsnewImg"); imagecont.appendChild(video); let textcontainer = document.createElement("div"); textcontainer.classList.add("whatsnewTextContainer"); let text = stringToHTML(/* html */ `

Join our community in Minecraft!

Join the official BetterSEQTA+ Minecraft Server community now!

Server Features

mc.betterseqta.org

Version: 1.21.4

`).firstChild; let footer = stringToHTML(/* html */ `
Resources and Feedback:
`).firstChild; let exitbutton = document.createElement("div"); exitbutton.id = "whatsnewclosebutton"; container.append( header, imagecont, text as HTMLElement, footer as HTMLElement, exitbutton, ); background.append(container); document.getElementById("container")!.append(background); let bkelement = document.getElementById("whatsnewbk"); let popup = document.getElementsByClassName("whatsnewContainer")[0]; if (settingsState.animations) { animate( [popup, bkelement as HTMLElement], { scale: [0, 1] }, { type: "spring", stiffness: 220, damping: 18, }, ); animate( ".whatsnewTextContainer *", { opacity: [0, 1], y: [10, 0] }, { delay: stagger(0.05, { startDelay: 0.1 }), duration: 0.5, ease: [0.22, 0.03, 0.26, 1], }, ); } delete settingsState.justupdated; bkelement!.addEventListener("click", function (event) { // Check if the click event originated from the element itself and not any of its children if (event.target === bkelement) { DeleteWhatsNew(); } }); var closeelement = document.getElementById("whatsnewclosebutton"); closeelement!.addEventListener("click", function () { DeleteWhatsNew(); }); }