MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Manual revert |
No edit summary Tag: Reverted |
||
Line 1: | Line 1: | ||
$ | |||
Revision as of 09:38, 20 March 2025
$(document).ready(function(){var cards=$(".card");var showArticleWrapper=$("#show-article-wrapper");var areFiltersActive=false;$(".head-box").click(function(){window.location.href="/Main_Page"});cards.each(function(){var relatedArticles=$(this).find(".related-articles");if(relatedArticles.length>0){var relatedArticleElements=relatedArticles.find(".related-article");var uniqueArticles=[];relatedArticleElements.each(function(){$(this).find("p").remove();var articleHTML=$(this)[0].outerHTML;if($.inArray(articleHTML,uniqueArticles)===-1){uniqueArticles.push(articleHTML)}});relatedArticles.empty();relatedArticles.append(uniqueArticles.join(""))}});function sortChronologically(){var cards=$(".list-container .card").get();cards.sort(function(a,b){var numberA=parseInt($(a).find(".entry-number").text().replace(/\[|\]/g,""),10);var numberB=parseInt($(b).find(".entry-number").text().replace(/\[|\]/g,""),10);return numberB-numberA});$.each(cards,function(index,item){$(".list-container").append(item)})}function randomizeCards(selector){var cards=$(selector).get();var i=cards.length,j,temp;while(--i>0){j=Math.floor(Math.random()*(i+1));temp=cards[i];cards[i]=cards[j];cards[j]=temp}$.each(cards,function(index,item){$(selector).parent().append(item)})}function sortAlphabetically(selector){var cards=$(selector).get();cards.sort(function(a,b){var titleA=$(a).find(".title").text().toUpperCase();var titleB=$(b).find(".title").text().toUpperCase();return titleA<titleB?-1:titleA>titleB?1:0});$.each(cards,function(index,item){$(selector).parent().append(item)})}function updateViews(){$(".home-chronicle-list div.list-container div.card:not(.event)").each(function(){if(!$(this).closest(".home-chronicle-block").length){var title=$(this).find(".title").detach();var images=$(this).find(".images").detach();$(this).find(".title-images").remove();var titleImagesContainer=$('<div class="title-images"></div>').append(images,title);$(this).find(".people").after(titleImagesContainer)}});$(".home-chronicle-block div.list-container div.card:not(.event)").each(function(){var titleImagesContainer=$(this).find(".title-images");if(titleImagesContainer.length){var title=titleImagesContainer.find(".title").detach();var images=titleImagesContainer.find(".images").detach();titleImagesContainer.remove();$(this).find(".people").after(title);$(this).find(".type").after(images)}else{var images=$(this).find(".images").detach();$(this).find(".type").after(images)}})}function processEventCards(){$(".card.event").each(function(){var existingContainer=$(this).find(".container-people-date");if(existingContainer.length===0){existingContainer=$('<div class="container-people-date"></div>');$(this).append(existingContainer)}var people=$(this).find(".people").detach();var date=$(this).find(".date").detach();existingContainer.append(people).append(date);if($(this).closest(".home-chronicle-block").length){if(!existingContainer.is($(this).find(".title").next())){$(this).find(".title").after(existingContainer)}}else if($(this).closest(".home-chronicle-list").length){if(!existingContainer.is($(this).find(".title").prev())){$(this).find(".title").before(existingContainer)}}})}if($("#home").length>0){console.log("The #home element exists on this page.");$(".home-block-view").show();$(".home-chronicle-block-button, .home-block-view-button").addClass("active-view-button");$(".home-chronicle-list-button, .home-random-list-button, .home-alphabetical-list-button").hide();sortChronologically();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-list-view-button").click(function(){console.log("List view button clicked.");$(".home-list-sorting-buttons").css("display","flex");$(".home-block-view").removeClass("home-block-view").addClass("home-list-view");$(".home-chronicle-block").removeClass("home-chronicle-block").addClass("home-chronicle-list");$(".home-chronicle-block-button, .home-random-block-button, .home-alphabetical-block-button").hide();$(".home-chronicle-list-button, .home-random-list-button, .home-alphabetical-list-button").show();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-block-view-button").removeClass("active-view-button");$(".home-list-view-button").addClass("active-view-button");if($(".home-chronicle-block-button").hasClass("active-view-button")){$(".home-chronicle-block-button").removeClass("active-view-button");$(".home-chronicle-list-button").addClass("active-view-button")}else if($(".home-random-block-button").hasClass("active-view-button")){$(".home-random-block-button").removeClass("active-view-button");$(".home-random-list-button").addClass("active-view-button")}else if($(".home-alphabetical-block-button").hasClass("active-view-button")){$(".home-alphabetical-block-button").removeClass("active-view-button");$(".home-alphabetical-list-button").addClass("active-view-button")}});$(".home-block-view-button").click(function(){console.log("Block view button clicked.");$(".home-list-sorting-buttons").hide();$(".home-list-view").removeClass("home-list-view").addClass("home-block-view");$(".home-chronicle-list").removeClass("home-chronicle-list").addClass("home-chronicle-block");$(".home-chronicle-block-button, .home-random-block-button, .home-alphabetical-block-button").show();$(".home-chronicle-list-button, .home-random-list-button, .home-alphabetical-list-button").hide();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-list-view-button").removeClass("active-view-button");$(".home-block-view-button").addClass("active-view-button");if($(".home-chronicle-list-button").hasClass("active-view-button")){$(".home-chronicle-list-button").removeClass("active-view-button");$(".home-chronicle-block-button").addClass("active-view-button")}else if($(".home-random-list-button").hasClass("active-view-button")){$(".home-random-list-button").removeClass("active-view-button");$(".home-random-block-button").addClass("active-view-button")}else if($(".home-alphabetical-list-button").hasClass("active-view-button")){$(".home-alphabetical-list-button").removeClass("active-view-button");$(".home-alphabetical-block-button").addClass("active-view-button")}});$(".home-chronicle-block-button").click(function(){sortChronologically();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-chronicle-block-button").addClass("active-view-button");$(".home-random-block-button").removeClass("active-view-button");$(".home-alphabetical-block-button").removeClass("active-view-button")});$(".home-random-block-button").click(function(){randomizeCards(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-random-block-button").addClass("active-view-button");$(".home-chronicle-block-button").removeClass("active-view-button");$(".home-alphabetical-block-button").removeClass("active-view-button")});$(".home-alphabetical-block-button").click(function(){sortAlphabetically(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-alphabetical-block-button").addClass("active-view-button");$(".home-chronicle-block-button").removeClass("active-view-button");$(".home-random-block-button").removeClass("active-view-button")});$(".home-chronicle-list-button").click(function(){sortChronologically();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-chronicle-list-button").addClass("active-view-button");$(".home-random-list-button").removeClass("active-view-button");$(".home-alphabetical-list-button").removeClass("active-view-button")});$(".home-random-list-button").click(function(){randomizeCards(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-random-list-button").addClass("active-view-button");$(".home-chronicle-list-button").removeClass("active-view-button");$(".home-alphabetical-list-button").removeClass("active-view-button")});$(".home-alphabetical-list-button").click(function(){sortAlphabetically(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".home-alphabetical-list-button").addClass("active-view-button");$(".home-chronicle-list-button").removeClass("active-view-button");$(".home-random-list-button").removeClass("active-view-button")})}else{console.log("NOT HOMEPAGE");$(".home-list-view").show();$(".chronicle-list-button, .list-view-button").addClass("active-view-button");$(".chronicle-block-button, .random-block-button, .alphabetical-block-button").hide();sortChronologically();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".list-view-button").click(function(){console.log("List view button clicked.");$(".list-sorting-buttons").css("display","flex");$(".block-sorting-buttons").hide();$(".home-block-view").removeClass("home-block-view").addClass("home-list-view");$(".home-chronicle-block").removeClass("home-chronicle-block").addClass("home-chronicle-list");$(".chronicle-block-button, random-block-button, alphabetical-block-button").hide();$(".chronicle-list-button, .random-list-button, .alphabetical-list-button").show();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".block-view-button").removeClass("active-view-button");$(".list-view-button").addClass("active-view-button");if($(".chronicle-block-button").hasClass("active-view-button")){$(".chronicle-block-button").removeClass("active-view-button");$(".chronicle-list-button").addClass("active-view-button")}else if($(".random-block-button").hasClass("active-view-button")){$(".random-block-button").removeClass("active-view-button");$(".random-list-button").addClass("active-view-button")}else if($(".alphabetical-block-button").hasClass("active-view-button")){$(".alphabetical-block-button").removeClass("active-view-button");$(".alphabetical-list-button").addClass("active-view-button")}});$(".block-view-button").click(function(){console.log("Block view button clicked.");$(".list-sorting-buttons").hide();$(".block-sorting-buttons").css("display","flex");$(".home-list-view").removeClass("home-list-view").addClass("home-block-view");$(".home-chronicle-list").removeClass("home-chronicle-list").addClass("home-chronicle-block");$(".chronicle-block-button, .random-block-button, .alphabetical-block-button").show();$(".chronicle-list-button, .random-list-button, .alphabetical-list-button").hide();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".list-view-button").removeClass("active-view-button");$(".block-view-button").addClass("active-view-button");if($(".chronicle-list-button").hasClass("active-view-button")){$(".chronicle-list-button").removeClass("active-view-button");$(".chronicle-block-button").addClass("active-view-button")}else if($(".random-list-button").hasClass("active-view-button")){$(".random-list-button").removeClass("active-view-button");$(".random-block-button").addClass("active-view-button")}else if($(".alphabetical-list-button").hasClass("active-view-button")){$(".alphabetical-list-button").removeClass("active-view-button");$(".alphabetical-block-button").addClass("active-view-button")}});$(".chronicle-block-button").click(function(){sortChronologically();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".chronicle-block-button").addClass("active-view-button");$(".random-block-button").removeClass("active-view-button");$(".alphabetical-block-button").removeClass("active-view-button")});$(".random-block-button").click(function(){randomizeCards(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".random-block-button").addClass("active-view-button");$(".chronicle-block-button").removeClass("active-view-button");$(".alphabetical-block-button").removeClass("active-view-button")});$(".alphabetical-block-button").click(function(){sortAlphabetically(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".alphabetical-block-button").addClass("active-view-button");$(".chronicle-block-button").removeClass("active-view-button");$(".random-block-button").removeClass("active-view-button")});$(".chronicle-list-button").click(function(){sortChronologically();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".chronicle-list-button").addClass("active-view-button");$(".random-list-button").removeClass("active-view-button");$(".alphabetical-list-button").removeClass("active-view-button")});$(".random-list-button").click(function(){randomizeCards(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".random-list-button").addClass("active-view-button");$(".chronicle-list-button").removeClass("active-view-button");$(".alphabetical-list-button").removeClass("active-view-button")});$(".alphabetical-list-button").click(function(){sortAlphabetically(".list-container .card");updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews();$(".alphabetical-list-button").addClass("active-view-button");$(".chronicle-list-button").removeClass("active-view-button");$(".random-list-button").removeClass("active-view-button")})}$(".general-toggle").click(function(){var filtersDiv=$("#filters");var resetButton=$(".reset-button");filtersDiv.toggleClass("is-visible");if(filtersDiv.hasClass("is-visible")){filtersDiv.css("display","grid").hide().slideDown(100);$(this).text("[FILTER]");$(document).on("mousedown.hideFilters",function(event){var isOutsideFilters=!filtersDiv.is(event.target)&&filtersDiv.has(event.target).length===0;var isOnToggle=$(event.target).closest(".general-toggle").length>0;if(isOutsideFilters&&!isOnToggle){filtersDiv.removeClass("is-visible").slideUp(100,function(){$(this).css("display","none")});$(".general-toggle").text("[FILTER]");$(document).off("mousedown.hideFilters")}})}else{filtersDiv.slideUp(100,function(){$(this).css("display","none")});$(this).text("[FILTER]");$(document).off("mousedown.hideFilters")}updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews()});$(".open-filter").click(function(event){event.stopPropagation();var filterType=$(this).closest(".filter").data("filter");var cardSelector=$(".card").length>0?".card":".community-card";console.log("Filter type:",filterType,"Card Selector:",cardSelector);$("#values-"+filterType).toggle();if($("#values-"+filterType).is(":visible")){$(this).addClass("active-filter")}else{$(this).removeClass("active-filter")}updateLastVisibleCard(cardSelector);updateWidthBlockView(cardSelector);processEventCards(cardSelector);updateViews(cardSelector);console.log("Updated views and borders after filter toggle")});function filterCards(){var displayCountsHtml="";var cardSelector=$(".card").length>0?".card":".community-card";$(".filter .values a[title]").each(function(){var anchor=$(this);var filterValue=anchor.attr("title").toLowerCase();var count=0;if(anchor.find("button").hasClass("active")){$(cardSelector).each(function(){var card=$(this);$(".filter").each(function(){var filterType=$(this).data("filter");var cardValue=card.find("."+filterType).text().toLowerCase();if(cardValue.indexOf(filterValue)!==-1){count++}})});displayCountsHtml+="<span>["+count+"] "+filterValue+"</span> "}});if(displayCountsHtml){$(".count-filtered-cards").html(displayCountsHtml).show()}else{$(".count-filtered-cards").hide()}applyFiltering(cardSelector);updateLastVisibleCard(cardSelector);updateWidthBlockView(cardSelector);processEventCards(cardSelector);updateViews(cardSelector);console.log("Filtering process complete, updated views and borders")}function applyFiltering(){var cardSelector=$(".card").length>0?".card":".community-card";$(cardSelector).show().each(function(){var card=$(this);var hideCard=false;$(".filter").each(function(){if(hideCard)return;var filterType=$(this).data("filter");var activeFilters=$(this).find(".values a[title] button.active").map(function(){return $(this).parent("a").attr("title").toLowerCase()}).get();if(activeFilters.length>0){var cardValue=card.find("."+filterType).text().toLowerCase();var matchesFilter=activeFilters.some(function(filterValue){return cardValue.indexOf(filterValue)!==-1});if(!matchesFilter)hideCard=true}});if(hideCard)card.hide()})}function updateLastVisibleCard(){$(".home-chronicle-list div.list-container div.card").removeClass("last-visible");var lastVisibleCard=$(".home-chronicle-list div.list-container div.card:visible:last");lastVisibleCard.addClass("last-visible")}function updateWidthBlockView(){$(".home-chronicle-block div.list-container").css("width","100%");$(".home-chronicle-block div.list-container div.card").css("width","calc(20% - 0px)");$(".home-chronicle-block div.list-container div.card:nth-child(5n + 1)").css("width","calc(20% + 4px)")}$(".reset-filter").click(function(event){event.stopPropagation();$("#filters .values button").removeClass("active");$(".open-filter").removeClass("active-filter");$(".count-filtered-cards").text("").hide();filterCards();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews()});$("#filters .values button").click(function(){console.log("Filter is clicked!!!");$(this).toggleClass("active");filterCards();updateLastVisibleCard();updateWidthBlockView();processEventCards();updateViews()});$(window).on("scroll",function(){var filtersDiv=$("#filters");if(filtersDiv.hasClass("is-visible")){filtersDiv.removeClass("is-visible").slideUp(100,function(){$(this).css("display","none")});$(".general-toggle").text("[FILTER]")}});function formatParagraphs(text){var paragraphs=text.split("\n").filter(function(p){return p.trim()!==""});return paragraphs.map(function(p){return"<p>"+p.trim()+"</p>"}).join("")}var images=[];$(".article-images .image-container").each(function(){var img=$(this).find("img");var captionDiv=$(this).find('div[class^="caption-image"]');var image={src:img.attr("src"),alt:img.attr("alt"),caption:captionDiv.text(),captionClass:captionDiv.attr("class")};images.push(image)});if(images.length>0){setupImageToggle(images);updateImageLabel(1,images.length)}function setupImageToggle(images){var currentIndex=0;var enableNavigation=images.length>1;function showImage(index){currentIndex=index;var image=images[currentIndex];updateImageLabel(currentIndex+1,images.length);$("#article-content").find(".article-images").html(getImageHtml(image,currentIndex,images.length,enableNavigation))}if(enableNavigation){$("#article-content").on("click",".next-arrow",function(){showImage((currentIndex+1)%images.length)});$("#article-content").on("click",".prev-arrow",function(){showImage((currentIndex-1+images.length)%images.length)})}showImage(currentIndex)}function getImageHtml(image,currentIndex,totalImages,enableNavigation){var imageLabel=currentIndex+1+"/"+totalImages+" IMAGES";var navigationHtml=enableNavigation?'<div class="prev-arrow"><</div><div class="next-arrow">></div>':"";return'<div class="image-navigation">'+'<p class="article-label-image">'+imageLabel+"</p>"+'<div class="image-container">'+'<div class="arrows-and-image">'+navigationHtml+'<img src="'+image.src+'" alt="'+image.alt+'">'+"</div>"+'<div class="'+image.captionClass+'">'+image.caption+"</div>"+"</div>"+"</div>"}function updateImageLabel(currentIndex,totalImages){var imageLabel=currentIndex+"/"+totalImages+" IMAGES";$("#article-content .article-label-image").text(imageLabel)}$(".caption-image1").each(function(){var htmlContent=$(this).html();var lines=htmlContent.split("<br>");var wrappedLines=lines.map(function(line){return'<span class="caption-line">'+line+"</span>"});var newHtml=wrappedLines.join("<br>");$(this).html(newHtml)});function setShowArticleRotationEffect(){const offset=20;const showArticle=document.querySelector("#show-article");const h=showArticle.clientHeight;const theta=-Math.atan(offset/h);const a=Math.cos(theta);const b=Math.sin(theta);const c=-Math.sin(theta);const d=Math.cos(theta);const showArticleBefore=document.querySelector("#show-article-before");const transformValue="matrix("+a+","+b+","+c+","+d+",0,0)";showArticleBefore.style.transform=transformValue}function openEvent(element,event){event.stopPropagation();event.preventDefault();var url=$(element).find(".link a").attr("href");if(url){window.open(url,"_blank").focus()}}function openModal(cardElement,event){event.stopPropagation();console.log("openModal function called.");var isRelatedArticle=$(cardElement).hasClass("related-article");showArticleWrapper.css("display","block");$("#article-title").empty();$("#article-content").empty();if(isRelatedArticle){var cardImages=[];for(var i=1;i<=5;i++){var imageClass=".related-article-image"+i;var captionClass=".related-article-caption-image"+i;var imageElem=$(cardElement).find(imageClass+" img");if(imageElem.length){var captionText=$(cardElement).find(imageClass+" "+captionClass).text();cardImages.push({link:$(cardElement).find(imageClass+" a").attr("href"),src:imageElem.attr("src"),alt:imageElem.attr("alt"),caption:captionText,captionClass:"related-article-caption-image"+i})}}if(cardImages.length>1){setupImageToggle(cardImages)}var entryNumber=$(cardElement).find(".related-article-entry-number").text();var peopleHtml=$(cardElement).find(".related-article-people").html();var title=$(cardElement).find(".related-article-title").text();var typeHtml=$(cardElement).find(".related-article-type").html();var externalPdfURL=$(cardElement).find(".related-article-pdf a").attr("href");var externalLinkURL=$(cardElement).find(".related-article-link a").attr("href");var entity=$(cardElement).find(".related-article-entity").text();var discipline=$(cardElement).find(".related-article-discipline").text();var subjectHtml=$(cardElement).find(".related-article-subject").html();var description=$(cardElement).find(".related-article-description").html();var reflection=$(cardElement).find(".related-article-reflection").html();var quote=$(cardElement).find(".related-article-quote").text();var modificationDate=$(cardElement).find(".related-article-modification-date").text();$("#article-title").html('<p class="article-entry-number">'+entryNumber+'</p><p class="article-people">'+peopleHtml+"</p>");var articleContentHtml='<div class="article-title-link">';articleContentHtml+='<p class="article-title">'+title+"</p>";articleContentHtml+='<div class="link-pdf">';if(externalPdfURL){articleContentHtml+='<a href="'+externalPdfURL+'" target="_blank" class="pdf-link-icon">[PDF<span class="text-symbol">⤴</span>]</a>'}if(externalLinkURL){articleContentHtml+='<a href="'+externalLinkURL+'" target="_blank" class="external-link-icon">[WEB<span class="text-symbol">⤴</span>]</a>'}articleContentHtml+="</div>";articleContentHtml+="</div>";articleContentHtml+='<p class="article-type">'+typeHtml+"</p>"+'<div class="article-metadata">'+'<div class="article-metadata-column">'+'<p class="article-metadata-label">Entity</p>'+'<p class="article-metadata-value">'+entity+"</p>"+"</div>"+'<div class="article-metadata-column">'+'<p class="article-metadata-label">Discipline</p>'+'<p class="article-metadata-value">'+discipline+"</p>"+"</div>"+'<div class="article-metadata-column">'+'<p class="article-metadata-label">Subject(s)</p>'+'<p class="article-metadata-value">'+subjectHtml+"</p>"+"</div>"+"</div>";if(cardImages.length>0){var initialImage=cardImages[0];var enableNavigation=cardImages.length>1;articleContentHtml+='<div class="article-images">'+getImageHtml(initialImage,0,cardImages.length,enableNavigation)+"</div>"}articleContentHtml+=(description?'<p class="article-label-description">Description</p>'+'<div class="article-description">'+formatParagraphs(description)+"</div>":"")+(reflection?'<p class="article-label-reflection">Reflection</p>'+'<div class="article-reflection">'+formatParagraphs(reflection)+"</div>":"")+(quote?'<p class="article-label-quote">Quote</p>'+'<p class="article-quote">'+quote+"</p>":"")+'<p class="article-label-modification-date">Added on</p>'+'<div class="article-modification-date">'+modificationDate+"</div>";$("#article-content").html(articleContentHtml)}else{var cardImages=[];for(var i=1;i<=5;i++){var imageClass=".image"+i;var captionClass=".caption-image"+i;var imageElem=$(cardElement).find(imageClass+" img");if(imageElem.length){var captionText=$(cardElement).find(imageClass+" "+captionClass).text();cardImages.push({link:$(cardElement).find(imageClass+" a").attr("href"),src:imageElem.attr("src"),alt:imageElem.attr("alt"),caption:captionText,captionClass:"caption-image"+i})}}if(cardImages.length>1){setupImageToggle(cardImages)}var entryNumber=$(cardElement).find(".entry-number").text();var title=$(cardElement).find(".title").text();var peopleHtml=$(cardElement).find(".people").html();var typeHtml=$(cardElement).find(".type").html();var externalPdfURL=$(cardElement).find(".pdf a").attr("href");var externalLinkURL=$(cardElement).find(".link a").attr("href");var entity=$(cardElement).find(".entity").text();var discipline=$(cardElement).find(".discipline").text();var subjectHtml=$(cardElement).find(".subject").html();var description=$(cardElement).find(".description").html();var reflection=$(cardElement).find(".reflection").html();var quote=$(cardElement).find(".quote").text();var externalReferenceHtml=$(cardElement).find(".external-reference").html();var modificationDate=$(cardElement).find(".modification-date").text();var relatedArticlesHtml=$(cardElement).find(".related-articles").html();$("#article-title").html('<p class="article-entry-number">'+entryNumber+'</p><p class="article-people">'+peopleHtml+"</p>");var articleContentHtml='<div class="article-title-link">';articleContentHtml+='<p class="article-title">'+title+"</p>";articleContentHtml+='<div class="link-pdf">';if(externalPdfURL){articleContentHtml+='<a href="'+externalPdfURL+'" target="_blank" class="pdf-link-icon">[PDF<span class="text-symbol">⤴</span>]</a>'}if(externalLinkURL){articleContentHtml+='<a href="'+externalLinkURL+'" target="_blank" class="external-link-icon">[WEB<span class="text-symbol">⤴</span>]</a>'}articleContentHtml+="</div>";articleContentHtml+="</div>";articleContentHtml+='<p class="article-type">'+typeHtml+"</p>"+'<div class="article-metadata">'+'<div class="article-metadata-column">'+'<p class="article-metadata-label">Entity</p>'+'<p class="article-metadata-value">'+entity+"</p>"+"</div>"+'<div class="article-metadata-column">'+'<p class="article-metadata-label">Discipline</p>'+'<p class="article-metadata-value">'+discipline+"</p>"+"</div>"+'<div class="article-metadata-column">'+'<p class="article-metadata-label">Subject(s)</p>'+'<p class="article-metadata-value">'+subjectHtml+"</p>"+"</div>"+"</div>";if(cardImages.length>0){var initialImage=cardImages[0];var enableNavigation=cardImages.length>1;articleContentHtml+='<div class="article-images">'+getImageHtml(initialImage,0,cardImages.length,enableNavigation)+"</div>"}articleContentHtml+=(description?'<p class="article-label-description">Description</p>'+'<div class="article-description">'+formatParagraphs(description)+"</div>":"")+(reflection?'<p class="article-label-reflection">Reflection</p>'+'<div class="article-reflection">'+formatParagraphs(reflection)+"</div>":"")+(externalReferenceHtml?'<p class="article-label-external-reference">References</p>'+'<p class="article-external-reference">'+externalReferenceHtml+"</p>":"")+(quote?'<p class="article-label-quote">Quote</p>'+'<p class="article-quote">'+quote+"</p>":"")+'<p class="article-label-modification-date">Added on</p>'+'<div class="article-modification-date">'+modificationDate+"</div>";$("#article-content").html(articleContentHtml);$("#related-articles").html(relatedArticlesHtml);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()}}if($(".home-chronicle-list").is(":visible")){$(".home-list-view").each(function(){var currentWidth=$(this).width();$(this).data("originalWidth",currentWidth);$(this).css("width","calc(60% - 2px)")});$(".home-chronicle-list .type").each(function(){var currentLeft=$(this).css("left");$(this).data("originalLeft",currentLeft);$(this).css("left","85%")})}else if($(".home-chronicle-block").is(":visible")){$(".home-chronicle-block div.list-container").each(function(){var currentWidth=$(this).width();$(this).css("width","calc(60% - 0px)")});$(".home-chronicle-block div.list-container div.card").each(function(){var currentWidth=$(this).width();$(this).css("width","calc(33.333% - 0px)")})}$(".list-container").addClass("fade-out")}function closeModal(){if($(".home-chronicle-list").is(":visible")){$(".home-list-view").css("width","100%");$(".home-chronicle-list div.list-container div.card div.type").css("left","90%")}else if($(".home-chronicle-block").is(":visible")){updateWidthBlockView()}showArticleWrapper.hide()}$(".card").on("click",function(event){if($(event.target).closest(".people a, .type a").length){return}if($(this).hasClass("event")){event.stopImmediatePropagation();openEvent(this,event);$(".list-container").removeClass("fade-out");closeModal()}else{openModal(this,event);setShowArticleRotationEffect()}});$("#show-article-wrapper").on("click",".related-article",function(event){openModal(this,event);setShowArticleRotationEffect()});$("#close-button").on("click",function(){$(".list-container").removeClass("fade-out");closeModal()});$(document).on("mousedown",function(event){var isOutsideWrapper=!showArticleWrapper.is(event.target)&&showArticleWrapper.has(event.target).length===0;var isOnCard=$(event.target).closest(".card, .list-card").length>0;if(!areFiltersActive){if(isOutsideWrapper&&!isOnCard){$(".list-container").removeClass("fade-out");showArticleWrapper.css("display","none");closeModal()}}});$("#show-article-wrapper").hover(function(){$(this).css("overflow-y","auto");$(this).css("overflow-x","hidden")},function(){$(this).css("overflow-y","hidden");$(this).css("overflow-x","hidden")});if($(".community-card").length){formatCommunityCardDescriptions()}function formatCommunityCardDescriptions(){$(".community-card").each(function(){var descriptionContainer=$(this).find(".community-description");var rawDescription=descriptionContainer.text();var formattedDescription=formatParagraphs(rawDescription);descriptionContainer.html(formattedDescription);$(this).find("*").each(function(){if($(this).is(":empty")||$(this).html().trim()==="<br>"){$(this).remove()}})})}console.log("Document ready!");if($("#show-article-wrapper-entry").length){console.log("Element with id 'show-article-wrapper-entry' found!");function formatParagraphs(text){var paragraphs=text.split("\n").filter(function(p){return p.trim()!==""});return paragraphs.map(function(p){return"<p>"+p.trim()+"</p>"}).join("")}if($(".article-description").length){console.log("Element with class 'article-description' found!");var descriptionText=$(".article-description").text();console.log("Original description text:",descriptionText);var formattedDescription=formatParagraphs(descriptionText);console.log("Formatted description text:",formattedDescription);$(".article-description").html(formattedDescription)}if($(".article-reflection").length){console.log("Element with class 'article-reflection' found!");var reflectionText=$(".article-reflection").text();console.log("Original reflection text:",reflectionText);var formattedReflection=formatParagraphs(reflectionText);console.log("Formatted reflection text:",formattedReflection);$(".article-reflection").html(formattedReflection)}}if($(".mw-search-results-info").length){var $paragraph=$(".mw-search-results-info > p");var currentText=$paragraph.text().trim();if(currentText!=="There were no results matching the query."){$paragraph.text("Pages related to your Search")}}var encounteredTitles={};$(".mw-search-result-heading").each(function(){var title=$(this).find("a").attr("title");if(encounteredTitles[title]){$(this).hide()}else{encounteredTitles[title]=true}});$(".mw-search-results-container").contents().filter(function(){return this.nodeType===3}).remove();var newFormHtml='<form action="/index.php" id="searchform">'+'<div id="simpleSearchSpecial" class="right-inner-addon">'+"<span>[ Search ]</span>"+'<input class="form-control" name="search" placeholder="" title="Search [alt-shift-f]" accesskey="f" id="searchInput" tabindex="1" autocomplete="off" type="search">'+'<span class="closing-bracket">]</span>'+'<input value="Special:Search" name="title" type="hidden">'+"</div>"+"</form>";$("#searchText").replaceWith(newFormHtml);$(".oo-ui-actionFieldLayout-button .oo-ui-buttonInputWidget").remove();var submitButton=document.querySelector("#submit");console.log("Submit button:",submitButton);if(submitButton){console.log("#submit button found.");submitButton.addEventListener("click",function(event){console.log("Submit button clicked.");event.preventDefault();var email="submit@softwear.directory";var subject="new entry to the softwear directory";var body="☺ the following content could be interesting for the directory:\n\n"+"[ author / creator ]\n\n"+"---\n\n"+"[ title ]\n\n"+"---\n\n"+"[ why should it be included? ]\n\n"+"---\n\n"+"[ link or pdf ]\n\n"+"---\n\n"+"[ your name / contact / social ]\n\n"+"---";var mailtoLink="mailto:"+encodeURIComponent(email)+"?subject="+encodeURIComponent(subject)+"&body="+encodeURIComponent(body).replace(/%20/g," ");window.location.href=mailtoLink})}});