MarseyWorld/files/assets/js/comments.js

43 lines
1.3 KiB
JavaScript
Raw Normal View History

2023-08-03 06:50:22 +00:00
function option_vote_no_v() {
showToast(false, "Only logged-in users can vote!");
2022-07-16 21:00:02 +00:00
}
2023-02-27 01:37:53 +00:00
function expandMarkdown(fullname) {
const ta = document.getElementById('markdown-'+fullname);
2022-07-16 21:00:02 +00:00
ta.classList.toggle('d-none');
2023-02-27 01:37:53 +00:00
document.getElementsByClassName('text-expand-icon-'+fullname)[0].classList.toggle('fa-expand-alt');
document.getElementsByClassName('text-expand-icon-'+fullname)[0].classList.toggle('fa-compress-alt');
2022-07-16 21:00:02 +00:00
2023-02-27 01:37:53 +00:00
const items = document.getElementsByClassName(`expand-text-${fullname}`)
2022-07-16 21:00:02 +00:00
for (let i=0; i < items.length; i++)
2022-09-04 23:15:37 +00:00
{
2022-07-16 21:00:02 +00:00
const e = items[i]
if (e.innerHTML == 'View Source') e.innerHTML = 'Hide source'
else e.innerHTML = 'View Source'
2022-07-16 21:00:02 +00:00
}
};
2022-12-30 12:14:18 +00:00
function collapse_comment(id) {
const element = document.getElementById(`comment-${id}`)
2022-07-16 21:00:02 +00:00
const closed = element.classList.toggle("collapsed")
const top = element.getBoundingClientRect().y
if (closed && top < 0) {
element.scrollIntoView()
window.scrollBy(0, - 100)
2022-07-16 21:00:02 +00:00
}
2023-06-23 16:49:23 +00:00
const reports = document.getElementById(`reports-${id}`)
if (reports) reports.classList.add('d-none')
2022-07-16 21:00:02 +00:00
vids = element.getElementsByTagName('video')
for (let i=0; i < vids.length; i++)
{
vids[i].pause()
}
2023-02-27 01:37:53 +00:00
const ta = document.getElementById('markdown-c_'+id);
if (ta && !ta.classList.contains('d-none'))
2023-02-27 01:37:53 +00:00
expandMarkdown(`c_${id}`)
2022-12-30 12:14:18 +00:00
};