Skip to content

Commit

Permalink
Extract side effects from navigation.js file
Browse files Browse the repository at this point in the history
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Jun 30, 2022
1 parent 9c09feb commit ac55dab
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions js/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ $(Functions.dismissNotifications());
$(Functions.initializeMenuResizer());
$(Functions.floatingMenuBar());
$(Functions.breadcrumbScrollToTop());

$(Navigation.onload());
8 changes: 4 additions & 4 deletions js/src/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ Navigation.traverseForPaths = function () {
};

/**
* Executed on page load
* @return {function}
*/
$(function () {
Navigation.onload = () => function () {
if (! $('#pma_navigation').length) {
// Don't bother running any code if the navigation is not even on the page
return;
Expand Down Expand Up @@ -327,7 +327,7 @@ $(function () {
Navigation.reload(hideNav);
});

$(document).on('change', '#navi_db_select', function () {
$(document).on('change', '#navi_db_select', function () {
if (! $(this).val()) {
window.CommonParams.set('db', '');
Navigation.reload();
Expand Down Expand Up @@ -582,7 +582,7 @@ $(function () {
Navigation.reload();
}
}
});
};

/**
* Expands a node in navigation tree.
Expand Down
2 changes: 1 addition & 1 deletion libraries/classes/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ private function addDefaultScripts(): void
$this->scripts->addFile('config.js');
$this->scripts->addFile('doclinks.js');
$this->scripts->addFile('functions.js');
$this->scripts->addFile('main.js');
$this->scripts->addFile('navigation.js');
$this->scripts->addFile('main.js');
$this->scripts->addFile('indexes.js');
$this->scripts->addFile('common.js');
$this->scripts->addFile('page_settings.js');
Expand Down

0 comments on commit ac55dab

Please sign in to comment.