Added the url page and changed the title to an anchor tag

This commit is contained in:
xemeds
2020-07-20 14:09:03 +00:00
parent 0db137daf5
commit 2de586b87b
5 changed files with 81 additions and 50 deletions
+42 -41
View File
@@ -3,58 +3,59 @@
{% block body %}
{% if form.url.errors %}
<body>
<div class="header">
<h1 class="title">tiny0</h1>
<div class="headers">
<a class="title" href="{{ url_for('index') }}">tiny0</a>
<h1 class="desc">Custom URL Shortener</h1>
</div>
{% else %}
<body onload="typeTitle()">
<div class="header">
<h1 id="title" class="title"></h1>
<div class="headers">
<a class="title" id="title" href="{{ url_for('index') }}"></a>
<h1 id="desc" class="desc"></h1>
</div>
{% endif %}
<div class="container">
<form method="POST" action="">
{{ form.hidden_tag() }}
<div class="inputs">
{{ form.url(placeholder="Enter the URL here", class="url") }}
{{ form.submit(class="button") }}
</div>
</form>
{% if form.url.errors %}
{% for error in form.url.errors %}
<p class="error-message">{{ error }}</p>
{% endfor %}
{% endif %}
</div>
<div class="container">
<form method="POST" action="">
{{ form.hidden_tag() }}
<div class="inputs">
{{ form.url(placeholder="Enter the URL here", class="url") }}
{{ form.submit(class="submit") }}
</div>
</form>
{% if form.url.errors %}
{% for error in form.url.errors %}
<p class="error-message">{{ error }}</p>
{% endfor %}
{% endif %}
</div>
{% if not form.url.errors %}
<script>
var i = 0;
var title_text = "tiny0";
var desc_text = "Custom URL Shortener";
var speed = 120;
<script>
var i = 0;
var title_text = "tiny0";
var desc_text = "Custom URL Shortener";
var speed = 120;
function typeTitle() {
if (i < title_text.length) {
document.getElementById("title").innerHTML += title_text.charAt(i);
i++;
setTimeout(typeTitle, speed);
function typeTitle() {
if (i < title_text.length) {
document.getElementById("title").innerHTML += title_text.charAt(i);
i++;
setTimeout(typeTitle, speed);
}
else {
i = 0;
setTimeout(typeDesc, 200)
}
}
else {
i = 0;
setTimeout(typeDesc, 200)
}
}
function typeDesc() {
if (i < desc_text.length) {
document.getElementById("desc").innerHTML += desc_text.charAt(i);
i++;
setTimeout(typeDesc, speed);
function typeDesc() {
if (i < desc_text.length) {
document.getElementById("desc").innerHTML += desc_text.charAt(i);
i++;
setTimeout(typeDesc, speed);
}
}
}
</script>
</script>
{% endif %}
</body>
{% endblock %}