init
This commit is contained in:
commit
cd27f7e4af
12 changed files with 1786 additions and 0 deletions
232
html/code.js
Normal file
232
html/code.js
Normal file
|
@ -0,0 +1,232 @@
|
|||
function updateClock() {
|
||||
const now = new Date();
|
||||
const hours = String(now.getHours()).padStart(2, '0');
|
||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
||||
document.getElementById('clock').textContent = `${hours}:${minutes}:${seconds}`;
|
||||
}
|
||||
setInterval(updateClock, 1000);
|
||||
updateClock();
|
||||
|
||||
// Handle Boot Sequence
|
||||
const bootStrings = [
|
||||
"Booting up...",
|
||||
"Loading system files...",
|
||||
"Initializing hardware...",
|
||||
"Checking memory...",
|
||||
"Establishing network connection...",
|
||||
"Starting core services...",
|
||||
"Loading user preferences...",
|
||||
"Optimizing performance...",
|
||||
"Finalizing setup...",
|
||||
"System ready."
|
||||
];
|
||||
|
||||
let indexBiosOption = 0;
|
||||
const options = {
|
||||
AndroidType: {
|
||||
curval: 0,
|
||||
types: {
|
||||
0: "Normal",
|
||||
1: "Syskor",
|
||||
2: "Hostile - Different Company",
|
||||
3: "Hostile - Rogue Android"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let booting = true;
|
||||
let inBios = false; // Change to False when complete
|
||||
document.addEventListener('keydown', function(event) {
|
||||
if (event.key === 'Escape') {
|
||||
if (inBios) {
|
||||
document.getElementsByClassName("active")[0].classList.remove("active");
|
||||
indexBiosOption = document.getElementById("BiosSelectables").children.length -1;
|
||||
document.getElementById("BiosSelectables").children[indexBiosOption].classList.add("active");
|
||||
console.log(indexBiosOption)
|
||||
}
|
||||
if (booting) {
|
||||
inBios = true;
|
||||
document.getElementById("BIOS").style.display = "flex";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (inBios) {
|
||||
switch (event.key) {
|
||||
case 'ArrowUp':
|
||||
document.getElementsByClassName("active")[0].classList.remove("active");
|
||||
--indexBiosOption;
|
||||
if (indexBiosOption <= -1) {
|
||||
indexBiosOption = document.getElementById("BiosSelectables").children.length - 1;
|
||||
}
|
||||
document.getElementById("BiosSelectables").children[indexBiosOption].classList.add("active");
|
||||
|
||||
break;
|
||||
case 'ArrowDown':
|
||||
document.getElementsByClassName("active")[0].classList.remove("active");
|
||||
++indexBiosOption;
|
||||
if (indexBiosOption >= document.getElementById("BiosSelectables").children.length) {
|
||||
indexBiosOption = 0;
|
||||
}
|
||||
document.getElementById("BiosSelectables").children[indexBiosOption].classList.add("active");
|
||||
break;
|
||||
case 'ArrowLeft': {
|
||||
const activeElem = document.getElementsByClassName("active")[0];
|
||||
if (activeElem.id === "emulator") {
|
||||
options.AndroidType.curval--;
|
||||
|
||||
if (options.AndroidType.curval < 0) {
|
||||
options.AndroidType.curval = Object.keys(options.AndroidType.types).length - 1;
|
||||
}
|
||||
console.log(`CurVal: ${options.AndroidType.curval} AndroidType: ${options.AndroidType.types[options.AndroidType.curval]}`);
|
||||
activeElem.children[1].innerText = options.AndroidType.types[options.AndroidType.curval];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'ArrowRight': {
|
||||
const activeElem = document.getElementsByClassName("active")[0];
|
||||
if (activeElem.id === "emulator") {
|
||||
options.AndroidType.curval++;
|
||||
|
||||
if (options.AndroidType.curval >= Object.keys(options.AndroidType.types).length) {
|
||||
options.AndroidType.curval = 0;
|
||||
}
|
||||
console.log(`CurVal: ${options.AndroidType.curval} AndroidType: ${options.AndroidType.types[options.AndroidType.curval]}`);
|
||||
activeElem.children[1].innerText = options.AndroidType.types[options.AndroidType.curval];
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 'Enter':
|
||||
const activeElem = document.getElementsByClassName("active")[0];
|
||||
if (activeElem.id === "discardrestart") {
|
||||
options.AndroidType.curval = 0;
|
||||
}
|
||||
if (activeElem.id.includes("restart")) {
|
||||
document.getElementById("bootText").innerHTML = "";
|
||||
document.getElementById("BIOS").style.display = "none";
|
||||
inBios = false;
|
||||
boot();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
document.addEventListener('DOMContentLoaded', () => {window.electronAPI.dom();});
|
||||
|
||||
window.electronAPI.onNewMessage((message) => {
|
||||
console.log(`Message from ${message.sender}: ${message.message}`);
|
||||
if (document.getElementById("mnetext").innerHTML.length !== 0) document.getElementById("mnetext").innerHTML += '<br>'
|
||||
document.getElementById('mnetext').innerText += `${message.message}`
|
||||
document.getElementById("mnetext").scrollTop = document.getElementById("mnetext").scrollHeight;
|
||||
|
||||
});
|
||||
|
||||
const boot = async () => {
|
||||
if (options.AndroidType.curval === 2 || options.AndroidType.curval === 3 ) {
|
||||
document.body.style.backgroundColor = "red";
|
||||
document.getElementById("startbar").innerText = "Hostile Android Detected. This is a Demonstration.";
|
||||
if (options.AndroidType.curval === 2) {
|
||||
document.getElementById("userinfo").innerHTML += "<br>Hostile Android Detected.<br>Company: BetterLeap<br>Unit Identifer: LUNA";
|
||||
}
|
||||
if (options.AndroidType.curval === 3) {
|
||||
document.getElementById("userinfo").innerHTML += "<br>Hostile Android Detected.<br>BASIC Reports: Rogue Android";
|
||||
}
|
||||
}
|
||||
if (options.AndroidType.curval === 1) {
|
||||
document.getElementById("backlogo").children[0].innerText = "Syskor";
|
||||
document.getElementById("userinfo").innerHTML += "<br>External Company Detected.<br>Company: Syskor";
|
||||
}
|
||||
if (!booting) return;
|
||||
const boot = document.getElementById('bootText');
|
||||
|
||||
for (let i = 0; i < bootStrings.length; i++) {
|
||||
const line = document.createElement('div');
|
||||
line.className = 'boot-line';
|
||||
line.textContent = bootStrings[i];
|
||||
boot.appendChild(line);
|
||||
await new Promise(resolve => { setTimeout(resolve, Math.random() * 1000 + 500) });
|
||||
if (bootStrings[i] === "System ready." && !inBios) {
|
||||
if (!inBios) {
|
||||
booting = false;
|
||||
boot.parentElement.classList.add('fadeout');
|
||||
await new Promise(resolve => { setTimeout(resolve, 1000) });
|
||||
boot.parentElement.remove();
|
||||
document.getElementById("BIOS").remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("mneform").addEventListener("submit", (e) => {
|
||||
e.preventDefault();
|
||||
// document.getElementById("mnesubmit").addEventListener("click", () => {
|
||||
const text = document.getElementById("mnesender").value;
|
||||
if (text.length === 0) return;
|
||||
document.getElementById("mnesender").value = "";
|
||||
if (document.getElementById("mnetext").innerHTML.length !== 0) document.getElementById("mnetext").innerHTML += '<br>'
|
||||
document.getElementById('mnetext').innerText += `${text}`
|
||||
window.electronAPI.send(text);
|
||||
document.getElementById("mnetext").scrollTop = document.getElementById("mnetext").scrollHeight;
|
||||
})
|
||||
|
||||
boot()
|
||||
|
||||
const openWindow = (window) => {
|
||||
const win = document.getElementById(window);
|
||||
win.style.display = 'block';
|
||||
}
|
||||
|
||||
const closeWindow = (window) => {
|
||||
const win = document.getElementById(window);
|
||||
win.style.display = 'none';
|
||||
}
|
||||
|
||||
const exit = () => {
|
||||
window.close();
|
||||
}
|
||||
|
||||
for (const element of document.getElementsByClassName("app")) {
|
||||
dragElement(element, true);
|
||||
}
|
||||
|
||||
for (const element of document.getElementsByClassName("icon")) {
|
||||
dragElement(element, false);
|
||||
}
|
||||
|
||||
function dragElement(elmnt, isWindow) {
|
||||
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
|
||||
if (isWindow) {
|
||||
elmnt.children[0].onmousedown = dragMouseDown;
|
||||
} else {
|
||||
elmnt.onmousedown = dragMouseDown;
|
||||
}
|
||||
function dragMouseDown(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
elmnt.style.width = `${elmnt.offsetWidth}px`;
|
||||
elmnt.style.height = `${elmnt.offsetHeight}px`;
|
||||
document.onmouseup = closeDragElement;
|
||||
document.onmousemove = elementDrag;
|
||||
}
|
||||
|
||||
function elementDrag(e) {
|
||||
e = e || window.event;
|
||||
e.preventDefault();
|
||||
pos1 = pos3 - e.clientX;
|
||||
pos2 = pos4 - e.clientY;
|
||||
pos3 = e.clientX;
|
||||
pos4 = e.clientY;
|
||||
elmnt.style.position = "absolute";
|
||||
elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
|
||||
elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
|
||||
}
|
||||
|
||||
function closeDragElement() {
|
||||
document.onmouseup = null;
|
||||
document.onmousemove = null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue