4,554
edits
No edit summary |
No edit summary Tag: Reverted |
||
Line 111: | Line 111: | ||
checkFiltersCleared(); | checkFiltersCleared(); | ||
function openModal(element) { | |||
console.log('Clicked on card:', this); | console.log('Clicked on card:', this); | ||
showArticleWrapper.css('display', 'block'); | showArticleWrapper.css('display', 'block'); | ||
var cardImages = []; | var cardImages = []; | ||
for (var i = 1; i <= 5; i++) { | for (var i = 1; i <= 5; i++) { | ||
Line 126: | Line 120: | ||
var captionClass = '.caption-image' + i; | var captionClass = '.caption-image' + i; | ||
var imageElem = $(this).find(imageClass + ' img'); | var imageElem = $(this).find(imageClass + ' img'); | ||
if (imageElem.length) { | if (imageElem.length) { | ||
var captionText = $(this).find(imageClass + ' ' + captionClass).text(); | var captionText = $(this).find(imageClass + ' ' + captionClass).text(); | ||
Line 156: | Line 150: | ||
var modificationDate = $(this).find('.modification-date').text(); | var modificationDate = $(this).find('.modification-date').text(); | ||
var relatedArticlesHtml = $(this).find('.related-articles').html(); | var relatedArticlesHtml = $(this).find('.related-articles').html(); | ||
$('#article-title').html('<p class="article-entry-number">' + entryNumber + '</p><p class="article-people">' + peopleHtml + '</p>'); | $('#article-title').html('<p class="article-entry-number">' + entryNumber + '</p><p class="article-people">' + peopleHtml + '</p>'); | ||
var articleContentHtml = '<div class="article-title-link">'; | var articleContentHtml = '<div class="article-title-link">'; | ||
Line 164: | Line 158: | ||
} | } | ||
articleContentHtml += '</div>'; // Close the new div | articleContentHtml += '</div>'; // Close the new div | ||
// Append type, entity, discipline, and subject details | // Append type, entity, discipline, and subject details | ||
articleContentHtml += '<p class="article-type">' + typeHtml + '</p>' + | articleContentHtml += '<p class="article-type">' + typeHtml + '</p>' + | ||
Line 199: | Line 193: | ||
'<p class="article-label-modification-date">Added on</p>' + | '<p class="article-label-modification-date">Added on</p>' + | ||
'<div class="article-modification-date">' + formatSimpleDate(modificationDate) + '</div>' | '<div class="article-modification-date">' + formatSimpleDate(modificationDate) + '</div>' | ||
$('#article-content').html(articleContentHtml); | $('#article-content').html(articleContentHtml); | ||
$('#related-articles').html(relatedArticlesHtml); | $('#related-articles').html(relatedArticlesHtml); | ||
if (relatedArticlesHtml && relatedArticlesHtml.trim().length > 0) { | if (relatedArticlesHtml && relatedArticlesHtml.trim().length > 0) { | ||
$('#related-articles').html('<div class="related-articles-label">Related Articles</div><div class="related-articles-container">' + relatedArticlesHtml + '</div>').show(); | $('#related-articles').html('<div class="related-articles-label">Related Articles</div><div class="related-articles-container">' + relatedArticlesHtml + '</div>').show(); | ||
Line 208: | Line 202: | ||
$('#related-articles').html('<div class="related-articles-label">No related articles found.</div>').show(); | $('#related-articles').html('<div class="related-articles-label">No related articles found.</div>').show(); | ||
} | } | ||
function formatSimpleDate(inputDate) { | function formatSimpleDate(inputDate) { | ||
// Remove spaces from the date string | // Remove spaces from the date string | ||
var dateWithoutSpaces = inputDate.replace(/\s/g, ''); | var dateWithoutSpaces = inputDate.replace(/\s/g, ''); | ||
// Assuming dateWithoutSpaces is in the format "XX XX XX" | // Assuming dateWithoutSpaces is in the format "XX XX XX" | ||
var formattedDate = dateWithoutSpaces.slice(0, 2) + '.' + dateWithoutSpaces.slice(2, 4) + '.' + dateWithoutSpaces.slice(4); | var formattedDate = dateWithoutSpaces.slice(0, 2) + '.' + dateWithoutSpaces.slice(2, 4) + '.' + dateWithoutSpaces.slice(4); | ||
return formattedDate; | 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'); | ||
// Prevent further propagation to the document | // Prevent further propagation to the document | ||
event.stopPropagation(); | event.stopPropagation(); | ||
} | |||
// Delegate for block-view page | |||
$('#list').on('mousedown', '.card', function (event) { | |||
if ($(event.target).closest('.people a, .type a').length) { | |||
return; | |||
} | |||
openModal(this); | |||
}); | |||
// Delegate for list-view page | |||
$('#list-list').on('mousedown', '.list-card', function (event) { | |||
if ($(event.target).closest('.people a, .type a').length) { | |||
return; | |||
} | |||
openModal(this); | |||
}); | }); | ||