id script optimizations based on some js profiling and code cleanup, page load speed improvement

indiachan-spamvector
Thomas Lynch 3 years ago
parent 4872b7f5f8
commit d9a4397d52
  1. 6
      CHANGELOG.md
  2. 2
      gulp/res/css/style.css
  3. 19
      gulp/res/js/threadstat.js
  4. 2
      package.json
  5. 2
      views/includes/head.pug

@ -8,6 +8,10 @@
##### 0.1.2
- Merge webring and local board list and improve webring search and filter functionality
- New stat section of homepage
- Replaced fatchan styled/branded spoiler image
- Replaced and removed some fatchan-specific media
- Fixed undefined hcaptcha site key bug
- Updated README with info about nginx CSP for 3rd party captcha providers
- Update socket-io 2.x to 4.x
##### 0.1.3
- Script optimizations, improve page load speed

@ -755,7 +755,7 @@ span.captchacheckbox {
padding: 0px 2px;
border: 1px solid rgba(0, 0, 0, 0.4);
border-radius: 1px;
/*cursor: pointer;*/
cursor: pointer;
}
.user-id:hover::after {

@ -1,15 +1,7 @@
window.addEventListener('DOMContentLoaded', (event) => {
const mainStyleSheet = document.querySelector('link[rel="stylesheet"]').sheet;
const rulesKey = mainStyleSheet.rules != null ? 'rules' : 'cssRules';
for (rule of mainStyleSheet[rulesKey]) {
if(rule.selectorText == '.user-id') {
rule.style.cursor = 'pointer'; //make ids like a link when hovering
}
}
const statsElem = document.getElementById('threadstats');
const idElems = [];
const idElems = document.getElementsByClassName('user-id');
const idMap = new Map();
const isHighlightedSet = new Set();
@ -38,14 +30,9 @@ window.addEventListener('DOMContentLoaded', (event) => {
}
}
//fetch starting ids
const startElems = document.getElementsByClassName('user-id');
for (let i = 0; i < startElems.length; i++) {
idElems.push(startElems[i]);
startElems[i].addEventListener('dblclick', toggleHighlightPosts);
}
//set counts
//map count of starting ids
for (let i = 0; i < idElems.length; i++) {
idElems[i].addEventListener('dblclick', toggleHighlightPosts);
incrementMap(idElems[i].innerText);
}

@ -1,6 +1,6 @@
{
"name": "jschan",
"version": "0.1.2",
"version": "0.1.3",
"migrateVersion": "0.1.2",
"description": "",
"main": "server.js",

@ -7,7 +7,7 @@ if isBoard
if board.settings.tags
meta(name='keywords' content=board.settings.tags.join(','))
noscript
style .jsonly { display: none!important; }
style .jsonly { display: none!important; } .user-id { cursor: auto!important; }
link(rel='stylesheet' href=`/css/style.css?v=${commit}&ct=${captchaType}`)
- const theme = isBoard ? board.settings.theme : defaultTheme;
- const codeTheme = isBoard ? board.settings.codeTheme : defaultCodeTheme;

Loading…
Cancel
Save