Add bad coders webring, update kumaos.
This commit is contained in:
parent
770369c84b
commit
dc0b9b14cb
17 changed files with 401 additions and 155 deletions
29
static/kumos/apps/apps.mjs
Normal file
29
static/kumos/apps/apps.mjs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { Application, Window, promoteWindow, registerApplication, getScreenRoot, getApplications } from "../kernel.mjs";
|
||||
|
||||
const app = new Application('apps', (p) => {
|
||||
const w = new Window(p);
|
||||
w.setTitle("App list");
|
||||
w.content.style.padding = "1rem";
|
||||
|
||||
const list = document.createElement("ul");
|
||||
getApplications().forEach(app => {
|
||||
const item = document.createElement("li");
|
||||
const link = document.createElement("a");
|
||||
link.innerText = app.name;
|
||||
link.addEventListener('click', () => app.bootstrap());
|
||||
item.appendChild(link);
|
||||
list.appendChild(item);
|
||||
})
|
||||
|
||||
w.content.appendChild(list);
|
||||
|
||||
w.close.addEventListener('click', () => {
|
||||
p.detach();
|
||||
w.destroy();
|
||||
});
|
||||
|
||||
getScreenRoot().appendChild(w.window);
|
||||
promoteWindow(w);
|
||||
})
|
||||
|
||||
export default app;
|
||||
32
static/kumos/apps/browser.mjs
Normal file
32
static/kumos/apps/browser.mjs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { Application, Window, promoteWindow, registerApplication, getScreenRoot } from "../kernel.mjs";
|
||||
|
||||
const app = new Application('browser', (p) => {
|
||||
const w = new Window(p);
|
||||
w.setTitle("Web browser");
|
||||
const iframe = document.createElement("iframe");
|
||||
iframe.src = "https://adrianvic.github.io";
|
||||
iframe.style.height = "100%";
|
||||
const searchBar = document.createElement("div");
|
||||
searchBar.style.display = "flex";
|
||||
const search = document.createElement("input");
|
||||
search.style.width = "100%";
|
||||
const searchButton = document.createElement("button");
|
||||
searchBar.appendChild(search);
|
||||
searchBar.appendChild(searchButton);
|
||||
search.type = "text";
|
||||
iframe.addEventListener('load', () => search.value = iframe.src);
|
||||
searchButton.innerText = "go";
|
||||
searchButton.addEventListener('click', () => iframe.src = search.value);
|
||||
w.content.appendChild(searchBar);
|
||||
w.content.appendChild(iframe);
|
||||
|
||||
getScreenRoot().appendChild(w.window);
|
||||
promoteWindow(w);
|
||||
|
||||
w.close.addEventListener('click', () => {
|
||||
p.detach();
|
||||
w.destroy();
|
||||
})
|
||||
})
|
||||
|
||||
export default app;
|
||||
38
static/kumos/apps/guestbook.mjs
Normal file
38
static/kumos/apps/guestbook.mjs
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import { Application, Window, promoteWindow, registerApplication, getScreenRoot, getProcList } from "../kernel.mjs";
|
||||
import { notify } from "../system/shell.mjs";
|
||||
|
||||
function draw(p) {
|
||||
const w = new Window(p);
|
||||
w.setTitle("Guestbook");
|
||||
w.content.innerHTML = `
|
||||
<script src="https://iframe.chat/scripts/main.min.js"></script>
|
||||
<iframe class="windowContent" src="https://iframe.chat/embed?chat=17048300" id="chattable"></iframe>
|
||||
<script>chattable.initialize({ theme: "moderno" });</script>
|
||||
`
|
||||
|
||||
getScreenRoot().appendChild(w.window);
|
||||
promoteWindow(w);
|
||||
|
||||
w.close.addEventListener('click', () => {
|
||||
p.detach();
|
||||
w.destroy();
|
||||
})
|
||||
}
|
||||
|
||||
function main(p) {
|
||||
let running = false;
|
||||
getProcList().forEach(proc => {
|
||||
if (proc.name == 'guestbook' && proc != p) {
|
||||
notify("Guestbook", "Guestbook is already running!")
|
||||
p.detach();
|
||||
running = true;
|
||||
}
|
||||
})
|
||||
|
||||
if (!running) {
|
||||
draw(p);
|
||||
}
|
||||
}
|
||||
|
||||
const app = new Application('guestbook', main);
|
||||
export default app;
|
||||
5
static/kumos/apps/pkg.mjs
Normal file
5
static/kumos/apps/pkg.mjs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import "./apps.mjs";
|
||||
import "./browser.mjs";
|
||||
import "./guestbook.mjs";
|
||||
import "./taskmanager.mjs";
|
||||
import "./shell.mjs";
|
||||
61
static/kumos/apps/shell.mjs
Normal file
61
static/kumos/apps/shell.mjs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
import { Application, Window, getScreenRoot, bus, promoteWindow } from "../kernel.mjs";
|
||||
|
||||
function draw(p) {
|
||||
const w = new Window(p);
|
||||
w.setTitle("Shell");
|
||||
w.content.style.display = "flex";
|
||||
w.content.style.flexDirection = "column";
|
||||
|
||||
const textarea = document.createElement("textarea");
|
||||
textarea.style.width = "100%";
|
||||
textarea.style.height = "100%";
|
||||
bus.addEventListener("system-console", (e) => {
|
||||
textarea.value += e.detail
|
||||
.map(arg => typeof arg === "object" ? JSON.stringify(arg) : String(arg))
|
||||
.join(" ")
|
||||
+ "\n";
|
||||
})
|
||||
|
||||
const div = document.createElement("div");
|
||||
div.style.width = "100%";
|
||||
div.style.display = "flex";
|
||||
|
||||
const input = document.createElement("input");
|
||||
input.style.width = "100%";
|
||||
|
||||
const button = document.createElement("button");
|
||||
button.textContent = "go";
|
||||
button.addEventListener('click', () => {
|
||||
eval(input.value);
|
||||
});
|
||||
|
||||
div.appendChild(input);
|
||||
div.appendChild(button);
|
||||
|
||||
w.content.appendChild(textarea);
|
||||
w.content.appendChild(div);
|
||||
getScreenRoot().appendChild(w.window);
|
||||
w.maximize();
|
||||
|
||||
function title(title) {
|
||||
w.setTitle(title);
|
||||
}
|
||||
|
||||
function exit() {
|
||||
p.detach();
|
||||
w.destroy();
|
||||
}
|
||||
|
||||
w.close.addEventListener('click', () => {
|
||||
exit();
|
||||
})
|
||||
|
||||
promoteWindow(w);
|
||||
}
|
||||
|
||||
function main(p) {
|
||||
draw(p);
|
||||
}
|
||||
|
||||
const app = new Application('shell', main);
|
||||
export default app;
|
||||
34
static/kumos/apps/taskmanager.mjs
Normal file
34
static/kumos/apps/taskmanager.mjs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { Application, Window, promoteWindow, getScreenRoot, getProcList } from "../kernel.mjs";
|
||||
|
||||
const app = new Application('task', (p) => {
|
||||
function update() {
|
||||
w.content.innerHTML = ``;
|
||||
const list = document.createElement("ul");
|
||||
getProcList().forEach(proc => {
|
||||
const item = document.createElement("li");
|
||||
const link = document.createElement("a");
|
||||
link.innerText = `${proc.pid} -> ${proc.parent.length === 0 ? `` : proc.parent} ${proc.name}`;
|
||||
item.appendChild(link);
|
||||
list.appendChild(item);
|
||||
})
|
||||
|
||||
w.content.appendChild(list);
|
||||
}
|
||||
|
||||
const w = new Window();
|
||||
w.setTitle("Task Manager");
|
||||
w.content.style.padding = "1rem";
|
||||
|
||||
const task = setInterval(update, 100);
|
||||
|
||||
w.close.addEventListener('click', () => {
|
||||
clearInterval(task);
|
||||
p.detach();
|
||||
w.destroy();
|
||||
});
|
||||
|
||||
getScreenRoot().appendChild(w.window);
|
||||
promoteWindow(w);
|
||||
})
|
||||
|
||||
export default app;
|
||||
Loading…
Reference in a new issue