4,114
edits
No edit summary Tag: Reverted |
No edit summary Tags: Manual revert Reverted |
||
Line 87: | Line 87: | ||
} | } | ||
function getImageHtml(image) { | |||
return '<div class="image-container">' + | |||
'<img src="' + image.src + '" alt="' + image.alt + '">' + | |||
'<div class="' + image.captionClass + '">' + image.caption + '</div>' + | |||
'</div>'; | |||
} | |||
function setupImageToggle(images) { | |||
var currentIndex = 0; | |||
function toggleImage() { | |||
currentIndex = (currentIndex + 1) % images.length; | |||
var image = images[currentIndex]; | |||
var articleImageContainer = $('#article-content').find('.article-image'); | |||
articleImageContainer.html(getImageHtml(image)); | |||
} | |||
$('#article-content').on('click', '.article-image img', function () { | |||
toggleImage(); | |||
}); | |||
} | |||
function formatParagraphs(text) { | |||
// Split the text into paragraphs and wrap each in a <span> | |||
var paragraphs = text.split('\n').filter(function (p) { return p.trim() !== '' }); | |||
return paragraphs.map(function (p) { return '<span>' + p.trim() + '</span>'; }).join(''); | |||
} | |||
function formatSimpleDate(inputDate) { | |||
// Remove spaces from the date string | |||
var dateWithoutSpaces = inputDate.replace(/\s/g, ''); | |||
// Assuming dateWithoutSpaces is in the format "XX XX XX" | |||
var formattedDate = dateWithoutSpaces.slice(0, 2) + '.' + dateWithoutSpaces.slice(2, 4) + '.' + dateWithoutSpaces.slice(4); | |||
return formattedDate; | |||
} | |||
// Apply the fade-out effect to the #list element | // Apply the fade-out effect to the #list element | ||
$('#list').addClass('fade-out'); | $('#list').addClass('fade-out'); | ||
Line 93: | Line 131: | ||
event.stopPropagation(); | event.stopPropagation(); | ||
}); | }); | ||
// Attach a mousedown event listener to close the fixed column | // Attach a mousedown event listener to close the fixed column |