99/* global zxcvbnts */ // js/vendor/zxcvbn-ts.js
1010
1111/**
12- * general function , usually for data manipulation pages
13- *
12+ * General functions , usually for data manipulation pages.
13+ * @type { object }
1414 */
1515var Functions = { } ;
1616
1717/**
18- * @var {number} ajaxMessageCount Number of AJAX messages shown since page load
18+ * Number of AJAX messages shown since page load.
19+ * @type {number }
1920 */
20- var ajaxMessageCount = 0 ;
21+ let ajaxMessageCount = 0 ;
2122
2223/**
23- * @var codeMirrorEditor object containing CodeMirror editor of the query editor in SQL tab
24+ * Object containing CodeMirror editor of the query editor in SQL tab.
25+ * @type {(object|boolean|null) }
2426 */
2527var codeMirrorEditor = false ;
2628
2729/**
28- * @var codeMirrorInlineEditor object containing CodeMirror editor of the inline query editor
30+ * Object containing CodeMirror editor of the inline query editor.
31+ * @type {(object|boolean|null) }
2932 */
30- var codeMirrorInlineEditor = false ;
33+ let codeMirrorInlineEditor = false ;
3134
3235/**
33- * @var {boolean} sqlAutoCompleteInProgress shows if Table/Column name autocomplete AJAX is in progress
36+ * Shows if Table/Column name autocomplete AJAX is in progress.
37+ * @type {boolean }
3438 */
35- var sqlAutoCompleteInProgress = false ;
39+ let sqlAutoCompleteInProgress = false ;
3640
3741/**
38- * @var sqlAutoComplete object containing list of columns in each table
42+ * Object containing list of columns in each table.
43+ * @type {(array|boolean) }
3944 */
40- var sqlAutoComplete = false ;
45+ let sqlAutoComplete = false ;
4146
4247/**
43- * @var {string} sqlAutoCompleteDefaultTable string containing default table to autocomplete columns
48+ * String containing default table to autocomplete columns.
49+ * @type {string }
4450 */
45- var sqlAutoCompleteDefaultTable = '' ;
51+ let sqlAutoCompleteDefaultTable = '' ;
4652
4753/**
48- * @var {array} centralColumnList array to hold the columns in central list per db.
54+ * Array to hold the columns in central list per db.
55+ * @type {array }
4956 */
5057var centralColumnList = [ ] ;
5158
5259/**
53- * @var {array} primaryIndexes array to hold 'Primary' index columns.
60+ * Array to hold 'Primary' index columns.
61+ * @type {array }
5462 */
5563// eslint-disable-next-line no-unused-vars
5664var primaryIndexes = [ ] ;
5765
5866/**
59- * @var {array} uniqueIndexes array to hold 'Unique' index columns.
67+ * Array to hold 'Unique' index columns.
68+ * @type {array }
6069 */
6170// eslint-disable-next-line no-unused-vars
6271var uniqueIndexes = [ ] ;
6372
6473/**
65- * @var {array} indexes array to hold 'Index' columns.
74+ * Array to hold 'Index' columns.
75+ * @type {array }
6676 */
6777// eslint-disable-next-line no-unused-vars
6878var indexes = [ ] ;
6979
7080/**
71- * @var {array} fulltextIndexes array to hold 'Fulltext' columns.
81+ * Array to hold 'Fulltext' columns.
82+ * @type {array }
7283 */
7384// eslint-disable-next-line no-unused-vars
7485var fulltextIndexes = [ ] ;
7586
7687/**
77- * @var {array} spatialIndexes array to hold 'Spatial' columns.
88+ * Array to hold 'Spatial' columns.
89+ * @type {array }
7890 */
7991// eslint-disable-next-line no-unused-vars
8092var spatialIndexes = [ ] ;
@@ -92,6 +104,13 @@ $.ajaxPrefilter(function (options, originalOptions) {
92104 }
93105} ) ;
94106
107+ /**
108+ * @return {number }
109+ */
110+ Functions . getAjaxMessageCount = function ( ) {
111+ return ajaxMessageCount ;
112+ } ;
113+
95114/**
96115 * Adds a date/time picker to an element
97116 *
@@ -860,23 +879,29 @@ Functions.checkTableEditForm = function (theForm, fieldsCnt) {
860879
861880/**
862881 * True if last click is to check a row.
882+ * @type {boolean }
863883 */
864- var lastClickChecked = false ;
884+ let lastClickChecked = false ;
865885
866886/**
867- * Zero-based index of last clicked row.
868- * Used to handle the shift + click event in the code above.
887+ * Zero-based index of last clicked row. Used to handle the shift + click event in the code above.
888+ * @type { number }
869889 */
870- var lastClickedRow = - 1 ;
890+ let lastClickedRow = - 1 ;
871891
872892/**
873893 * Zero-based index of last shift clicked row.
894+ * @type {number }
874895 */
875- var lastShiftClickedRow = - 1 ;
896+ let lastShiftClickedRow = - 1 ;
897+
898+ /** @type {number } */
899+ let idleSecondsCounter = 0 ;
900+ /** @type {number } */
901+ let incInterval ;
902+ /** @type {number } */
903+ let updateTimeout ;
876904
877- var idleSecondsCounter = 0 ;
878- var incInterval ;
879- var updateTimeout ;
880905AJAX . registerTeardown ( 'functions.js' , function ( ) {
881906 clearTimeout ( updateTimeout ) ;
882907 clearInterval ( incInterval ) ;
@@ -981,6 +1006,7 @@ AJAX.registerOnload('functions.js', function () {
9811006 updateTimeout = window . setTimeout ( UpdateIdleTime , interval ) ;
9821007 }
9831008} ) ;
1009+
9841010/**
9851011 * Unbind all event handlers before tearing down a page
9861012 */
@@ -2426,7 +2452,6 @@ AJAX.registerOnload('functions.js', function () {
24262452 } ) ;
24272453} ) ;
24282454
2429-
24302455/**
24312456 * Validates the password field in a form
24322457 *
@@ -2623,6 +2648,7 @@ AJAX.registerTeardown('functions.js', function () {
26232648 $ ( document ) . off ( 'change' , 'input.allow_null' ) ;
26242649 $ ( document ) . off ( 'change' , '.create_table_form select[name=tbl_storage_engine]' ) ;
26252650} ) ;
2651+
26262652/**
26272653 * Toggle the hiding/showing of the "Open in ENUM/SET editor" message when
26282654 * the page loads and when the selected data type changes
@@ -3073,6 +3099,7 @@ Functions.checkIndexName = function (formId) {
30733099AJAX . registerTeardown ( 'functions.js' , function ( ) {
30743100 $ ( document ) . off ( 'click' , '#index_frm input[type=submit]' ) ;
30753101} ) ;
3102+
30763103AJAX . registerOnload ( 'functions.js' , function ( ) {
30773104 /**
30783105 * Handler for adding more columns to an index in the editor
@@ -3112,6 +3139,7 @@ AJAX.registerOnload('functions.js', function () {
31123139 }
31133140 } ) ;
31143141} ) ;
3142+
31153143Functions . indexDialogModal = function ( routeUrl , url , title , callbackSuccess , callbackFailure ) {
31163144 /* Remove the hidden dialogs if there are*/
31173145 var modal = $ ( '#indexDialogModal' ) ;
@@ -3446,6 +3474,7 @@ Functions.toggleButton = function ($obj) {
34463474AJAX . registerTeardown ( 'functions.js' , function ( ) {
34473475 $ ( 'div.toggle-container' ) . off ( 'click' ) ;
34483476} ) ;
3477+
34493478/**
34503479 * Initialise all toggle buttons
34513480 */
@@ -3634,13 +3663,15 @@ AJAX.registerOnload('functions.js', function () {
36343663 }
36353664 Functions . highlightSql ( $ ( 'body' ) ) ;
36363665} ) ;
3666+
36373667AJAX . registerTeardown ( 'functions.js' , function ( ) {
36383668 if ( codeMirrorEditor ) {
36393669 $ ( '#sqlquery' ) . text ( codeMirrorEditor . getValue ( ) ) ;
36403670 codeMirrorEditor . toTextArea ( ) ;
36413671 codeMirrorEditor = false ;
36423672 }
36433673} ) ;
3674+
36443675AJAX . registerOnload ( 'functions.js' , function ( ) {
36453676 // initializes all lock-page elements lock-id and
36463677 // val-hash data property
@@ -3856,7 +3887,7 @@ $(function () {
38563887 } ) ;
38573888} ) ;
38583889
3859- var checkboxesSel = 'input.checkall:checkbox:enabled' ;
3890+ const checkboxesSel = 'input.checkall:checkbox:enabled' ;
38603891Functions . checkboxesSel = checkboxesSel ;
38613892
38623893/**
@@ -3953,6 +3984,7 @@ $(document).on('keyup', '#filterText', function () {
39533984 } , 300 ) ;
39543985 $ ( '#filter-rows-count' ) . html ( count ) ;
39553986} ) ;
3987+
39563988AJAX . registerOnload ( 'functions.js' , function ( ) {
39573989 /* Trigger filtering of the list based on incoming database name */
39583990 var $filter = $ ( '#filterText' ) ;
@@ -4118,8 +4150,8 @@ Functions.toggleDatepickerIfInvalid = function ($td, $inputField) {
41184150 * Function to submit the login form after validation is done.
41194151 * NOTE: do NOT use a module or it will break the callback, issue #15435
41204152 */
4121- // eslint-disable-next-line no-unused-vars, camelcase
4122- var Functions_recaptchaCallback = function ( ) {
4153+ // eslint-disable-next-line no-unused-vars
4154+ var recaptchaCallback = function ( ) {
41234155 $ ( '#login_form' ) . trigger ( 'submit' ) ;
41244156} ;
41254157
0 commit comments