change how auto scroll scrolls to not change window hash, and make threshold gt not gte

merge-requests/208/head
fatchan 5 years ago
parent dcd05afd08
commit b38446201a
  1. 5
      gulp/res/js/live.js
  2. 2
      helpers/posting/markdown.js

@ -53,15 +53,16 @@ window.addEventListener('settingsReady', function(event) { //after domcontentloa
newReply.classList.add('quote');
replies.appendChild(newReply);
}
const newPostAnchor = document.getElementById(postData.postId);
const newPost = newPostAnchor.nextSibling;
if (scrollEnabled) {
window.location.hash = postData.postId; //scroll to post if enabled;
newPostAnchor.scrollIntoView(); //scroll to post if enabled;
}
if (notificationsEnabled) {
new Notification(document.title, {
body: postData.nomarkup.substring(0,100)
});
}
const newPost = document.getElementById(postData.postId).nextSibling;
const newPostEvent = new CustomEvent('addPost', {
detail: {
post: newPost,

@ -39,7 +39,7 @@ module.exports = {
processCodeChunk: (text) => {
const trimFix = text.replace(/^\s*(\r?\n)*|(\r?\n)*$/g, ''); //remove extra whitespace/newlines at ends
const { language, relevance, value } = highlightAuto(trimFix, highlightOptions.languageSubset);
if (relevance >= highlightOptions.threshold) {
if (relevance > highlightOptions.threshold) {
return `<span class='code hljs'><small>possible language: ${language}, relevance: ${relevance}</small>\n${value}</span>`;
} else {
return `<span class='code'>${escape(trimFix)}</span>`;

Loading…
Cancel
Save