Adrià Vilanova MartÃnez | f19ea43 | 2024-01-23 20:20:52 +0100 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 4 | /* eslint-disable camelcase */ |
| 5 | /* eslint-disable no-unused-vars */ |
| 6 | |
| 7 | |
| 8 | /** |
| 9 | * This file contains the Monorail onload() function that is called |
| 10 | * when each EZT page loads. |
| 11 | */ |
| 12 | |
| 13 | |
| 14 | /** |
| 15 | * This code is run on every DIT page load. It registers a handler |
| 16 | * for autocomplete on four different types of text fields based on the |
| 17 | * name of that text field. |
| 18 | */ |
| 19 | function TKR_onload() { |
| 20 | TKR_install_ac(); |
| 21 | _PC_Install(); |
| 22 | TKR_allColumnNames = _allColumnNames; |
| 23 | TKR_labelFieldIDPrefix = _lfidprefix; |
| 24 | TKR_allOrigLabels = _allOrigLabels; |
| 25 | TKR_initialFormValues = TKR_currentFormValues(); |
| 26 | } |
| 27 | |
| 28 | // External names for functions that are called directly from HTML. |
| 29 | // JSCompiler does not rename functions that begin with an underscore. |
| 30 | // They are not defined with "var" because we want them to be global. |
| 31 | |
| 32 | // TODO(jrobbins): the underscore names could be shortened by a |
| 33 | // cross-file search-and-replace script in our build process. |
| 34 | |
| 35 | _selectAllIssues = TKR_selectAllIssues; |
| 36 | _selectNoneIssues = TKR_selectNoneIssues; |
| 37 | |
| 38 | _toggleRows = TKR_toggleRows; |
| 39 | _toggleColumn = TKR_toggleColumn; |
| 40 | _toggleColumnUpdate = TKR_toggleColumnUpdate; |
| 41 | _addGroupBy = TKR_addGroupBy; |
| 42 | _addcol = TKR_addColumn; |
| 43 | _checkRangeSelect = TKR_checkRangeSelect; |
| 44 | _makeIssueLink = TKR_makeIssueLink; |
| 45 | |
| 46 | _onload = TKR_onload; |
| 47 | |
| 48 | _handleListActions = TKR_handleListActions; |
| 49 | _handleDetailActions = TKR_handleDetailActions; |
| 50 | |
| 51 | _loadStatusSelect = TKR_loadStatusSelect; |
| 52 | _fetchUserProjects = TKR_fetchUserProjects; |
| 53 | _setACOptions = TKR_setUpAutoCompleteStore; |
| 54 | _openIssueUpdateForm = TKR_openIssueUpdateForm; |
| 55 | _addAttachmentFields = TKR_addAttachmentFields; |
| 56 | _ignoreWidgetIfOpIsClear = TKR_ignoreWidgetIfOpIsClear; |
| 57 | |
| 58 | _acstore = _AC_SimpleStore; |
| 59 | _accomp = _AC_Completion; |
| 60 | _acreg = _ac_register; |
| 61 | |
| 62 | _formatContextQueryArgs = TKR_formatContextQueryArgs; |
| 63 | _ctxArgs = ''; |
| 64 | _ctxCan = undefined; |
| 65 | _ctxQuery = undefined; |
| 66 | _ctxSortspec = undefined; |
| 67 | _ctxGroupBy = undefined; |
| 68 | _ctxDefaultColspec = undefined; |
| 69 | _ctxStart = undefined; |
| 70 | _ctxNum = undefined; |
| 71 | _ctxResultsPerPage = undefined; |
| 72 | |
| 73 | _filterTo = TKR_filterTo; |
| 74 | _sortUp = TKR_sortUp; |
| 75 | _sortDown = TKR_sortDown; |
| 76 | |
| 77 | _closeAllPopups = TKR_closeAllPopups; |
| 78 | _closeSubmenus = TKR_closeSubmenus; |
| 79 | _showRight = TKR_showRight; |
| 80 | _showBelow = TKR_showBelow; |
| 81 | _highlightRow = TKR_highlightRow; |
| 82 | |
| 83 | _setFieldIDs = TKR_setFieldIDs; |
| 84 | _selectTemplate = TKR_selectTemplate; |
| 85 | _saveTemplate = TKR_saveTemplate; |
| 86 | _newTemplate = TKR_newTemplate; |
| 87 | _deleteTemplate = TKR_deleteTemplate; |
| 88 | _switchTemplate = TKR_switchTemplate; |
| 89 | _templateNames = TKR_templateNames; |
| 90 | |
| 91 | _confirmNovelStatus = TKR_confirmNovelStatus; |
| 92 | _confirmNovelLabel = TKR_confirmNovelLabel; |
| 93 | _vallab = TKR_validateLabel; |
| 94 | _exposeExistingLabelFields = TKR_exposeExistingLabelFields; |
| 95 | _confirmDiscardEntry = TKR_confirmDiscardEntry; |
| 96 | _confirmDiscardUpdate = TKR_confirmDiscardUpdate; |
| 97 | _lfidprefix = undefined; |
| 98 | _allOrigLabels = undefined; |
| 99 | _checkPlusOne = TKR_checkPlusOne; |
| 100 | _checkUnrestrict = TKR_checkUnrestrict; |
| 101 | |
| 102 | _clearOnFirstEvent = TKR_clearOnFirstEvent; |
| 103 | _forceProperTableWidth = TKR_forceProperTableWidth; |
| 104 | |
| 105 | _initialFormValues = TKR_initialFormValues; |
| 106 | _currentFormValues = TKR_currentFormValues; |
| 107 | |
| 108 | _acof = _ac_onfocus; |
| 109 | _acmo = _ac_mouseover; |
| 110 | _acse = _ac_select; |
| 111 | _acrob = _ac_ob; |
| 112 | |
| 113 | // Variables that are given values in the HTML file. |
| 114 | _allColumnNames = []; |
| 115 | |
| 116 | _go = TKR_go; |
| 117 | _getColspec = TKR_getColspecElement; |
| 118 | |
| 119 | // Make the document actually listen for click events, otherwise the |
| 120 | // event handlers above would never get called. |
| 121 | if (document.captureEvents) document.captureEvents(Event.CLICK); |
| 122 | |
| 123 | _setupKibblesOnEntryPage = TKR_setupKibblesOnEntryPage; |
| 124 | _setupKibblesOnListPage = TKR_setupKibblesOnListPage; |
| 125 | |
| 126 | _checkFieldNameOnServer = TKR_checkFieldNameOnServer; |
| 127 | _checkLeafName = TKR_checkLeafName; |
| 128 | |
| 129 | _addMultiFieldValueWidget = TKR_addMultiFieldValueWidget; |
| 130 | _removeMultiFieldValueWidget = TKR_removeMultiFieldValueWidget; |
| 131 | _trimCommas = TKR_trimCommas; |
| 132 | |
| 133 | _initDragAndDrop = TKR_initDragAndDrop; |