MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 176: Line 176:


   if ($("#home").length > 0) {
   if ($("#home").length > 0) {
    console.log("The #home element exists on this page.");
     // This code will only run only on the homepage.
     // This code will only run only on the homepage.
    // Show the block view container once everything is set up
     $(".home-block-view").show();
     $(".home-block-view").show();
     $(".home-chronicle-block-button, .home-block-view-button").addClass(
     $(".home-chronicle-block-button, .home-block-view-button").addClass(
Line 184: Line 182:
     );
     );


    // Initialization and Default Settings
     // Initially hide list view sorting buttons and set the default sorted view for block
     // Initially hide list view sorting buttons and set the default sorted view for block
     $(
     $(
Line 197: Line 194:


     $(".home-list-view-button").click(function () {
     $(".home-list-view-button").click(function () {
      console.log("List view button clicked.");
       $(".home-list-sorting-buttons").css("display", "flex");
       $(".home-list-sorting-buttons").css("display", "flex");
       // Switching view classes
       // Switching view classes
Line 1,691: Line 1,687:
     });
     });
   }
   }
  // NRS ENTRIES  ---------------------  SECTION //
  console.log("Document ready!"); // Check if document ready event is triggered


   if ($("#show-article-wrapper-entry").length) {
   if ($("#show-article-wrapper-entry").length) {
    console.log("Element with id 'show-article-wrapper-entry' found!"); // Check if the target element exists
     // Your existing formatParagraphs function
     // Your existing formatParagraphs function
     function formatParagraphs(text) {
     function formatParagraphs(text) {
Line 1,785: Line 1,776:
   // Check if #submit button exists and add event listener if it does
   // Check if #submit button exists and add event listener if it does
   var submitButton = document.querySelector("#submit");
   var submitButton = document.querySelector("#submit");
  console.log("Submit button:", submitButton);


   if (submitButton) {
   if (submitButton) {
    console.log("#submit button found.");


     // Add click event listener
     // Add click event listener
     submitButton.addEventListener("click", function (event) {
     submitButton.addEventListener("click", function (event) {
      console.log("Submit button clicked.");
       event.preventDefault(); // Prevent the default link behavior
       event.preventDefault(); // Prevent the default link behavior


Navigation menu