Merge pull request #17615 from MauricioFauth/main-js-file
Move side effects from JS files into the `main.js` file
This commit is contained in:
commit
14f90d77f8
@ -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());
|
||||
|
||||
@ -824,6 +824,3 @@ window.Config = {
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
window.AJAX.registerTeardown('config.js', window.Config.off());
|
||||
window.AJAX.registerOnload('config.js', window.Config.on());
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
* Conditionally included if framing is not allowed.
|
||||
* @return {void}
|
||||
*/
|
||||
const crossFramingProtection = () => {
|
||||
window.crossFramingProtection = () => {
|
||||
if (window.allowThirdPartyFraming) {
|
||||
return;
|
||||
}
|
||||
@ -20,5 +20,3 @@ const crossFramingProtection = () => {
|
||||
|
||||
styleElement.parentNode.removeChild(styleElement);
|
||||
};
|
||||
|
||||
crossFramingProtection();
|
||||
|
||||
@ -151,6 +151,3 @@ const KeyHandlerEvents = {
|
||||
};
|
||||
|
||||
window.KeyHandlerEvents = KeyHandlerEvents;
|
||||
|
||||
window.AJAX.registerTeardown('keyhandler.js', window.KeyHandlerEvents.off());
|
||||
window.AJAX.registerOnload('keyhandler.js', window.KeyHandlerEvents.on());
|
||||
|
||||
18
js/src/main.js
Normal file
18
js/src/main.js
Normal file
@ -0,0 +1,18 @@
|
||||
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());
|
||||
|
||||
window.AJAX.registerTeardown('keyhandler.js', window.KeyHandlerEvents.off());
|
||||
window.AJAX.registerOnload('keyhandler.js', window.KeyHandlerEvents.on());
|
||||
|
||||
window.crossFramingProtection();
|
||||
|
||||
window.AJAX.registerTeardown('config.js', window.Config.off());
|
||||
window.AJAX.registerOnload('config.js', window.Config.on());
|
||||
@ -143,6 +143,7 @@ class Header
|
||||
$this->scripts->addFile('cross_framing_protection.js');
|
||||
$this->scripts->addFile('messages.php', ['l' => $GLOBALS['lang']]);
|
||||
$this->scripts->addFile('config.js');
|
||||
$this->scripts->addFile('main.js');
|
||||
$this->scripts->addFile('doclinks.js');
|
||||
$this->scripts->addFile('functions.js');
|
||||
$this->scripts->addFile('navigation.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',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user