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
+1 -1
View File
@@ -12,7 +12,7 @@ def index():
# If the form was valid # If the form was valid
if form.validate_on_submit(): if form.validate_on_submit():
return "Valid URL: " + form.url.data return render_template("url.html", url=form.url.data)
# If the form was invalid or not submitted # If the form was invalid or not submitted
else: else:
+11 -5
View File
@@ -9,7 +9,7 @@ body {
} }
.header { .headers {
position: absolute; position: absolute;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
@@ -19,9 +19,15 @@ body {
text-align: center; text-align: center;
} }
.title { .title:link {
color: #ffffff; color: #bb86fc;
text-decoration: none;
font-size: 50px; font-size: 50px;
font-weight: bold;
}
.title:hover {
color: #7b59a5;
} }
.desc { .desc {
@@ -61,7 +67,7 @@ body {
border-color: #7b59a5; border-color: #7b59a5;
} }
.submit { .button {
background: #bb86fc; background: #bb86fc;
border: 2px solid #bb86fc; border: 2px solid #bb86fc;
border-radius: 3px; border-radius: 3px;
@@ -71,7 +77,7 @@ body {
margin: 0 3% 0 1%; margin: 0 3% 0 1%;
} }
.submit:hover { .button:hover {
background: #7b59a5; background: #7b59a5;
border-color: #7b59a5; border-color: #7b59a5;
} }
+7 -6
View File
@@ -3,24 +3,23 @@
{% block body %} {% block body %}
{% if form.url.errors %} {% if form.url.errors %}
<body> <body>
<div class="header"> <div class="headers">
<h1 class="title">tiny0</h1> <a class="title" href="{{ url_for('index') }}">tiny0</a>
<h1 class="desc">Custom URL Shortener</h1> <h1 class="desc">Custom URL Shortener</h1>
</div> </div>
{% else %} {% else %}
<body onload="typeTitle()"> <body onload="typeTitle()">
<div class="header"> <div class="headers">
<h1 id="title" class="title"></h1> <a class="title" id="title" href="{{ url_for('index') }}"></a>
<h1 id="desc" class="desc"></h1> <h1 id="desc" class="desc"></h1>
</div> </div>
{% endif %} {% endif %}
<div class="container"> <div class="container">
<form method="POST" action=""> <form method="POST" action="">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
<div class="inputs"> <div class="inputs">
{{ form.url(placeholder="Enter the URL here", class="url") }} {{ form.url(placeholder="Enter the URL here", class="url") }}
{{ form.submit(class="submit") }} {{ form.submit(class="button") }}
</div> </div>
</form> </form>
{% if form.url.errors %} {% if form.url.errors %}
@@ -30,6 +29,7 @@
{% endif %} {% endif %}
</div> </div>
{% if not form.url.errors %}
<script> <script>
var i = 0; var i = 0;
var title_text = "tiny0"; var title_text = "tiny0";
@@ -56,5 +56,6 @@
} }
} }
</script> </script>
{% endif %}
</body> </body>
{% endblock %} {% endblock %}
-2
View File
@@ -11,9 +11,7 @@
<div id="page-container"> <div id="page-container">
<div id="content-wrap"> <div id="content-wrap">
{% block body %}{% endblock %} {% block body %}{% endblock %}
</div> </div>
</div> </div>
+26
View File
@@ -0,0 +1,26 @@
{% extends "layout.html" %}
{% block body %}
<body>
<div class="headers">
<a class="title" href="{{ url_for('index') }}">tiny0</a>
<h1 class="desc">Custom URL Shortener</h1>
</div>
<div class="container">
<div class="inputs">
<input type="text" value="{{ url }}" id="url" class="url" readonly>
<button onclick="copyURL()" class="button">Copy</button>
</div>
</div>
<script>
function copyURL() {
var url = document.getElementById("url");
url.select();
url.setSelectionRange(0, 99999)
document.execCommand("copy");
}
</script>
</body>
{% endblock %}