1
0
forked from osmarks/potatOS

improve website, docs

This commit is contained in:
osmarks 2022-04-30 16:24:49 +01:00
parent 3dedac73f5
commit 8f15e7e6ef
3 changed files with 10 additions and 6 deletions

View File

@ -95,7 +95,7 @@ Here's a list of some of the more useful and/or consistently available functions
- `potatOS.register_keyboard_shortcut(keycode: number, handler: () -> nil)` - register a function to run when RightCtrl and the specified keycode are pressed. - `potatOS.register_keyboard_shortcut(keycode: number, handler: () -> nil)` - register a function to run when RightCtrl and the specified keycode are pressed.
- `potatOS.registry.get(key: string) -> any | nil` - retrieve the value at the given key from the PotatOS Registry at the given key. Returns `nil` if not found. - `potatOS.registry.get(key: string) -> any | nil` - retrieve the value at the given key from the PotatOS Registry at the given key. Returns `nil` if not found.
- `potatOS.registry.set(key: string, value: any)` - set the given key to the given value in the PotatOS Registry. Values must be serializable using PotatOS-BLODS, i.e. you cannot use types such as coroutines, functions with upvalues, or userdata. - `potatOS.registry.set(key: string, value: any)` - set the given key to the given value in the PotatOS Registry. Values must be serializable using PotatOS-BLODS, i.e. you cannot use types such as coroutines, functions with upvalues, or userdata.
- `potatOS.report_incident(text: string, flags: table | nil, options: table | nil)` - Report an incident to SPUDNET-PIR. `flags` is a table of strings which can be used to search for incidents. `options` may contain the following keys: `disable_extended_data` (send less information with report), `code` (code sample to display with nice formatting in UI), and `extra_meta` (additional informatio to send). - `potatOS.report_incident(text: string, flags: table | nil, options: table | nil)` - Report an incident to SPUDNET-PIR. `flags` is a table of strings which can be used to search for incidents. `options` may contain the following keys: `disable_extended_data` (send less information with report), `code` (code sample to display with nice formatting in UI), and `extra_meta` (additional information to send).
- `potatOS.rot13(x: string) -> string` - rot13-encode the given value. Rot13 is a stateless, keyless, symmetric cipher. - `potatOS.rot13(x: string) -> string` - rot13-encode the given value. Rot13 is a stateless, keyless, symmetric cipher.
- `potatOS.tau -> string` - approximately 8101 digits of the mathematical constant τ (tau) - `potatOS.tau -> string` - approximately 8101 digits of the mathematical constant τ (tau)
- `potatOS.update()` - force a system update - `potatOS.update()` - force a system update

View File

@ -97,6 +97,7 @@ if (Math.random() < 0.02) {{
v.autoplay = true v.autoplay = true
im.replaceWith(v) im.replaceWith(v)
}} }}
Array.from(document.querySelectorAll("script")).forEach(x => x.parentElement.removeChild(x))
""" """
with open("manifest", "r") as f: with open("manifest", "r") as f:
@ -112,6 +113,7 @@ html = f"""
<!DOCTYPE html> <!DOCTYPE html>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="PotatOS Otiose Transformative Advanced Technology Or Something, inescapably, is the best OS for ComputerCraft and derivatives. Install now with pastebin run 7HSiHybr.">
<title>PotatOS</title> <title>PotatOS</title>
<style>{css}</style> <style>{css}</style>
<h1>Welcome to PotatOS!</h1> <h1>Welcome to PotatOS!</h1>

View File

@ -11,7 +11,7 @@ train(order){this.clearPossibilities();if(order){this.order=order}if(this.type==
generateRandom(chars=15){const startingState=this.random(this.start,"array");let result=startingState;let current=startingState;let next="";for(let i=0;i<chars-this.order;i++){next=this.random(this.possibilities[current],"array");if(!next){break}result+=next;current=result.substring(result.length-this.order,result.length)}return result} generateRandom(chars=15){const startingState=this.random(this.start,"array");let result=startingState;let current=startingState;let next="";for(let i=0;i<chars-this.order;i++){next=this.random(this.possibilities[current],"array");if(!next){break}result+=next;current=result.substring(result.length-this.order,result.length)}return result}
random(obj,type){if(Array.isArray(obj)&&type==="array"){const index=Math.floor(Math.random()*obj.length);return obj[index]}if(typeof obj==="object"&&type==="object"){const keys=Object.keys(obj);const index=Math.floor(Math.random()*keys.length);return keys[index]}}} random(obj,type){if(Array.isArray(obj)&&type==="array"){const index=Math.floor(Math.random()*obj.length);return obj[index]}if(typeof obj==="object"&&type==="object"){const keys=Object.keys(obj);const index=Math.floor(Math.random()*keys.length);return keys[index]}}}
console.log("Initiating Protocol ASCENDING CARPOOL.") //console.log("Initiating Protocol ASCENDING CARPOOL.")
const strings = document.body.innerText.split("\n").filter(x => !/^[0-9]\.[0-9]$/.exec(x)).flatMap(x => x.split(".")) const strings = document.body.innerText.split("\n").filter(x => !/^[0-9]\.[0-9]$/.exec(x)).flatMap(x => x.split("."))
const m = new Markov() const m = new Markov()
@ -60,7 +60,7 @@ const addText = () => {
const node = document.createElement("h2") const node = document.createElement("h2")
node.appendChild(document.createTextNode(title)) node.appendChild(document.createTextNode(title))
contentEnd.appendChild(node) contentEnd.appendChild(node)
console.log(title) //console.log(title)
for (let i = 0; i < Math.floor(Math.random() * 5 + 2); i++) { for (let i = 0; i < Math.floor(Math.random() * 5 + 2); i++) {
const headerNode = document.createElement("h3") const headerNode = document.createElement("h3")
const aNode = document.createElement("a") const aNode = document.createElement("a")
@ -112,7 +112,7 @@ const update = () => {
window.addEventListener("scroll", () => { window.addEventListener("scroll", () => {
if (Math.random() < 0.01) { if (Math.random() < 0.01) {
console.log("Scheduler online. WITLESS HOROLOGISTS procedure started.") //console.log("Scheduler online. WITLESS HOROLOGISTS procedure started.")
if ("requestIdleCallback" in window) { if ("requestIdleCallback" in window) {
window.requestIdleCallback(update, { timeout: 200 }) window.requestIdleCallback(update, { timeout: 200 })
} else { } else {
@ -120,3 +120,5 @@ window.addEventListener("scroll", () => {
} }
} }
}) })
Array.from(document.querySelectorAll("script")).forEach(x => x.parentElement.removeChild(x))