CJVT updates August and September 2026
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// TODO Remove no-console ignore rule once things are out of rapid dev phase.
|
||||
/* eslint no-console: 0 */
|
||||
/* global axios, initPagination, i18next */
|
||||
/* global axios, initPagination, i18next, DateUtils */
|
||||
const pageURL = location.pathname
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
@@ -10,9 +10,12 @@ window.addEventListener('load', () => {
|
||||
function initComments() {
|
||||
const ce = {}
|
||||
window.commentElements = ce
|
||||
ce.updatePager = initPagination('pagination', onPageChange)
|
||||
ce.commentsCountEl = document.getElementById('comments-count')
|
||||
ce.commentsContainerEl = document.getElementById('comments-container')
|
||||
if (!ce.commentsContainerEl) {
|
||||
return
|
||||
}
|
||||
ce.updatePager = initPagination('pagination', onCommentsPageChange)
|
||||
ce.commentForm = document.getElementById('comment-form')
|
||||
ce.commentReplyForm = document.getElementById('comment-reply-form')
|
||||
ce.commentMessageInput = document.getElementById('comment-message-input')
|
||||
@@ -37,15 +40,6 @@ function initComments() {
|
||||
ce.commentReplyInput.addEventListener('input', autoGrow)
|
||||
// ce.commentMessageInput.addEventListener('keydown', normalizeTextAreaSize)
|
||||
|
||||
window.commentSetting = {}
|
||||
window.commentSetting.localeOptions = {
|
||||
day: '2-digit',
|
||||
month: '2-digit',
|
||||
year: 'numeric',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit'
|
||||
}
|
||||
|
||||
if (ce.commentMessageInput && ce.commentReplyInput) {
|
||||
ce.commentMessageInput.originalHeight = window.getComputedStyle(
|
||||
ce.commentMessageInput
|
||||
@@ -154,7 +148,6 @@ function renderCommentCount(commentCount) {
|
||||
|
||||
function appendComment(comment) {
|
||||
const { commentsContainerEl, commentDiv } = window.commentElements
|
||||
const { localeOptions } = window.commentSetting
|
||||
|
||||
const {
|
||||
message,
|
||||
@@ -164,9 +157,7 @@ function appendComment(comment) {
|
||||
quote
|
||||
} = comment
|
||||
|
||||
let tstamp = new Date(timeCreated).toLocaleTimeString('sl-SL', localeOptions)
|
||||
|
||||
tstamp = `• ${tstamp}`
|
||||
const tstamp = `• ${DateUtils.formatDateTime(timeCreated)}`
|
||||
const divText = document.createElement('div')
|
||||
const divTextComment = document.createElement('div')
|
||||
const divRow = document.createElement('div')
|
||||
@@ -230,12 +221,7 @@ function appendComment(comment) {
|
||||
timeCreated
|
||||
} = quote
|
||||
|
||||
let tstamp = new Date(timeCreated).toLocaleTimeString(
|
||||
'sl-SL',
|
||||
localeOptions
|
||||
)
|
||||
|
||||
tstamp = `• ${tstamp}`
|
||||
const tstamp = `• ${DateUtils.formatDateTime(timeCreated)}`
|
||||
|
||||
const quoteText = document.createElement('div')
|
||||
const imgQuotemarks = document.createElement('img')
|
||||
@@ -411,7 +397,6 @@ function prepareReplyForm(repliedCommentData) {
|
||||
window.scrollTo(0, document.body.scrollHeight)
|
||||
const { commentForm, commentReplyForm, commentQuoteId, replyFormContainer } =
|
||||
window.commentElements
|
||||
const { localeOptions } = window.commentSetting
|
||||
|
||||
commentQuoteId.value = quoteId
|
||||
|
||||
@@ -439,12 +424,7 @@ function prepareReplyForm(repliedCommentData) {
|
||||
quoteAuthorLastNameEl.textContent = quoteAuthorLastName
|
||||
quotePreview.appendChild(quoteAuthorLastNameEl)
|
||||
|
||||
let tstamp = new Date(quotetimeCreated).toLocaleTimeString(
|
||||
'sl-SL',
|
||||
localeOptions
|
||||
)
|
||||
|
||||
tstamp = `• ${tstamp}`
|
||||
const tstamp = `• ${DateUtils.formatDateTime(quotetimeCreated)}`
|
||||
const quotetimeCreatedEl = document.createElement('p')
|
||||
quotetimeCreatedEl.className = 'comment-quote-time-created'
|
||||
quotetimeCreatedEl.textContent = tstamp
|
||||
@@ -569,10 +549,10 @@ function checkButton(type) {
|
||||
}
|
||||
|
||||
async function changeEntryCommentSection() {
|
||||
await onPageChange()
|
||||
await onCommentsPageChange()
|
||||
}
|
||||
|
||||
async function onPageChange(newPage) {
|
||||
async function onCommentsPageChange(newPage) {
|
||||
const { updatePager } = window.commentElements
|
||||
try {
|
||||
let { page, numberOfAllPages } = await displayComments(newPage)
|
||||
|
||||
Reference in New Issue
Block a user