bugfix in scripts and templates for live recent pages

merge-requests/208/head
Thomas Lynch 4 years ago
parent d1bcccfdcd
commit c02e9e800d
  1. 44
      gulp/res/js/live.js
  2. 2
      views/pages/globalmanagerecent.pug
  3. 2
      views/pages/managerecent.pug

@ -62,30 +62,32 @@ window.addEventListener('settingsReady', function(event) { //after domcontentloa
el.remove();
});
}
//add backlink to quoted posts
for (let j = 0; j < postData.quotes.length; j++) {
const quoteData = postData.quotes[j];
//add backlink to quoted posts
const quotedPost = document.getElementById(quoteData.postId).nextSibling;
let replies = quotedPost.querySelector('.replies');
if (!replies) {
const quotedPostData = quotedPost.querySelector('.post-data');
const newRepliesDiv = document.createElement('div');
newRepliesDiv.textContent = 'Replies: ';
newRepliesDiv.classList.add('replies', 'mt-5', 'ml-5');
quotedPostData.appendChild(newRepliesDiv);
replies = newRepliesDiv;
}
if (new RegExp(`>>${postData.postId}(\s|$)`).test(replies.innerText)) {
//reply link already exists (probably from a late catch up)
continue;
const quotedPost = document.querySelector(`.post-container[data-post-id="${quoteData.postId}"][data-board="${postData.board}"]`);
if (quotedPost) { //check if exists, it wont necessarily, e.g. global/manage recent pages
let replies = quotedPost.querySelector('.replies');
if (!replies) {
const quotedPostData = quotedPost.querySelector('.post-data');
const newRepliesDiv = document.createElement('div');
newRepliesDiv.textContent = 'Replies: ';
newRepliesDiv.classList.add('replies', 'mt-5', 'ml-5');
quotedPostData.appendChild(newRepliesDiv);
replies = newRepliesDiv;
}
if (new RegExp(`>>${postData.postId}(\s|$)`).test(replies.innerText)) {
//reply link already exists (probably from a late catch up)
continue;
}
const newReply = document.createElement('a');
const space = document.createTextNode(' ');
newReply.href = `/${postData.board}/${(isModView || isRecent) ? 'manage/' : ''}thread/${postData.thread || postData.postId}.html#${postData.postId}`;
newReply.textContent = `>>${postData.postId}`;
newReply.classList.add('quote');
replies.appendChild(newReply);
replies.appendChild(space);
}
const newReply = document.createElement('a');
const space = document.createTextNode(' ');
newReply.href = `/${postData.board}/${(isModView || isRecent) ? 'manage/' : ''}thread/${postData.thread || postData.postId}.html#${postData.postId}`;
newReply.textContent = `>>${postData.postId}`;
newReply.classList.add('quote');
replies.appendChild(newReply);
replies.appendChild(space);
}
const newPostAnchor = document.getElementById(postData.postId);
const newPost = newPostAnchor.nextSibling;

@ -10,7 +10,7 @@ block content
br
.wrapbar
+globalmanagenav('recent')
if page === 1
if page === 1 && !ip
.jsonly#livetext(data-perm-level=permLevel data-room=`globalmanage-recent-${permLevel > ipHashPermLevel ? 'hashed' : 'raw'}`)
.dot#livecolor
| Connecting...

@ -12,7 +12,7 @@ block content
br
.wrapbar
+managenav('recent')
if page === 1
if page === 1 && !postId && !queryIp
.jsonly#livetext(data-perm-level=permLevel data-room=`${board._id}-manage-recent-${permLevel > ipHashPermLevel ? 'hashed' : 'raw'}`)
.dot#livecolor
| Connecting...

Loading…
Cancel
Save