Visitar URL original
Merge pull request #17919 from MauricioFauth/js-split-chunks · phpmyadmin/phpmyadmin@363a353 · GitHub
Skip to content

Commit 363a353

Browse files
Merge pull request #17919 from MauricioFauth/js-split-chunks
Create a `shared.js` file for common JS dependencies
2 parents 80b5358 + b2971d6 commit 363a353

72 files changed

Lines changed: 343 additions & 277 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.eslintrc.json‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
"browser": true,
1414
"es6": true
1515
},
16-
"globals": {
17-
"Functions": "readonly"
18-
},
1916
"rules": {
2017
"valid-jsdoc": ["error", {
2118
"prefer": {

‎js/src/ajax.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import $ from 'jquery';
2+
import { Functions } from './functions.js';
3+
import { Navigation } from './navigation.js';
24
import { CommonParams } from './common.js';
35

4-
/* global Navigation */
5-
66
/**
77
* This object handles ajax requests for pages. It also
88
* handles the reloading of the main menu and scripts.
@@ -436,8 +436,8 @@ const AJAX = {
436436
$('#modalOverlay').remove();
437437
}
438438
$('fieldset.disabled_for_expiration').removeAttr('disabled').removeClass('disabled_for_expiration');
439-
AJAX.fireTeardown('functions.js');
440-
AJAX.fireOnload('functions.js');
439+
AJAX.fireTeardown('main.js');
440+
AJAX.fireOnload('main.js');
441441
}
442442
if (typeof data.new_token !== 'undefined') {
443443
$('input[name=token]').val(data.new_token);

‎js/src/common.js‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import $ from 'jquery';
2-
3-
/* global Navigation */
2+
import { AJAX } from './ajax.js';
3+
import { Functions } from './functions.js';
4+
import { Navigation } from './navigation.js';
45

56
/**
67
* Holds common parameters such as server, db, table, etc
@@ -165,7 +166,7 @@ const CommonActions = {
165166
.trigger('click')
166167
.remove();
167168
if (typeof callback !== 'undefined') {
168-
window.AJAX.callback = callback;
169+
AJAX.callback = callback;
169170
}
170171
}
171172
};

‎js/src/config.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import $ from 'jquery';
2+
import { Functions } from './functions.js';
23
import { CommonParams } from './common.js';
34

45
/**

‎js/src/database/central_columns.js‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import $ from 'jquery';
2+
import { AJAX } from '../ajax.js';
3+
import { Functions } from '../functions.js';
24
import { CommonParams } from '../common.js';
35

46
/**
@@ -18,7 +20,7 @@ import { CommonParams } from '../common.js';
1820
*
1921
*/
2022

21-
window.AJAX.registerTeardown('database/central_columns.js', function () {
23+
AJAX.registerTeardown('database/central_columns.js', function () {
2224
$('.edit').off('click');
2325
$('.edit_save_form').off('click');
2426
$('.edit_cancel_form').off('click');
@@ -35,7 +37,7 @@ window.AJAX.registerTeardown('database/central_columns.js', function () {
3537
$('button[name=\'edit_central_columns\']').off('click');
3638
});
3739

38-
window.AJAX.registerOnload('database/central_columns.js', function () {
40+
AJAX.registerOnload('database/central_columns.js', function () {
3941
$('#tableslistcontainer input,#tableslistcontainer select,#tableslistcontainer .default_value,#tableslistcontainer .open_enum_editor').hide();
4042
$('#tableslistcontainer').find('.checkall').show();
4143
$('#tableslistcontainer').find('.checkall_box').show();
@@ -69,17 +71,17 @@ window.AJAX.registerOnload('database/central_columns.js', function () {
6971
var argsep = CommonParams.get('arg_separator');
7072
var editColumnData = editColumnList + '' + argsep + 'edit_central_columns_page=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server');
7173
Functions.ajaxShowMessage();
72-
window.AJAX.source = $(this);
73-
$.post('index.php?route=/database/central-columns', editColumnData, window.AJAX.responseHandler);
74+
AJAX.source = $(this);
75+
$.post('index.php?route=/database/central-columns', editColumnData, AJAX.responseHandler);
7476
});
7577
$('#multi_edit_central_columns').on('submit', function (event) {
7678
event.preventDefault();
7779
event.stopPropagation();
7880
var argsep = CommonParams.get('arg_separator');
7981
var multiColumnEditData = $('#multi_edit_central_columns').serialize() + argsep + 'multi_edit_central_column_save=true' + argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true' + argsep + 'db=' + encodeURIComponent(CommonParams.get('db')) + argsep + 'server=' + CommonParams.get('server');
8082
Functions.ajaxShowMessage();
81-
window.AJAX.source = $(this);
82-
$.post('index.php?route=/database/central-columns', multiColumnEditData, window.AJAX.responseHandler);
83+
AJAX.source = $(this);
84+
$.post('index.php?route=/database/central-columns', multiColumnEditData, AJAX.responseHandler);
8385
});
8486
$('#add_new').find('td').each(function () {
8587
if ($(this).attr('name') !== 'undefined') {

‎js/src/database/events.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import $ from 'jquery';
2+
import { AJAX } from '../ajax.js';
3+
import { Functions } from '../functions.js';
24

35
/* global Navigation */
46

5-
window.AJAX.registerTeardown('database/events.js', function () {
7+
AJAX.registerTeardown('database/events.js', function () {
68
$(document).off('click', 'a.ajax.add_anchor, a.ajax.edit_anchor');
79
$(document).off('click', 'a.ajax.export_anchor');
810
$(document).off('click', '#bulkActionExportButton');
@@ -533,7 +535,7 @@ const DatabaseEvents = {
533535
}
534536
};
535537

536-
window.AJAX.registerOnload('database/events.js', function () {
538+
AJAX.registerOnload('database/events.js', function () {
537539
/**
538540
* Attach Ajax event handlers for the Add/Edit functionality.
539541
*/

‎js/src/database/multi_table_query.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
import $ from 'jquery';
2+
import { AJAX } from '../ajax.js';
3+
import { Functions } from '../functions.js';
24
import { CommonParams } from '../common.js';
35

46
/**
57
* @fileoverview function used in QBE for DB
68
* @name Database Operations
79
*
8-
* @requires jQuery
910
* @requires jQueryUI
10-
* @requires js/functions.js
1111
* @requires js/database/query_generator.js
12-
*
1312
*/
1413

1514
/**
@@ -19,15 +18,15 @@ import { CommonParams } from '../common.js';
1918
/**
2019
* Unbind all event handlers before tearing down a page
2120
*/
22-
window.AJAX.registerTeardown('database/multi_table_query.js', function () {
21+
AJAX.registerTeardown('database/multi_table_query.js', function () {
2322
$('.tableNameSelect').each(function () {
2423
$(this).off('change');
2524
});
2625
$('#update_query_button').off('click');
2726
$('#add_column_button').off('click');
2827
});
2928

30-
window.AJAX.registerOnload('database/multi_table_query.js', function () {
29+
AJAX.registerOnload('database/multi_table_query.js', function () {
3130
var editor = Functions.getSqlEditor($('#MultiSqlquery'), {}, 'both');
3231
$('.CodeMirror-line').css('text-align', 'left');
3332
editor.setSize(-1, 50);

‎js/src/database/operations.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import $ from 'jquery';
2+
import { AJAX } from '../ajax.js';
3+
import { Functions } from '../functions.js';
24
import { CommonActions, CommonParams } from '../common.js';
35

46
/* global Navigation */
@@ -7,10 +9,7 @@ import { CommonActions, CommonParams } from '../common.js';
79
* @fileoverview function used in server privilege pages
810
* @name Database Operations
911
*
10-
* @requires jQuery
1112
* @requires jQueryUI
12-
* @requires js/functions.js
13-
*
1413
*/
1514

1615
/**
@@ -26,14 +25,14 @@ import { CommonActions, CommonParams } from '../common.js';
2625
/**
2726
* Unbind all event handlers before tearing down a page
2827
*/
29-
window.AJAX.registerTeardown('database/operations.js', function () {
28+
AJAX.registerTeardown('database/operations.js', function () {
3029
$(document).off('submit', '#rename_db_form.ajax');
3130
$(document).off('submit', '#copy_db_form.ajax');
3231
$(document).off('submit', '#change_db_charset_form.ajax');
3332
$(document).off('click', '#drop_db_anchor.ajax');
3433
});
3534

36-
window.AJAX.registerOnload('database/operations.js', function () {
35+
AJAX.registerOnload('database/operations.js', function () {
3736
/**
3837
* Ajax event handlers for 'Rename Database'
3938
*/

‎js/src/database/qbe.js‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import $ from 'jquery';
2+
import { AJAX } from '../ajax.js';
3+
import { Functions } from '../functions.js';
24

35
/**
46
* @fileoverview function used in QBE for DB
57
* @name Database Operations
68
*
7-
* @requires jQuery
89
* @requires jQueryUI
9-
* @requires js/functions.js
10-
*
1110
*/
1211

1312
/**
@@ -20,15 +19,15 @@ import $ from 'jquery';
2019
/**
2120
* Unbind all event handlers before tearing down a page
2221
*/
23-
window.AJAX.registerTeardown('database/qbe.js', function () {
22+
AJAX.registerTeardown('database/qbe.js', function () {
2423
$(document).off('change', 'select[name^=criteriaColumn]');
2524
$(document).off('change', '#searchId');
2625
$(document).off('click', '#saveSearch');
2726
$(document).off('click', '#updateSearch');
2827
$(document).off('click', '#deleteSearch');
2928
});
3029

31-
window.AJAX.registerOnload('database/qbe.js', function () {
30+
AJAX.registerOnload('database/qbe.js', function () {
3231
Functions.getSqlEditor($('#textSqlquery'), {}, 'none');
3332

3433
$('#tblQbe').width($('#tblQbe').parent().width());

‎js/src/database/query_generator.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import $ from 'jquery';
2+
import { Functions } from '../functions.js';
23

34
/**
45
* @fileoverview function used in QBE for DB
56
* @name Database Operations
67
*
7-
* @requires jQuery
88
* @requires jQueryUI
9-
* @requires js/functions.js
10-
*
119
*/
1210

1311
function getFormatsText () {

0 commit comments

Comments
 (0)