dfsfsd
This commit is contained in:
parent
a5e3c55afd
commit
0befcc29b8
4 changed files with 14 additions and 12 deletions
|
@ -16,7 +16,7 @@ if (typeof showNewCommentCounts === 'undefined') {
|
||||||
|
|
||||||
const LAST_CACHE_CLEAN_ID = "last-cache-clean"
|
const LAST_CACHE_CLEAN_ID = "last-cache-clean"
|
||||||
const EXPIRE_INTERVAL_MILLIS = 5 * 24 * 60 * 60 * 1000
|
const EXPIRE_INTERVAL_MILLIS = 5 * 24 * 60 * 60 * 1000
|
||||||
const CACHE_CLEAN_INTERVAL = 60 * 60 * 1000 // 1 hour
|
const CACHE_CLEAN_INTERVAL = 60 * 60 * 1000
|
||||||
|
|
||||||
function cleanCache() {
|
function cleanCache() {
|
||||||
const lastCacheClean = JSON.parse(localStorage.getItem(LAST_CACHE_CLEAN_ID)) || Date.now()
|
const lastCacheClean = JSON.parse(localStorage.getItem(LAST_CACHE_CLEAN_ID)) || Date.now()
|
||||||
|
|
|
@ -432,19 +432,19 @@
|
||||||
{% if v and request.path.startswith('/@') and v.admin_level == 0 %}
|
{% if v and request.path.startswith('/@') and v.admin_level == 0 %}
|
||||||
{% if voted==1 %}<li class="list-inline-item arrow-up d-inline-block d-md-none mr-2 comment-{{c.id}}-up active"></li>{% endif %}
|
{% if voted==1 %}<li class="list-inline-item arrow-up d-inline-block d-md-none mr-2 comment-{{c.id}}-up active"></li>{% endif %}
|
||||||
{% elif v %}
|
{% elif v %}
|
||||||
<li id="comment-mobile-{{c.id}}-up" tabindex="0" href="javascript:void(0)" onclick="vote('comment-mobile', '{{c.id}}', '1')" class="list-inline-item arrow-up upvote-button d-inline-block d-md-none mr-2 comment-{{c.id}}-up {% if voted==1 %}active{% endif %}"></li>
|
<li id="comment-mobile-{{c.id}}-up" tabindex="0" href="javascript:void(0)" onclick="vote('comment-mobile', '{{c.id}}', '1')" class="list-inline-item arrow-up upvote-button d-inline-block d-md-none mx-0 pr-1 comment-{{c.id}}-up {% if voted==1 %}active{% endif %}"></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li id="comment-{{c.id}}-up" tabindex="0" href="javascript:void(0)" onclick="vote('comment', '{{c.id}}', '1')" class="list-inline-item arrow-up d-inline-block d-md-none mr-2" onclick="location.href='/login';"></li>
|
<li id="comment-{{c.id}}-up" tabindex="0" href="javascript:void(0)" onclick="vote('comment', '{{c.id}}', '1')" class="list-inline-item arrow-up d-inline-block d-md-none mx-0 pr-1" onclick="location.href='/login';"></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="list-inline-item d-inline-block d-md-none mr-2"><span class="points" data-bs-toggle="tooltip" data-bs-placement="top" title="" data-bs-original-title="+{{ups}} | -{{downs}}"><span id="comment-mobile-score-{{c.id}}" class="score comment-score-{{c.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}">{{score}}</span></span></li>
|
<li class="list-inline-item d-inline-block d-md-none mx-0"><span class="points" data-bs-toggle="tooltip" data-bs-placement="top" title="" data-bs-original-title="+{{ups}} | -{{downs}}"><span id="comment-mobile-score-{{c.id}}" class="score comment-score-{{c.id}} {% if voted==1 %}score-up{% elif voted==-1%}score-down{% endif %}">{{score}}</span></span></li>
|
||||||
{% if v and request.path.startswith('/@') and v.admin_level == 0 %}
|
{% if v and request.path.startswith('/@') and v.admin_level == 0 %}
|
||||||
{% if voted==-1 %}
|
{% if voted==-1 %}
|
||||||
<li class="list-inline-item arrow-down d-inline-block d-md-none mr-2 comment-{{c.id}}-up active"></li>
|
<li class="list-inline-item arrow-down d-inline-block d-md-none mr-2 comment-{{c.id}}-up active"></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% elif v %}
|
{% elif v %}
|
||||||
<li {% if environ.get('DISABLE_DOWNVOTES') == '1' %}style="display:None!important"{% endif %} id="comment-mobile-{{c.id}}-down" tabindex="0" href="javascript:void(0)" onclick="vote('comment-mobile', '{{c.id}}', '-1')" class="list-inline-item arrow-down downvote-button d-inline-block d-md-none mr-2 comment-{{c.id}}-down {% if voted==-1 %}active{% endif %}"></li>
|
<li {% if environ.get('DISABLE_DOWNVOTES') == '1' %}style="display:None!important"{% endif %} id="comment-mobile-{{c.id}}-down" tabindex="0" href="javascript:void(0)" onclick="vote('comment-mobile', '{{c.id}}', '-1')" class="list-inline-item arrow-down downvote-button d-inline-block d-md-none mx-0 pl-1 comment-{{c.id}}-down {% if voted==-1 %}active{% endif %}"></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li {% if environ.get('DISABLE_DOWNVOTES') == '1' %}style="display:None!important"{% endif %} id="comment-{{c.id}}-down" tabindex="0" href="javascript:void(0)" onclick="vote('comment', '{{c.id}}', '-1')" class="list-inline-item arrow-down d-inline-block d-md-none" onclick="location.href='/login';"></li>
|
<li {% if environ.get('DISABLE_DOWNVOTES') == '1' %}style="display:None!important"{% endif %} id="comment-{{c.id}}-down" tabindex="0" href="javascript:void(0)" onclick="vote('comment', '{{c.id}}', '-1')" class="list-inline-item arrow-down mx-0 pl-1 d-inline-block d-md-none" onclick="location.href='/login';"></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -728,10 +728,12 @@
|
||||||
showNewCommentCounts('{{p.id}}', {{p.comment_count}})
|
showNewCommentCounts('{{p.id}}', {{p.comment_count}})
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
{% if "?context" not in request.full_path %}
|
||||||
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || { c: 0 }).c + 1)
|
const comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
|
||||||
comments['{{p.id}}'] = { c: newTotal, t: Date.now() }
|
const newTotal = {{p.comment_count}} || ((comments['{{p.id}}'] || { c: 0 }).c + 1)
|
||||||
window.localStorage.setItem("comment-counts", JSON.stringify(comments))
|
comments['{{p.id}}'] = { c: newTotal, t: Date.now() }
|
||||||
|
window.localStorage.setItem("comment-counts", JSON.stringify(comments))
|
||||||
|
{% endif %}
|
||||||
})()
|
})()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(() => {
|
(() => {
|
||||||
const date = new Date('{{p.created_datetime}}');
|
const date = new Date({{p.created_utc*1000}});
|
||||||
document.getElementById('timestamp-{{p.id}}').title = date.toString();
|
document.getElementById('timestamp-{{p.id}}').title = date.toString();
|
||||||
{% if p.edited_utc %}
|
{% if p.edited_utc %}
|
||||||
const dateEdited = new Date('{{p.edited_datetime}}');
|
const dateEdited = new Date({{p.edited_utc*1000}});
|
||||||
document.getElementById('edited_timestamp-{{p.id}}').title = dateEdited.toString();
|
document.getElementById('edited_timestamp-{{p.id}}').title = dateEdited.toString();
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue