diff options
| author | Bobby <[email protected]> | 2023-07-05 02:03:33 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2023-07-05 02:03:33 -0400 |
| commit | e74e15353172e0ae1bf3bb6d463e886f359f4030 (patch) | |
| tree | a77eb3002c35df981cf8643da6a5ccbf3b94af77 | |
| parent | b2099c9dcedc713cc7ff3f9be253b7b218f7fb72 (diff) | |
| download | thatcomputerscientist-e74e15353172e0ae1bf3bb6d463e886f359f4030.tar.xz thatcomputerscientist-e74e15353172e0ae1bf3bb6d463e886f359f4030.zip | |
Added My Anime List
| -rw-r--r-- | blog/urls.py | 2 | ||||
| -rw-r--r-- | blog/views.py | 25 | ||||
| -rw-r--r-- | static/css/styles.css | 5 | ||||
| -rw-r--r-- | static/images/site/icons/loading-fast.gif | bin | 0 -> 466270 bytes | |||
| -rw-r--r-- | templates/blog/anidata.html | 6 | ||||
| -rw-r--r-- | templates/blog/anilist.html | 11 | ||||
| -rw-r--r-- | templates/blog/partials/sidebar.html | 104 |
7 files changed, 106 insertions, 47 deletions
diff --git a/blog/urls.py b/blog/urls.py index d62e7464..57e5d08d 100644 --- a/blog/urls.py +++ b/blog/urls.py @@ -27,4 +27,6 @@ urlpatterns = [ path('policy', views.policy, name='policy'), path('socialify', views.socialify, name='socialify'), path('rss/', RSSFeed(), name='rss_feed'), + path('anidata', views.anidata, name='anidata'), + path('anilist', views.anilist, name='anilist'), ] diff --git a/blog/views.py b/blog/views.py index b253db6e..9b573491 100644 --- a/blog/views.py +++ b/blog/views.py @@ -16,6 +16,7 @@ from django.http import Http404, HttpResponse, HttpResponseRedirect from django.shortcuts import redirect, render, reverse from dotenv import load_dotenv from haystack.query import SearchQuerySet +import requests from user_agents import parse from announcements.models import Announcement @@ -561,3 +562,27 @@ def socialify(request): socialify_options[key] = 0 return render(request, 'blog/socialify.html', {'title': 'Socialify', 'options': socialify_options, 'url': url}) + +def anilist(request): + return render(request, 'blog/anilist.html', {'title': 'My Anime List'}) + +def anidata(request): + malURL = 'https://myanimelist.net/animelist/crvs' + MALContent = requests.get(malURL).content + MALContent = MALContent.decode('utf-8') + MALParsed = BeautifulSoup(MALContent, 'html.parser') + # remove script tags + for tag in MALParsed(['script', 'meta', 'noscript']): + tag.extract() + + # add myanimelist.net to relative links + for link in MALParsed.find_all('a'): + if link.get('href') and link.get('href')[0] == '/': + link['href'] = 'https://myanimelist.net' + link['href'] + + # make all links open in new tab + link['target'] = '_blank' + + MALContent = MALParsed.prettify() + + return render(request, 'blog/anidata.html', {'title': 'My Anime List', 'MALContent': MALContent}) diff --git a/static/css/styles.css b/static/css/styles.css index 6ae81a7e..ceefb21d 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -18,6 +18,11 @@ body { display: none !important; } +.iframe-loader { + background: url('../images/site/icons/loading-fast.gif') no-repeat top center; + background-size: 30%; +} + font:hover, .VIpgJd-yAWNEb-VIpgJd-fmcmS-sn54Q { background: none !important; box-shadow: none !important; diff --git a/static/images/site/icons/loading-fast.gif b/static/images/site/icons/loading-fast.gif Binary files differnew file mode 100644 index 00000000..144d7dbb --- /dev/null +++ b/static/images/site/icons/loading-fast.gif diff --git a/templates/blog/anidata.html b/templates/blog/anidata.html new file mode 100644 index 00000000..78e7106c --- /dev/null +++ b/templates/blog/anidata.html @@ -0,0 +1,6 @@ +{{ MALContent|safe }} +<style> + * { + cursor: url(https://ani.cursors-4u.net/smiley/smi-3/smi347.cur), auto !important; + } +</style> diff --git a/templates/blog/anilist.html b/templates/blog/anilist.html new file mode 100644 index 00000000..375f635e --- /dev/null +++ b/templates/blog/anilist.html @@ -0,0 +1,11 @@ +{% extends 'blog/partials/base.html' %} {% block content %} +{% load static %} +<div class="iframe-loader" style="margin-top: 70px;"> + <iframe src="{% url 'blog:anidata' %}" width="100%" height="100%" frameborder="0" id="anilist"></iframe> +</div> +{% endblock content %} +{% block scripts %} +<script type="text/javascript"> + $('#anilist').css('height', $(window).height()+'px'); +</script> +{% endblock scripts %}
\ No newline at end of file diff --git a/templates/blog/partials/sidebar.html b/templates/blog/partials/sidebar.html index 57f0e5ca..c0611890 100644 --- a/templates/blog/partials/sidebar.html +++ b/templates/blog/partials/sidebar.html @@ -156,6 +156,63 @@ <img src="{{ "big" | ad }}" alt="Advertisement"> </div> +<div id="fun-stuff" class="mtctitem"> + <h2>Fun Stuff</h2> + <ul> + <li> + <span> + <img src="{% static 'images/site/icons/fork.png' %}" alt="Repositories" border="0" style="padding: 2px; height: 20px; width: 20px;"> + </span> + <span> + <a href="{% url 'dev_status:home' %}"> + My Repositories + </a> + </span> + </li> + <li> + <span> + <img src="{% static 'images/site/icons/anistar.gif' %}" alt="Socialify" border="0" style="padding: 2px; height: 20px; width: 20px;"> + </span> + <span> + <a href="{% url 'blog:anilist' %}"> + My Anime List + </a> + </span> + </li> + <li> + <span> + <img src="{% static 'images/site/icons/windows.gif' %}" alt="Socialify" border="0"> + </span> + <span> + <a href="{% url 'blog:socialify' %}"> + Socialify + </a> + </span> + </li> + <li> + {% if request.COOKIES.summonOneko == 'true' %} + <span> + <img src="{% static 'images/site/withdraw_oneko.gif' %}" alt="Oneko" border="0"> + </span> + <span> + <a href="javascript:void(0);" onclick="withdrawOneko();"> + Withdraw Oneko + </a> + </span> + {% else %} + <span> + <img src="{% static 'images/site/summon_oneko.gif' %}" alt="Oneko" border="0"> + </span> + <span> + <a href="javascript:void(0);" onclick="summonOneko();"> + Summon Oneko + </a> + </span> + {% endif %} + </li> + </ul> +</div> + <div id="archives-area" class="mtctitem"> <h2>Archives</h2> <ul> @@ -300,53 +357,6 @@ </div> {% endif %} -<div id="fun-stuff" class="mtctitem"> - <h2>Fun Stuff</h2> - <ul> - <li> - <span> - <img src="{% static 'images/site/icons/windows.gif' %}" alt="Repositories" border="0"> - </span> - <span> - <a href="{% url 'dev_status:home' %}"> - My Repositories - </a> - </span> - </li> - <li> - <span> - <img src="{% static 'images/site/icons/windows.gif' %}" alt="Socialify" border="0"> - </span> - <span> - <a href="{% url 'blog:socialify' %}"> - Socialify - </a> - </span> - </li> - <li> - {% if request.COOKIES.summonOneko == 'true' %} - <span> - <img src="{% static 'images/site/withdraw_oneko.gif' %}" alt="Oneko" border="0"> - </span> - <span> - <a href="javascript:void(0);" onclick="withdrawOneko();"> - Withdraw Oneko - </a> - </span> - {% else %} - <span> - <img src="{% static 'images/site/summon_oneko.gif' %}" alt="Oneko" border="0"> - </span> - <span> - <a href="javascript:void(0);" onclick="summonOneko();"> - Summon Oneko - </a> - </span> - {% endif %} - </li> - </ul> -</div> - {% if anonymous_users or logged_in_users or admin_users %} <div id="online-users" class="mtctitem"> <h2>Who's Online?</h2> |
