Skip to content

Commit

Permalink
Fix the mobile bootsplash, and any other possible bootsplashes
Browse files Browse the repository at this point in the history
  • Loading branch information
wearrrrr committed Sep 22, 2024
1 parent 3b45c6b commit c852ba0
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 28 deletions.
67 changes: 39 additions & 28 deletions src/Boot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const channel = new BroadcastChannel("tab");
// send message to all tabs, after a new tab
channel.postMessage("newtab");
let activetab = true;
let splashToRemove: HTMLElement | null = null;
channel.addEventListener("message", (msg) => {
if (msg.data === "newtab" && activetab) {
// if there's a previously registered tab that can read the message, tell the other tab to kill itself
Expand Down Expand Up @@ -90,7 +91,6 @@ let anura: Anura;
// global

window.addEventListener("load", async () => {
document.body.appendChild(bootsplash);
const swShared: any = {
test: true,
};
Expand Down Expand Up @@ -118,6 +118,25 @@ window.addEventListener("load", async () => {

anura = await Anura.new(conf);

if (anura.platform.type === "mobile" || anura.platform.type === "tablet") {
splashToRemove = bootsplashMobile;
document.body.appendChild(bootsplashMobile);
} else {
if (anura.config.tnbranding === true) {
splashToRemove = TNBootSplash;
document.body.appendChild(TNBootSplash);
setupTNBootsplash();
} else if (anura.settings.get("i-am-a-true-gangsta")) {
splashToRemove = gangstaBootsplash;
document.body.appendChild(gangstaBootsplash);
} else {
splashToRemove = bootsplash;
document.body.appendChild(bootsplash);
}
}

console.log(splashToRemove);

swShared.anura = anura;
swShared.sh = new anura.fs.Shell();
async function initComlink() {
Expand Down Expand Up @@ -361,32 +380,6 @@ window.addEventListener("load", async () => {

oobeview = new OobeView();

if (anura.platform.type === "mobile" || anura.platform.type === "tablet") {
bootsplash.remove();
document.body.appendChild(bootsplashMobile);
} else {
if (anura.settings.get("i-am-a-true-gangsta") === true) {
bootsplash.remove();
document.body.appendChild(gangstaBootsplash);
} else if (anura.config.tnbranding === true) {
bootsplash.remove();
document.body.appendChild(TNBootSplash);
const TNMark = document.createElement("span");
TNMark.setAttribute(
"style",
"position: absolute; bottom: 70px; right: 10px",
);
TNMark.innerHTML =
"Instance hosted by Titanium Network.<br>More mirrors at discord.gg/unblock";
TNMark.onclick = () => {
anura.apps["anura.browser"].open([
"https://discord.com/invite/unblock/login",
]);
};
document.body.appendChild(TNMark);
}
}

document.body.classList.add("platform-" + anura.platform.type);

if (anura.settings.get("blur-disable")) {
Expand Down Expand Up @@ -439,7 +432,9 @@ window.addEventListener("load", async () => {
setTimeout(
() => {
setTimeout(() => {
document.querySelector(".bootsplash")?.classList.add("hide");
if (splashToRemove) {
splashToRemove.classList.add("hide");
}
}, 350); // give the taskbar time to init
setTimeout(() => {
bootsplash.remove();
Expand Down Expand Up @@ -785,3 +780,19 @@ async function bootUserCustomizations() {

AnuradHelpers.setStage("anura.bootUserCustomizations");
}

function setupTNBootsplash() {
const TNMark = document.createElement("span");
TNMark.setAttribute(
"style",
"position: absolute; bottom: 70px; right: 10px",
);
TNMark.innerHTML =
"Instance hosted by Titanium Network.<br>More mirrors at discord.gg/unblock";
TNMark.onclick = () => {
anura.apps["anura.browser"].open([
"https://discord.com/invite/unblock/login",
]);
};
document.body.appendChild(TNMark);
}
1 change: 1 addition & 0 deletions x86_image_wizard/twisp
Submodule twisp added at ae6e65
1 change: 1 addition & 0 deletions x86_image_wizard/whisper
Submodule whisper added at ca9695

0 comments on commit c852ba0

Please sign in to comment.