add windowgen

This commit is contained in:
PossiblyAxolotl 2024-08-15 18:13:37 -06:00
parent c2474346b4
commit b02fc4ecae
3 changed files with 35 additions and 10 deletions

24
apps/windowgen.html Normal file
View file

@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form id="form">
<input id="url" type="url" placeholder="url">
<input id="titl" type="text" placeholder="title">
<input id="wid" type="number" placeholder="width">
<input id="hei" type="number" placeholder="height">
<input type="submit">
</form>
<script>
document.getElementById("form").addEventListener("submit", event => {
event.preventDefault()
window.top.postMessage(`WIN|${document.getElementById("url").value}|${document.getElementById("titl").value}|${document.getElementById("wid").value}|${document.getElementById("hei").value}`)
})
</script>
</body>
</html>

18
drag.js
View file

@ -133,12 +133,12 @@ function createWindow(url, title, width, height) {
document.body.appendChild(win);
}
/*
<div class="window">
<div class="header drag">
<p>Slimekoban</p>
<button onclick="this.parentNode.parentNode.remove()">x</button>
</div>
<iframe class="content" src="https://www.possiblyaxolotl.com" width="800px" height="500px"></iframe>
</div>
*/
/* SUBWINDOW CREATE WINDOW */
window.onmessage = function(e) {
const dat = e.data.split("|");
console.log(dat)
if (dat[0] == "WIN") {
createWindow(dat[1],dat[2],dat[3]+"px",dat[4]+"px")
}
}

View file

@ -9,7 +9,7 @@
<link rel="stylesheet" href="style.css?v=1">
<script src="drag.js?v=1" defer></script>
<script src="drag.js?v=2" defer></script>
</head>
<body>
<div class="body">
@ -28,6 +28,7 @@
<button onclick="createWindow('https://ko-fi.com/possiblyaxolotl/?hidefeed=true&widget=true&embed=true&preview=true', 'donate', '400px', '630px')">support</button>
<button onclick="createWindow('apps/slimekoban.html', 'slimekoban', '450px', '350px')">slimekoban</button>
<button onclick="createWindow('apps/info.html', 'info', '200px', '120px')">info</button>
<button onclick="createWindow('apps/windowgen.html', 'windowgen', '180px', '130px')">windowgen</button>
<p><a href="https://directory.possiblyaxolotl.com">PossiblyAxolotl Directory</a></p>
</div>