remotes/1693045480750635534/spooky-22
Aevann1 2021-12-03 21:38:35 +02:00
parent 6e54b9dccf
commit c000a05b48
1 changed files with 54 additions and 56 deletions

View File

@ -106,36 +106,6 @@
{% macro single_comment(c, level=1) %}
{% if p and not (v and v.id==c.author_id) and (not v or v.highlightcomments) %}
<script>
window.addEventListener("load",function(event) {
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
lastCount = comments['{{p.id}}']
if (lastCount && {{c.created_utc*1000}} > lastCount.t) {
document.getElementById("reddot-{{c.id}}").innerHTML = '<i style="color:red !important" class="text-admin fas fa-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Unread"></i>'
}
});
</script>
{% endif %}
<script>
window.addEventListener("load",function(event) {
(() => {
const date = new Date({{c.created_utc*1000}});
document.getElementById('timestamp-{{c.id}}').title = date.toString();
{% if c.is_pinned %}
const pinned_info = document.getElementById('pinned-{{c.id}}')
{% if c.is_pinned.startswith('t:') %}
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{c.is_pinned[2:]}} * 1000).toString()}`)
{% else %}
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{c.is_pinned}}")
{%endif%}
{%endif%}
})()
});
</script>
<div style="display:none" id="popover-{{c.id}}">
<div class="popover-user-profile" role="tooltip">
<img class="w-100 h-64 object-cover" src="{{c.author.banner_url}}">
@ -872,6 +842,10 @@
<script defer src="/assets/js/comments_admin.js?v=54"></script>
{% endif %}
{% include "expanded_image_modal.html" %}
<script defer src="/assets/js/popover.js?v=9"></script>
<script>
function collapse_comment(comment_id) {
const comment = "comment-" + comment_id
@ -890,33 +864,59 @@
var myToast = new bootstrap.Toast(document.getElementById('toast-success'));
myToast.show();
});
</script>
{% include "expanded_image_modal.html" %}
<script>
function poll_vote(cid, parentid) {
{% if v %}
for(let el of document.getElementsByClassName('presult-'+parentid)) {
el.classList.remove('d-none');
}
for(let el of document.getElementsByClassName('presult')) {
el.classList.remove('d-none');
}
var type = document.getElementById(cid).checked;
var scoretext = document.getElementById('poll-' + cid);
var score = Number(scoretext.textContent);
if (type == true) scoretext.textContent = score + 1;
else scoretext.textContent = score - 1;
post('/vote/poll/' + cid + '?vote=' + type);
{% else %}
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.show();
document.getElementById('toast-post-error-text').innerText = "Only logged-in users can vote!";
{% endif %}
}
function poll_vote(cid, parentid) {
{% if v %}
for(let el of document.getElementsByClassName('presult-'+parentid)) {
el.classList.remove('d-none');
}
for(let el of document.getElementsByClassName('presult')) {
el.classList.remove('d-none');
}
var type = document.getElementById(cid).checked;
var scoretext = document.getElementById('poll-' + cid);
var score = Number(scoretext.textContent);
if (type == true) scoretext.textContent = score + 1;
else scoretext.textContent = score - 1;
post('/vote/poll/' + cid + '?vote=' + type);
{% else %}
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
myToast.show();
document.getElementById('toast-post-error-text').innerText = "Only logged-in users can vote!";
{% endif %}
}
window.addEventListener("load",function(event) {
{% if p and (not v or v.highlightcomments) %}
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
lastCount = comments['{{p.id}}']
redhtml = '<i style="color:red !important" class="text-admin fas fa-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Unread"></i>'
if (lastCount)
{
{% for c in comments %}
{% if not (v and v.id==c.author_id) %}
if ({{c.created_utc*1000}} > lastCount.t) document.getElementById("reddot-{{c.id}}").innerHTML = redhtml
{% endif %}
{% endfor %}
}
{% endif %}
(() => {
{% for c in comments %}
date = new Date({{c.created_utc*1000}});
document.getElementById('timestamp-{{c.id}}').title = date.toString();
{% if c.is_pinned %}
const pinned_info = document.getElementById('pinned-{{c.id}}')
{% if c.is_pinned.startswith('t:') %}
pinned_info.setAttribute("data-bs-original-title", `Pinned until ${new Date({{c.is_pinned[2:]}} * 1000).toString()}`)
{% else %}
pinned_info.setAttribute("data-bs-original-title", "Pinned by @{{c.is_pinned}}")
{%endif%}
{%endif%}
{% endfor %}
})()
const popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'));
const popoverList = popoverTriggerList.map(function(popoverTriggerEl) {
@ -930,6 +930,4 @@
});
</script>
<script defer src="/assets/js/popover.js?v=9"></script>
</body>