{% extends "bottom.html" %} {% load static %} {#文章详情#} {% block sitename %} {{ title }}-我的个人博客 {% endblock %} {% block stylesheethref %} {% endblock %} {% block content %}

{{ title }}

{{ title }}封面图
{{ content|safe }}

{{ stat }}

评论

{% csrf_token %}
{% for comment in comments %}
用户头像
{{ comment.comment_User }} {{ comment.comment_Time|timesince }}

{{ comment.comment_Content }}

{% if comment.replies.all %}
{% for reply in comment.replies.all %}
用户头像
{{ reply.user.username }} {{ reply.created_at|timesince }}前

{{ reply.content }}

{% endfor %}
{% endif %}
{% empty %}
暂无评论,快来抢沙发吧~
{% endfor %}
{% endblock %} {% block script %} const no_active_path = "M512 928c-28.928 0-57.92-12.672-86.624-41.376L106.272 564C68.064 516.352 32 471.328 32 384c0-141.152 114.848-256 256-256 53.088 0 104 16.096 147.296 46.592 14.432 10.176 17.92 30.144 7.712 44.608-10.176 14.432-30.08 17.92-44.608 7.712C366.016 204.064 327.808 192 288 192c-105.888 0-192 86.112-192 192 0 61.408 20.288 90.112 59.168 138.688l315.584 318.816C486.72 857.472 499.616 863.808 512 864c12.704.192 24.928-6.176 41.376-22.624l316.672-319.904C896.064 493.28 928 445.696 928 384c0-105.888-86.112-192-192-192-48.064 0-94.08 17.856-129.536 50.272l-134.08 134.112c-12.512 12.512-32.736 12.512-45.248 0s-12.512-32.736 0-45.248L562.24 196c48.32-44.192 109.664-68 173.76-68 141.152 0 256 114.848 256 256 0 82.368-41.152 144.288-75.68 181.696l-317.568 320.8C569.952 915.328 540.96 928 512 928z" const active_path = "M736 128c-65.952 0-128.576 25.024-176.384 70.464-4.576 4.32-28.672 28.736-47.328 47.68L464.96 199.04C417.12 153.216 354.272 128 288 128 146.848 128 32 242.848 32 384c0 82.432 41.184 144.288 76.48 182.496l316.896 320.128C450.464 911.68 478.304 928 512 928s61.568-16.32 86.752-41.504l316.736-320 2.208-2.464C955.904 516.384 992 471.392 992 384c0-141.152-114.848-256-256-256z" const path = document.getElementById('link_svg'); const fpPromise = import('{% static "FingerprintJS.js" %}').then(FingerprintJS => FingerprintJS.load()); fpPromise.then(fp => fp.get()).then(result => {localStorage.setItem("uuid",result.visitorId)}); document.addEventListener('DOMContentLoaded', function() { const likeBtn = document.getElementsByClassName('dz')[0]; if (!likeBtn) return; fetch(`/api/check_like/{{ id }}/${localStorage.getItem("uuid")}`,{ method: 'POST', headers: { 'X-CSRFToken': '{{ csrf_token }}' }, credentials: 'include' }).then(response => response.json()).then(data => { if (data.liked) { path.setAttribute('d', active_path) likeBtn.classList.add('active'); } }); const dz_icon = document.getElementsByClassName('dz-icon')[0]; dz_icon.addEventListener('click', function() { if (likeBtn.classList.contains('active')) { fetch(`/api/unlink/{{ id }}/${localStorage.getItem("uuid")}`,{ method: 'POST', headers: { 'X-CSRFToken': '{{ csrf_token }}' }, credentials: 'include' }) .then(response => response.json()) .then(data => { if (data.success) { likeBtn.classList.remove('active'); path.setAttribute('d', no_active_path) document.getElementById('likeCount').textContent = data.new_count; } }); } else { fetch(`/api/link/{{ id }}/${localStorage.getItem("uuid")}`, { method: 'POST', headers: { 'X-CSRFToken': '{{ csrf_token }}' }, credentials: 'include' }) .then(response => response.json()) .then(data => { if (data.success) { likeBtn.classList.add('active'); path.setAttribute('d', active_path) document.getElementById('likeCount').textContent = data.new_count; } }); } }) }); {% endblock %}