aboutsummaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-06-07 22:45:06 -0400
committerBobby <[email protected]>2023-06-07 22:45:06 -0400
commit2f3508ea23a9ce470fd6570235aa63e90e50df7f (patch)
treeda55a52fb4e953015b522377d21f0a4bcdfd58be /templates
parent3b2f2278b14566e06209ffc4117e17221aedfe0a (diff)
downloadthatcomputerscientist-2f3508ea23a9ce470fd6570235aa63e90e50df7f.tar.xz
thatcomputerscientist-2f3508ea23a9ce470fd6570235aa63e90e50df7f.zip
Remove Middleware and Handle Translate Client Side
Diffstat (limited to 'templates')
-rw-r--r--templates/blog/partials/base.html28
-rw-r--r--templates/blog/partials/sidebar.html4
-rw-r--r--templates/blog/post.html8
3 files changed, 26 insertions, 14 deletions
diff --git a/templates/blog/partials/base.html b/templates/blog/partials/base.html
index ddb12727..e194a6b6 100644
--- a/templates/blog/partials/base.html
+++ b/templates/blog/partials/base.html
@@ -62,6 +62,25 @@
white-space: nowrap; /* Prevent line breaks */
}
</style>
+ {% if request.COOKIES.lang == 'ja' %}
+ <script
+ type="text/javascript"
+ src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"
+ ></script>
+ <script src="{% static 'js/tl.js' %}"></script>
+ {% endif %}
+
+ <script src="{% static 'js/jquery-1.12.4.min.js' %}"></script>
+ <script src="{% static 'js/globals.js' %}"></script>
+ <script src="{% static 'js/phone_compatibility.js' %}"></script>
+ {% if request.COOKIES.summonOneko == 'true' %}
+ <script src="{% static 'js/oneko.js' %}"></script>
+ {% endif %} {% block scripts %} {% endblock %}
+ <!-- Google tag (gtag.js) -->
+ <script
+ async
+ src="https://www.googletagmanager.com/gtag/js?id=G-72XTC500FR"
+ ></script>
</head>
<body>
<video id="bg-video" muted autoplay playsinline loop preload="auto">
@@ -144,14 +163,5 @@
</p>
</div>
</div>
- <script src="{% static 'js/jquery-1.12.4.min.js' %}"></script>
- <script src="{% static 'js/globals.js' %}"></script>
- <script src="{% static 'js/phone_compatibility.js' %}"></script>
- {% if request.COOKIES.summonOneko == 'true' %}
- <script src="{% static 'js/oneko.js' %}"></script>
- {% endif %}
- {% block scripts %} {% endblock %}
- <!-- Google tag (gtag.js) -->
- <script async src="https://www.googletagmanager.com/gtag/js?id=G-72XTC500FR"></script>
</body>
</html>
diff --git a/templates/blog/partials/sidebar.html b/templates/blog/partials/sidebar.html
index 97f4d7f6..9699436b 100644
--- a/templates/blog/partials/sidebar.html
+++ b/templates/blog/partials/sidebar.html
@@ -361,4 +361,6 @@
</ul>
<p>(Based on users active over the past 5 minutes)</p>
</div>
-</div> \ No newline at end of file
+</div>
+<div id="google_translate_element"></div>
+
diff --git a/templates/blog/post.html b/templates/blog/post.html
index 7c0e6d3b..5466c465 100644
--- a/templates/blog/post.html
+++ b/templates/blog/post.html
@@ -106,7 +106,7 @@
</td>
<td style="vertical-align: top; width: 668px;">
<div style="margin-bottom: 13px; border-bottom: dashed 1px white; padding-bottom: 13px;">
- <a {% if comment.user%}href="{% url 'blog:user_activity' comment.user.username %}"{% endif %}>{% if comment.user %}{{ comment.user.username }}{% else %}{{ comment.anonymous_user.name }}{% endif %}</a> on <em>{{ comment.created_at | date:"M d, Y" }}</em>
+ <a class="notranslate" {% if comment.user%}href="{% url 'blog:user_activity' comment.user.username %}"{% endif %}>{% if comment.user %}{{ comment.user.username }}{% else %}{{ comment.anonymous_user.name }}{% endif %}</a> on <em>{{ comment.created_at | date:"M d, Y" }}</em>
{% if comment.edited %}
<em>(Edited)</em>
{% endif %}
@@ -123,7 +123,7 @@
<a href="{% url 'blog:anon_delete_comment' post.slug comment.id %}" onclick="return confirm('Are you sure you want to delete this comment?')">Delete</a>
{% endif %}
</div>
- <div id="comment-body-{{ comment.id }}" class="comment">
+ <div id="comment-body-{{ comment.id }}" class="comment notranslate">
{{ comment.processed_body|safe }}
</div>
{% if comment.user == user %}
@@ -131,7 +131,7 @@
<form action="{% url 'blog:edit_comment' post.slug %}" method="POST">
{% csrf_token %}
<input type = "hidden" name="comment_id" value="{{ comment.id }}">
- <textarea name="body" id="body" cols="78" rows="10" style="width: 640px; display: block; margin-bottom: 10px;">{{ comment.body }}</textarea>
+ <textarea class="notranslate" name="body" id="body" cols="78" rows="10" style="width: 640px; display: block; margin-bottom: 10px;">{{ comment.body }}</textarea>
<input type="submit" value="Update" class="button button-special">
<input type="button" value="Cancel" onclick="cancelEdit({{ comment.id }})" class="button">
</form>
@@ -142,7 +142,7 @@
<form action="{% url 'blog:anon_edit_comment' post.slug %}" method="POST">
{% csrf_token %}
<input type = "hidden" name="comment_id" value="{{ comment.id }}">
- <textarea name="body" id="body" cols="78" rows="10" style="width: 640px; display: block; margin-bottom: 10px;">{{ comment.body }}</textarea>
+ <textarea class="notranslate" name="body" id="body" cols="78" rows="10" style="width: 640px; display: block; margin-bottom: 10px;">{{ comment.body }}</textarea>
<input type="submit" value="Update" class="button button-special">
<input type="button" value="Cancel" onclick="cancelEdit({{ comment.id }})" class="button">
</form>