Use template system to create similar style

This commit is contained in:
Florine W. Dekker 2021-04-18 18:55:00 +02:00
parent b8ebe18992
commit 1291a07777
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
1 changed files with 58 additions and 81 deletions

139
index.php
View File

@ -39,91 +39,68 @@ if ($target != null && !$needs_confirmation) {
<title>FWDekker</title>
<link href="https://static.fwdekker.com/fonts/roboto.css" rel="stylesheet">
<style>
* {
font-family: "Roboto", sans-serif;
}
a:link, a:visited, a:hover, a:active {
color: black;
}
html, body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
main {
display: flex;
flex-direction: column;
margin: 0 auto;
width: 50%;
min-width: 400px;
min-height: 100%;
}
#contents {
flex: 1;
margin: 5rem 0;
}
footer {
color: #606c76;
margin-bottom: 3rem;
}
</style>
<link rel="stylesheet" href="https://static.fwdekker.com/lib/template/1.x.x/bundle.css" crossorigin="anonymous" />
</head>
<body>
<main>
<section id="contents">
<h1><a href="https://fwdekker.com/">FWDekker</a></h1>
<?php
if ($error) {
?>
<b>Internal server error</b><br /><br />
Something went wrong internally, and you could not be redirected. Please try again later.<br /><br />
<br /><br />
<?php
} else if ($target == "/") {
?>
<b>Link not found</b><br /><br />
The short URL https://fwdkr.co<?= $path ?> could not be found.<br /><br />
<br /><br />
<?php
}
<main> <!-- Do not hide without JavaScript -->
<div id="nav"></div>
<div id="contents">
<div id="header"></div>
if ($target != null && $needs_confirmation) {
?>
<b>Confirm redirect</b><br /><br />
This URL redirects to <b><?= $target ?></b>.<br /><br />
<a href="<?= $target ?>">Click here to proceed</a>
<br /><br />
<section class="container">
<?php
} else {
?>
<b>About fwdkr.co</b><br /><br />
You've arrived at this page because you typed or linked to "fwdkr.co", the URL shortcut for
<a href="https://fwdekker.com/">fwdekker.com</a>.<br /><br />
if ($error) {
?>
<h3>Internal server error</h3>
<p>Something went wrong internally, and you could not be redirected. Please try again later.</p>
<?php
} else if ($target != null && $needs_confirmation) {
?>
<h3>Confirm redirect</h3>
<p>This URL redirects to <b><?= $target ?></b>.</p>
Whenever you see a "fwdkr.co" link, you can trust that it will always take you to a website affiliated with
FWDekker.
<?php
}
?>
</section>
<footer>
Made by <a href="https://fwdekker.com/">Felix W. Dekker</a><span>.
Licensed under the
<a href="https://git.fwdekker.com/FWDekker/fwdkr.co/src/branch/master/LICENSE">MIT License</a>.
Source code available on </span><a href="https://git.fwdekker.com/FWDekker/fwdkr.co/">git</a>.
Consider reading the <a href="https://fwdekker.com/privacy/">privacy policy</a>.
<div style="float: right;">v1.1.0</div>
</footer>
<p><a href="<?= $target ?>">Click here to proceed</a></p>
<?php
} else {
if ($path != "/") {
?>
<h3>Link not found</h3>
<p>The short URL <b>https://fwdkr.co<?= $path ?></b> could not be found.</p>
<?php
}
?>
<h3>About fwdkr.co</h3>
<p>
You've arrived at this page because you typed or linked to "fwdkr.co", the URL shortcut for
<a href="https://fwdekker.com/">fwdekker.com</a>.
</p>
<p>
Whenever you see a "fwdkr.co" link, you can trust that it will always take you to a website
affiliated with FWDekker.
</p>
<?php
}
?>
</section>
</div>
<div id="footer"></div>
</main>
<script src="https://static.fwdekker.com/lib/template/1.x.x/bundle.js" crossorigin="anonymous"></script>
<script>
// noinspection JSUnresolvedVariable
const {$, doAfterLoad, footer, header, nav, showPage, stringToHtml} = window.fwdekker;
doAfterLoad(() => {
$("#nav").appendChild(nav());
$("#header").appendChild(header({title: "fwdkr.co"}));
$("#footer").appendChild(footer({
vcsURL: "https://git.fwdekker.com/FWDekker/fwdkr.co/",
version: "v1.2.0"
}));
showPage();
});
</script>
</body>