diff options
-rw-r--r-- | js/src/ajax.js | 15 | ||||
-rw-r--r-- | js/src/main.js | 10 | ||||
-rw-r--r-- | libraries/classes/Header.php | 1 | ||||
-rw-r--r-- | webpack.config.js | 1 |
4 files changed, 12 insertions, 15 deletions
diff --git a/js/src/ajax.js b/js/src/ajax.js index f07e03072f..7df310511c 100644 --- a/js/src/ajax.js +++ b/js/src/ajax.js @@ -936,18 +936,3 @@ window.AJAX = { }; } }; - -window.AJAX.registerOnload('functions.js', function () { - window.AJAX.removeSubmitEvents(); -}); - -$(window.AJAX.loadEventHandler()); - -/** - * Attach a generic event handler to clicks - * on pages and submissions of forms - */ -$(document).on('click', 'a', window.AJAX.requestHandler); -$(document).on('submit', 'form', window.AJAX.requestHandler); - -$(document).on('ajaxError', window.AJAX.getFatalErrorHandler()); diff --git a/js/src/main.js b/js/src/main.js new file mode 100644 index 0000000000..9a00241c04 --- /dev/null +++ b/js/src/main.js @@ -0,0 +1,10 @@ +window.AJAX.registerOnload('functions.js', () => window.AJAX.removeSubmitEvents()); +$(window.AJAX.loadEventHandler()); + +/** + * Attach a generic event handler to clicks on pages and submissions of forms. + */ +$(document).on('click', 'a', window.AJAX.requestHandler); +$(document).on('submit', 'form', window.AJAX.requestHandler); + +$(document).on('ajaxError', window.AJAX.getFatalErrorHandler()); diff --git a/libraries/classes/Header.php b/libraries/classes/Header.php index 48edfe469e..d38422df0b 100644 --- a/libraries/classes/Header.php +++ b/libraries/classes/Header.php @@ -132,6 +132,7 @@ class Header $this->scripts->addFile('vendor/jquery/jquery-migrate.js'); $this->scripts->addFile('vendor/sprintf.js'); $this->scripts->addFile('ajax.js'); + $this->scripts->addFile('main.js'); $this->scripts->addFile('keyhandler.js'); $this->scripts->addFile('vendor/jquery/jquery-ui.min.js'); $this->scripts->addFile('name-conflict-fixes.js'); diff --git a/webpack.config.js b/webpack.config.js index 387013af6f..83bfe6936d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -49,6 +49,7 @@ module.exports = [ 'jqplot/plugins/jqplot.byteFormatter': './js/src/jqplot/plugins/jqplot.byteFormatter.js', 'jquery.sortable-table': './js/src/jquery.sortable-table.js', 'keyhandler': './js/src/keyhandler.js', + 'main': './js/src/main.js', 'makegrid': './js/src/makegrid.js', 'menu_resizer': './js/src/menu_resizer.js', 'multi_column_sort': './js/src/multi_column_sort.js', |