remove smooth scroll and more on thread stat

merge-requests/208/head
fatchan 5 years ago
parent 114e1fdfde
commit 03595fcc80
  1. 8
      gulp/res/css/style.css
  2. 3
      gulp/res/js/live.js
  3. 31
      gulp/res/js/threadstat.js
  4. 2
      views/pages/thread.pug

@ -1,7 +1,3 @@
html {
scroll-behavior: smooth;
}
body {
font-family: arial, helvetica, sans-serif;
font-size: 10pt;
@ -159,7 +155,7 @@ pre {
flex-flow: row wrap;
}
.pages, #livetext, #poststats {
.pages, #livetext, #threadstats {
box-sizing: border-box;
padding: 10px;
width: max-content;
@ -400,7 +396,7 @@ td, th {
}
}
.post-container, #float .post-container, .stickynav, .pages, .toggle-summary, .catalog-tile, .modal, .live, {
.post-container, #float .post-container, .stickynav, .pages, .toggle-summary, .catalog-tile, .modal, #livetext, #threadstats {
background: var(--post-color);
border-width: 1px;/*0 1px 1px 0;*/
border-style: solid;

@ -92,7 +92,8 @@ window.addEventListener('settingsReady', function(event) { //after domcontentloa
const newPostEvent = new CustomEvent('addPost', {
detail: {
post: newPost,
postId: postData.postId
postId: postData.postId,
json: postData
}
});
//dispatch the event so quote click handlers, image expand, etc can be added in separate scripts by listening to the event

@ -0,0 +1,31 @@
window.addEventListener('DOMContentLoaded', (event) => {
const statsElem = document.getElementById('threadstats');
if (statsElem) {
const uidElems = document.getElementsByClassName('user-id');
const uidSet = new Set();
for(let i = 0; i < uidElems.length; i++) {
uidSet.add(uidElems[i].innerText);
}
window.addEventListener('addPost', function(e) {
if (e.detail.hover) {
return; //dont need to handle hovered posts for this
}
const newFiles = e.detail.json.files.length;
console.log(newFiles)
if (e.detail.json.userId) {
uidSet.add(e.detail.json.userId);
}
const numPosts = +statsElem.children[0].innerText.match(/^(\d+)/g);
const numFiles = +statsElem.children[1].innerText.match(/^(\d+)/g);
const filesTotal = numFiles + newFiles;
const postTotal = numPosts + 1;
statsElem.children[0].innerText = `${postTotal} repl${postTotal === 1 ? 'y' : 'ies'}`;
statsElem.children[1].innerText = `${filesTotal} file${filesTotal === 1 ? '' : 's'}`;
if (e.detail.json.userId) {
statsElem.children[2].innerText = `${uidSet.size} UID${uidSet.size === 1 ? '' : 's'}`;
}
});
}
});

@ -35,7 +35,7 @@ block content
include ../includes/stickynav.pug
.pages
+boardnav(null, true, true)
- board.settings.ids ? const uids = new Set() : void 0;
- const uids = board.settings.ids ? new Set() : void 0;
form(action=`/forms/board/${board._id}/actions` method='POST' enctype='application/x-www-form-urlencoded')
hr(size=1)
.thread

Loading…
Cancel
Save