Create Base Template

This commit is contained in:
spikecodes 2020-11-22 16:29:05 -08:00
parent 215af3b75f
commit 7e79a0b712
7 changed files with 276 additions and 280 deletions

View file

@ -22,6 +22,10 @@ header {
font-size: 20px; font-size: 20px;
} }
#lib, #github {
color: white;
}
main { main {
max-width: 750px; max-width: 750px;
margin: 0 auto; margin: 0 auto;
@ -83,6 +87,10 @@ span {
padding: 20px; padding: 20px;
} }
#stats {
margin-top: 10px;
}
/* User */ /* User */
.user { .user {
@ -124,6 +132,11 @@ span {
cursor: pointer; cursor: pointer;
} }
#sort > div.selected {
background: aqua;
color: black;
}
#sort > div:hover { #sort > div:hover {
background: #222; background: #222;
} }
@ -136,6 +149,15 @@ span {
display: flex; display: flex;
} }
.post.highlighted {
border: 2px solid #555;
background: #222;
}
.post.highlighted > .post_left {
background: #333;
}
.post:hover { .post:hover {
background: #222; background: #222;
} }
@ -158,6 +180,10 @@ span {
padding: 5px; padding: 5px;
} }
.post_right > p > span, .comment_right > p > span {
float: right;
}
.post_title { .post_title {
font-size: 20px; font-size: 20px;
} }

34
templates/base.html Normal file
View file

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<title>{% block title %}{% endblock %}</title>
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit.">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="/style.css">
{% block sortstyle %}
<style>
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
{% endblock %}
{% endblock %}
</head>
<body>
{% block body %}
{% block header %}
<header>
<a href="/"><span id="lib">lib</span>reddit.</a>
<a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
{% endblock %}
<main>
{% block content %}
{% endblock %}
</main>
{% endblock %}
</body>
</html>

View file

@ -1,18 +1,6 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en"> {% block title %}Error: {{ message }}{% endblock %}
<head> {% block sortstyle %}{% endblock %}
<title>Error loading page.</title> {% block content %}
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit."> <h1 style="text-align: center; font-size: 50px;">{{ message }}</h1>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> {% endblock %}
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header>
<a href="/"><span style="color:white">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
<main>
<h1 style="text-align: center; font-size: 50px;">{{ message }}</h1>
</main>
</body>
</html>

View file

@ -1,62 +1,44 @@
<html> {% extends "base.html" %}
<head> {% block title %}Libreddit{% endblock %}
<title>Libreddit</title> {% block content %}
<meta name="description" content="Alternative private front-end to Reddit"> <div id="sort">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <div id="sort_hot"><a href="?sort=hot">Hot</a></div>
<link rel="stylesheet" href="/style.css"> <div id="sort_top"><a href="?sort=top">Top</a></div>
<style> <div id="sort_new"><a href="?sort=new">New</a></div>
#sort > #sort_{{ sort }} { </div>
background: aqua; {% for post in posts %}
color: black; <div class="post">
} <div class="post_left">
</style> <button class="post_upvote"></button>
</head> <h3 class="post_score">{{ post.score }}</h3>
<body> <button class="post_upvote"></button>
<header> </div>
<a href="/"><span style="color:white">lib</span>reddit.</a> <div class="post_right">
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a> <p>
</header> <b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a></b>
<main> &bull;
<div id="sort"> Posted by
<div id="sort_hot"><a href="?sort=hot">Hot</a></div> <a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<div id="sort_top"><a href="?sort=top">Top</a></div> <span style="float: right;">{{ post.time }}</span>
<div id="sort_new"><a href="?sort=new">New</a></div> </p>
</div> <h3 class="post_title">
{% for post in posts %} {% if post.flair.0 != "" %}
<div class="post"> <small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small>
<div class="post_left"> {% endif %}
<button class="post_upvote"></button> <a href="{{ post.url }}">{{ post.title }}</a>
<h3 class="post_score">{{ post.score }}</h3> </h3>
<button class="post_upvote"></button> </div>
</div> <img class="post_thumbnail" src="{{ post.media }}">
<div class="post_right"> </div><br>
<p> {% endfor %}
<b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a></b>
&bull;
Posted by
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<span style="float: right;">{{ post.time }}</span>
</p>
<h3 class="post_title">
{% if post.flair.0 != "" %}
<small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small>
{% endif %}
<a href="{{ post.url }}">{{ post.title }}</a>
</h3>
</div>
<img class="post_thumbnail" src="{{ post.media }}">
</div><br>
{% endfor %}
<footer> <footer>
{% if ends.0 != "" %} {% if ends.0 != "" %}
<a href="?before={{ ends.0 }}">PREV</a> <a href="?before={{ ends.0 }}">PREV</a>
{% endif %} {% endif %}
{% if ends.1 != "" %} {% if ends.1 != "" %}
<a href="?after={{ ends.1 }}">NEXT</a> <a href="?after={{ ends.1 }}">NEXT</a>
{% endif %} {% endif %}
</footer> </footer>
</main> {% endblock %}
</body>
</html>

View file

@ -1,70 +1,55 @@
<html> {% extends "base.html" %}
<head> {% block title %}{{ post.title }} - r/{{ post.community }}{% endblock %}
<title>{{ post.title }} - r/{{ post.community }}</title> {% block head %}
<meta name="author" content="u/{{ post.author }}"> {% call super() %}
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit."> <meta name="author" content="u/{{ post.author }}">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> {% endblock %}
<link rel="stylesheet" href="/style.css"> {% block content %}
<style> <div class="post highlighted">
#sort > #sort_{{ sort }} { <div class="post_left">
background: aqua; <button class="post_upvote"></button>
color: black; <h3 class="post_score">{{ post.score }}</h3>
} <button class="post_upvote"></button>
</style> </div>
</head> <div class="post_right">
<body> <p>
<header> <b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a></b>
<a href="/"><span style="color:white">lib</span>reddit.</a> &bull;
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a> Posted by
</header> <a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<main> <span>{{ post.time }}</span>
<div class="post" style="border: 2px solid #555;background: #222;"> </p>
<div class="post_left" style="background: #333;"> <h3 class="post_title">
<button class="post_upvote"></button> {{ post.title }}
<h3 class="post_score">{{ post.score }}</h3> {% if post.flair.0 != "" %}
<button class="post_upvote"></button> <small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small>
</div> {% endif %}
<div class="post_right"> </h3>
<p> {{ post.media }}
<b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a></b> <h4 class="post_body">{{ post.body }}</h4>
&bull; </div>
Posted by </div>
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a> <div id="sort">
<span style="float: right;">{{ post.time }}</span> <div id="sort_confidence"><a href="?sort=confidence">Best</a></div>
</p> <div id="sort_top"><a href="?sort=top">Top</a></div>
<h3 class="post_title"> <div id="sort_new"><a href="?sort=new">New</a></div>
{{ post.title }} <div id="sort_controversial"><a href="?sort=controversial">Controversial</a></div>
{% if post.flair.0 != "" %} <div id="sort_old"><a href="?sort=old">Old</a></div>
<small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small> </div>
{% endif %} {% for comment in comments %}
</h3> <div class="comment">
{{ post.media }} <div class="comment_left">
<h4 class="post_body">{{ post.body }}</h4> <button class="comment_upvote"></button>
</div> <h3 class="comment_score">{{ comment.score }}</h3>
</div> <button class="comment_upvote"></button>
<div id="sort"> </div>
<div id="sort_confidence"><a href="?sort=confidence">Best</a></div> <div class="comment_right">
<div id="sort_top"><a href="?sort=top">Top</a></div> <p>
<div id="sort_new"><a href="?sort=new">New</a></div> Posted by <a class="comment_author" href="/u/{{ comment.author }}">u/{{ comment.author }}</a>
<div id="sort_controversial"><a href="?sort=controversial">Controversial</a></div> <span>{{ comment.time }}</span>
<div id="sort_old"><a href="?sort=old">Old</a></div> </p>
</div> <h4 class="comment_body">{{ comment.body }}</h4>
{% for comment in comments %} </div>
<div class="comment"> </div><br>
<div class="comment_left"> {% endfor %}
<button class="comment_upvote"></button> {% endblock %}
<h3 class="comment_score">{{ comment.score }}</h3>
<button class="comment_upvote"></button>
</div>
<div class="comment_right">
<p>
Posted by <a class="comment_author" href="/u/{{ comment.author }}">u/{{ comment.author }}</a>
<span style="float: right;">{{ comment.time }}</span>
</p>
<h4 class="comment_body">{{ comment.body }}</h4>
</div>
</div><br>
{% endfor %}
</main>
</body>
</html>

View file

@ -1,73 +1,64 @@
<html> {% extends "base.html" %}
<head> {% block title %}r/{{ sub.name }}: {{ sub.description }}{% endblock %}
<title>r/{{ sub.name }}: {{ sub.description }}</title> {% block body %}
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit."> {% block header %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <header>
<link rel="stylesheet" href="/style.css"> <a href="/"><span id="lib">lib</span>reddit.</a>
<style> <a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
#sort > #sort_{{ sort }} { </header>
background: aqua; {% endblock %}
color: black; <div id="about">
} <div class="subreddit">
</style> <div class="subreddit_left">
</head> {{ sub.icon }}
<body> </div>
<header> <div class="subreddit_right">
<a href="/"><span style="color:white">lib</span>reddit.</a> <h2 class="subreddit_name">r/{{ sub.name }}</h2>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a> <p class="subreddit_description">{{ sub.description }}</p>
</header> <div id="stats">👤 {{ sub.members }} 🟢 {{ sub.active }}</div>
<div id="about">
<div class="subreddit">
<div class="subreddit_left">
{{ sub.icon }}
</div>
<div class="subreddit_right">
<h2 class="subreddit_name">r/{{ sub.name }}</h2>
<p class="subreddit_description">{{ sub.description }}</p>
</div>
</div> </div>
</div> </div>
<main> </div>
<div id="sort"> <main>
<div id="sort_hot"><a href="?sort=hot">Hot</a></div> <div id="sort">
<div id="sort_top"><a href="?sort=top">Top</a></div> <div id="sort_hot"><a href="?sort=hot">Hot</a></div>
<div id="sort_new"><a href="?sort=new">New</a></div> <div id="sort_top"><a href="?sort=top">Top</a></div>
<div id="sort_new"><a href="?sort=new">New</a></div>
</div>
{% for post in posts %}
<div class="post">
<div class="post_left">
<button class="post_upvote"></button>
<h3 class="post_score">{{ post.score }}</h3>
<button class="post_upvote"></button>
</div> </div>
{% for post in posts %} <div class="post_right">
<div class="post"> <p>
<div class="post_left"> <b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ sub.name }}</a></b>
<button class="post_upvote"></button> &bull;
<h3 class="post_score">{{ post.score }}</h3> Posted by
<button class="post_upvote"></button> <a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
</div> <span>{{ post.time }}</span>
<div class="post_right"> </p>
<p> <h3 class="post_title">
<b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ sub.name }}</a></b> {% if post.flair.0 != "" %}
&bull; <small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small>
Posted by {% endif %}
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a> <a href="{{ post.url }}">{{ post.title }}</a>
<span style="float: right;">{{ post.time }}</span> </h3>
</p> </div>
<h3 class="post_title"> <img class="post_thumbnail" src="{{ post.media }}">
{% if post.flair.0 != "" %} </div><br>
<small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small> {% endfor %}
{% endif %}
<a href="{{ post.url }}">{{ post.title }}</a>
</h3>
</div>
<img class="post_thumbnail" src="{{ post.media }}">
</div><br>
{% endfor %}
<footer> <footer>
{% if ends.0 != "" %} {% if ends.0 != "" %}
<a href="?before={{ ends.0 }}">PREV</a> <a href="?before={{ ends.0 }}">PREV</a>
{% endif %} {% endif %}
{% if ends.1 != "" %} {% if ends.1 != "" %}
<a href="?after={{ ends.1 }}">NEXT</a> <a href="?after={{ ends.1 }}">NEXT</a>
{% endif %} {% endif %}
</footer> </footer>
</main> </main>
</body> {% endblock %}
</html>

View file

@ -1,65 +1,55 @@
<html> {% extends "base.html" %}
<head> {% block title %}Libreddit: u/{{ user.name }}{% endblock %}
<title>Libreddit: u/{{ user.name }}</title> {% block body %}
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit."> {% block header %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <header>
<link rel="stylesheet" href="/style.css"> <a href="/"><span id="lib">lib</span>reddit.</a>
<style> <a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
#sort > #sort_{{ sort }} { </header>
background: aqua; {% endblock %}
color: black; <div id="about">
} <div class="user">
</style> <div class="user_left">
</head> <img class="user_icon" src="{{ user.icon }}">
<body> </div>
<header> <div class="user_right">
<a href="/"><span style="color:white">lib</span>reddit.</a> <h2 class="user_name">u/{{ user.name }}</h2>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a> <p class="user_description"><span>Karma:</span> {{ user.karma }} | <span>Description:</span> "{{ user.description }}"</p>
</header>
<div id="about">
<div class="user">
<div class="user_left">
<img class="user_icon" src="{{ user.icon }}">
</div>
<div class="user_right">
<h2 class="user_name">u/{{ user.name }}</h2>
<p class="user_description"><span>Karma:</span> {{ user.karma }} | <span>Description:</span> "{{ user.description }}"</p>
</div>
</div> </div>
</div> </div>
<main> </div>
<div id="sort"> <main>
<div id="sort_hot"><a href="?sort=hot">Hot</a></div> <div id="sort">
<div id="sort_top"><a href="?sort=top">Top</a></div> <div id="sort_hot"><a href="?sort=hot">Hot</a></div>
<div id="sort_new"><a href="?sort=new">New</a></div> <div id="sort_top"><a href="?sort=top">Top</a></div>
<div id="sort_new"><a href="?sort=new">New</a></div>
</div>
{% for post in posts %}
<div class="post">
<div class="post_left">
<button class="post_upvote"></button>
<h3 class="post_score">{{ post.score }}</h3>
<button class="post_upvote"></button>
</div> </div>
{% for post in posts %} <div class="post_right">
<div class="post"> <p>
<div class="post_left"> <b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a></b>
<button class="post_upvote"></button> &bull;
<h3 class="post_score">{{ post.score }}</h3> Posted by
<button class="post_upvote"></button> <a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
</div> <span style="float: right;">{{ post.time }}</span>
<div class="post_right"> </p>
<p> <h3 class="post_title">
<b><a class="post_subreddit" href="/r/{{ post.community }}">r/{{ post.community }}</a></b> {% if post.flair.0 == "Comment" %}
&bull; {% else if post.flair.0 == "" %}
Posted by {% else %}
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a> <small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small>
<span style="float: right;">{{ post.time }}</span> {% endif %}
</p> <a href="{{ post.url }}">{{ post.title }}</a>
<h3 class="post_title"> </h3>
{% if post.flair.0 == "Comment" %} </div>
{% else if post.flair.0 == "" %} <img class="post_thumbnail" src="{{ post.media }}">
{% else %} </div><br>
<small style="color:{{ post.flair.2 }}; background:{{ post.flair.1 }}">{{ post.flair.0 }}</small> {% endfor %}
{% endif %} </main>
<a href="{{ post.url }}">{{ post.title }}</a> {% endblock %}
</h3>
</div>
<img class="post_thumbnail" src="{{ post.media }}">
</div><br>
{% endfor %}
</main>
</body>
</html>