4,114
edits
No edit summary Tag: Reverted |
No edit summary Tag: Manual revert |
||
Line 33: | Line 33: | ||
} | } | ||
} | } | ||
// Set up image toggle if more than one image is found | // Set up image toggle if more than one image is found | ||
Line 61: | Line 58: | ||
}; | }; | ||
// Update the fixed column content | |||
$('#article-title').html('<p class="article-entry-number">' + entryNumber + '</p><p class="article-people">' + people + '</p>'); | $('#article-title').html('<p class="article-entry-number">' + entryNumber + '</p><p class="article-people">' + people + '</p>'); | ||
$('#article-content').html( | $('#article-content').html( | ||
Line 94: | Line 91: | ||
'<div class="article-modification-date">' + formatSimpleDate(modificationDate) + '</div>' | '<div class="article-modification-date">' + formatSimpleDate(modificationDate) + '</div>' | ||
); | ); | ||
function getImageHtml(image) { | |||
return '<div class="image-container">' + | |||
'<img src="' + image.src + '" alt="' + image.alt + '">' + | |||
'<div class="caption">' + image.caption + '</div>' + | |||
'</div>'; | |||
} | |||
function formatParagraphs(text) { | function formatParagraphs(text) { | ||
// Split the text into paragraphs and wrap each in a <span> | // Split the text into paragraphs and wrap each in a <span> | ||
Line 125: | Line 121: | ||
event.stopPropagation(); | event.stopPropagation(); | ||
}); | }); | ||
function setupImageToggle(images) { | |||
var currentIndex = 0; | |||
function toggleImage() { | |||
currentIndex = (currentIndex + 1) % images.length; | |||
var image = images[currentIndex]; | |||
$('#article-content').find('.article-image a').attr('href', image.link); | |||
$('#article-content').find('.article-image img').attr('src', image.src).attr('alt', image.alt); | |||
$('#article-content').find('.caption-image').text(image.caption); | |||
} | |||
// Attach click event to image for toggling | |||
$('#article-content').on('click', '.article-image img', function () { | |||
toggleImage(); | |||
}); | |||
} | |||
// Attach a mousedown event listener to close the fixed column | // Attach a mousedown event listener to close the fixed column |