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