minor ahh update

This commit is contained in:
lda committed 2024-07-21 19:08:31 +07:00
1 parent b0e4a8c496
commit 88d4ce7320
8 files changed
+1250 -463

No files matched your search

+81 -49
View File
@@ -5,59 +5,91 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>lđa testing</title>
<link type="text/css" rel="stylesheet" href="./style.css" />
<!-- huh? what? -->
<script type="module" src="./script.js" defer></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css">
<!-- real -->
</head>
<body>
<form action="/endp" method="post" id="only_form">
<style>
@scope {
*:not(style, script) {
display: block;
}
p {
font-size: larger;
}
}
</style>
<label for="oneid">url (anything after the first /):<input type="text" name="one" id="oneid"
placeholder="url" /></label>
<label for="twoid">content (as html cuz mime my ass):<textarea rows="7" cols="40" name="two" id="twoid"
placeholder="content"></textarea>
</label>
<label for="threeid">response code if path visited. Default 200<input type="number" name="three" id="threeid"
placeholder="http res code" min="0" /></label>
<label for="fourid">expiration time for anything (todo idk how to do )<input type="number" name="four"
id="fourid" placeholder="expiration in days" min="0" /></label>
<header>
<h1>front end design:</h1>
</header>
<nav>
<ul>
<li>
<a>about</a>
</li>
<li>
<a href="#oneid">view</a>
</li>
<li>
<a href="">read</a>
</li>
<li>
<a>write</a>
</li>
</ul>
</nav>
<main>
<div class="box">
<form action="./endp" method="post" id="only_form" enctype="text/plain">
<label for="oneid">url (no space please thanks)
<div style=>
<a id="woah" style="text-align: right; min-width: 240px;
"></a>
<input style="display: inline;" required type="text" name="one" id="oneid" placeholder="url"
maxlength="15" pattern="\S+" />
</div>
</label>
<label for="the_Textarea">content (idk how it works anymore):
<div class="setting-buttons">
<!-- <input type="button" id="viewTextarea" value="show textarea" /> -->
<input type="button" id="viewDiv" value="show rendered" />
<input type="button" value="markdown to html" id="translateMD">
<input type="checkbox" id="auto_translate">
</div>
</label>
<div>
<textarea class="why" name="two" id="the_Textarea" placeholder="what"></textarea>
<!-- <div class="why" name="two" id="the_div" placeholder="type in here"></div> -->
</div>
<label for="threeid">response code if path visited. Default 200<input type="number" name="three"
id="threeid" placeholder="http res code" min="0" pattern="\d*" /></label>
<label for="fourid">expiration time for anything (todo idk how to do )<input type="number" name="four"
id="fourid" placeholder="expiration in days" min="0" pattern="\d*" /></label>
<p>leave empty for none / default</p>
<input type="submit" value="Sumit rn" />
</form>
<div>
<p>html from markdown:</p>
<div class="why" name="two" id="the_div" placeholder="press the translate button"></div>
<div id="errorfrommd"></div>
</div>
</div>
<p>if bugs tell me how to solve cuz im bad</p>
<input type="submit" value="Sumit rn" />
<script>
const form = document.getElementById("only_form");
// const what = form.querySelector("input[type=submit]");
console.log(form);
form.addEventListener("submit", (e) => {
// somewhere there has been code
e.preventDefault();
const data = new FormData(form);
const jsData = Object.fromEntries(data);
Object.entries(jsData).forEach(
([k, v]) => (jsData[k] = v ? v : undefined)
); // important here as we are dealing with Strings true/false kinda works how it is.
const jsonified_data = JSON.stringify(jsData);
const jsonified_custom_data = `{"from":"ldlda","data":${jsonified_data}}`; // haxxor
const xhr = new XMLHttpRequest(); // this is going to be used. a lot.
xhr.open("POST", form.getAttribute("action"));
xhr.setRequestHeader("Content-type", "application/json");
xhr.send(jsonified_custom_data);
xhr.addEventListener(
"load",
(_) => (document.getElementById("what").innerText = xhr.response)
);
return false;
});
</script>
</form>
<div id="what"></div>
<div hidden>
<p>what post got (sensitive):</p>
<div id="what"></div>
</div>
<div hidden class="table">
what is present:
<table id="tbale">
<thead>
<th>no.</th>
<th>url</th>
<th>it is a</th>
<th>exp time</th>
</thead>
<tbody id="updatedget"></tbody>
</table>
</div>
</main>
<footer>
<h1>by <a href="//ldlda.com">lđa</a></h1>
<p>very fragile</p>
</footer>
</body>
</html>