project/src/main/webapp/script.js
/**
 * Loads header and displays the page corresponding to the current url.
 */
Loads header and displays the page corresponding to the current url.
Loads header and displays the page corresponding to the current url .
function loadHeader() {
  $('#header').load('header.html', function() {
    $('.active').removeClass('active');
    const currentPageArr = window.location.href.split(/[/|.]/);
    const currentPage = currentPageArr[currentPageArr.length - 2];
    if (currentPage === 'profile') {
      $('#profile-header').addClass('active');
    } else if (currentPage === 'events-feed') {
      $('#feed-header').addClass('active');
    }
    addLogoutUrlToButton();
    populateExistingImage('profile', '#profile-picture')
  });
}
function loadHeader ( ) { $ ( '#header' ) . load ( 'header.html' , function ( ) { $ ( '.active' ) . removeClass ( 'active' ) ; const currentPageArr = window . location . href . split ( / [/|.] / ) ; const currentPage = currentPageArr [ currentPageArr . length - 2 ] ; if ( currentPage === 'profile' ) { $ ( '#profile-header' ) . addClass ( 'active' ) ; } else if ( currentPage === 'events-feed' ) { $ ( '#feed-header' ) . addClass ( 'active' ) ; } addLogoutUrlToButton ( ) ; populateExistingImage ( 'profile' , '#profile-picture' ) } ) ; }
Loads header and displays the page corresponding to the current url.
Loads header and displays the page corresponding to the current url .