Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: appengine/monorail/static/js/tracker/tracker-onload.js

Issue 1868553004: Open Source Monorail (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
8 /**
9 * This file contains the Monorail onload() function that is called
10 * when each page loads.
11 */
12
13
14
15 /**
16 * This code is run on every DIT page load. It registers a handler
17 * for autocomplete on four different types of text fields based on the
18 * name of that text field.
19 */
20 function TKR_onload() {
21 _ac_install();
22
23 _ac_register(function (input, event) {
24 if (input.id.startsWith('search')) return TKR_searchStore;
25 if (input.id.startsWith('query_') || input.id.startsWith('predicate_'))
26 return TKR_projectQueryStore;
27 if (input.id.startsWith('cmd')) return TKR_quickEditStore;
28 if (input.id.startsWith('label')) return TKR_labelStore;
29 if (input.id.startsWith('component')) return TKR_componentListStore;
30 if (input.id.startsWith('status')) return TKR_statusStore;
31 if (input.id.startsWith('member')) return TKR_memberListStore;
32 if (input.id == 'admin_names_editor') return TKR_memberListStore;
33 if (input.id.startsWith('owner')) return TKR_ownerStore;
34 if (input.name == 'needs_perm' || input.name == 'grants_perm') {
35 return TKR_customPermissionsStore;
36 }
37 if (input.id == 'owner_editor') return TKR_ownerStore;
38 if (input.className.indexOf('userautocomplete') != -1) {
39 var customFieldIDStr = input.name;
40 var uac = TKR_userAutocompleteStores[customFieldIDStr];
41 if (uac) return uac;
42 return TKR_ownerStore;
43 }
44 if (input.className.indexOf('autocomplete') != -1) {
45 return TKR_autoCompleteStore;
46 }
47 if (input.id.startsWith('copy_to') || input.id.startsWith('move_to') ||
48 input.id.startsWith('new_savedquery_projects') ||
49 input.id.startsWith('savedquery_projects')) {
50 return TKR_projectStore;
51 }
52 });
53
54 _PC_Install();
55 TKR_allColumnNames = _allColumnNames;
56 TKR_labelFieldIDPrefix = _lfidprefix;
57 TKR_allOrigLabels = _allOrigLabels;
58 }
59
60
61 // External names for functions that are called directly from HTML.
62 // JSCompiler does not rename functions that begin with an underscore.
63 // They are not defined with "var" because we want them to be global.
64
65 // TODO(jrobbins): the underscore names could be shortened by a
66 // cross-file search-and-replace script in our build process.
67
68 _selectAllIssues = TKR_selectAllIssues;
69 _selectNoneIssues = TKR_selectNoneIssues;
70
71 _toggleRows = TKR_toggleRows;
72 _toggleColumn = TKR_toggleColumn;
73 _toggleColumnUpdate = TKR_toggleColumnUpdate;
74 _addGroupBy = TKR_addGroupBy;
75 _addcol = TKR_addColumn;
76 _checkRangeSelect = TKR_checkRangeSelect;
77 _makeIssueLink = TKR_makeIssueLink;
78
79 _onload = TKR_onload;
80
81 _handleListActions = TKR_handleListActions;
82 _handleDetailActions = TKR_handleDetailActions;
83
84 _fetchOptions = TKR_fetchOptions;
85 _fetchUserProjects = TKR_fetchUserProjects;
86 _setACOptions = TKR_setUpAutoCompleteStore;
87 _openIssueUpdateForm = TKR_openIssueUpdateForm;
88 _addAttachmentFields = TKR_addAttachmentFields;
89
90 _acstore = _AC_SimpleStore;
91 _accomp = _AC_Completion;
92 _acreg = _ac_register;
93
94 _formatContextQueryArgs = TKR_formatContextQueryArgs;
95 _ctxArgs = "";
96 _ctxCan = undefined;
97 _ctxQuery = undefined;
98 _ctxSortspec = undefined;
99 _ctxGroupBy = undefined;
100 _ctxDefaultColspec = undefined;
101 _ctxStart = undefined;
102 _ctxNum = undefined;
103 _ctxResultsPerPage = undefined;
104
105 _filterTo = TKR_filterTo;
106 _sortUp = TKR_sortUp;
107 _sortDown = TKR_sortDown;
108
109 _closeAllPopups = TKR_closeAllPopups;
110 _closeSubmenus = TKR_closeSubmenus;
111 _showRight = TKR_showRight;
112 _showBelow = TKR_showBelow;
113 _highlightRow = TKR_highlightRow;
114 _floatMetadata = TKR_floatMetadata;
115 _floatVertically = TKR_floatVertically;
116
117 _setFieldIDs = TKR_setFieldIDs;
118 _selectTemplate = TKR_selectTemplate;
119 _saveTemplate = TKR_saveTemplate;
120 _newTemplate = TKR_newTemplate;
121 _deleteTemplate = TKR_deleteTemplate;
122 _switchTemplate = TKR_switchTemplate;
123 _templateNames = TKR_templateNames;
124
125 _confirmNovelStatus = TKR_confirmNovelStatus;
126 _confirmNovelLabel = TKR_confirmNovelLabel;
127 _vallab = TKR_validateLabel;
128 _dirty = TKR_dirty;
129 _exposeExistingLabelFields = TKR_exposeExistingLabelFields;
130 _confirmDiscardEntry = TKR_confirmDiscardEntry;
131 _confirmDiscardUpdate = TKR_confirmDiscardUpdate;
132 _lfidprefix = undefined;
133 _allOrigLabels = undefined;
134 _checkPlusOne = TKR_checkPlusOne;
135 _checkUnrestrict = TKR_checkUnrestrict;
136
137 _clearOnFirstEvent = TKR_clearOnFirstEvent;
138 _forceProperTableWidth = TKR_forceProperTableWidth;
139
140 _acof = _ac_onfocus;
141 _acmo = _ac_mouseover;
142 _acse = _ac_select;
143 _acrob = _ac_real_onblur;
144
145 // Variables that are given values in the HTML file.
146 _allColumnNames = [];
147
148 _go = TKR_go;
149 _getColspec = TKR_getColspecElement;
150 _getSearchColspec = TKR_getSearchColspecElement;
151
152 function closeAutocompleteAndIssuePreview(e) {
153 _ac_fake_onblur(e);
154 }
155
156 if (BR_hasExcessBlurEvents()) {
157 document.addEventListener('click', closeAutocompleteAndIssuePreview, false);
158 }
159 // Make the document actually listen for click events, otherwise the
160 // event handlers above would never get called.
161 if (document.captureEvents) document.captureEvents(Event.CLICK);
162
163 _setPeoplePrefs = TKR_setPeoplePrefs
164
165 _setupKibblesOnEntryPage = TKR_setupKibblesOnEntryPage;
166 _setupKibblesOnListPage = TKR_setupKibblesOnListPage;
167 _setupKibblesOnDetailPage = TKR_setupKibblesOnDetailPage;
168
169 _checkFieldNameOnServer = TKR_checkFieldNameOnServer;
170 _checkLeafName = TKR_checkLeafName;
171
172 _addMultiFieldValueWidget = TKR_addMultiFieldValueWidget;
173 _removeMultiFieldValueWidget = TKR_removeMultiFieldValueWidget;
174 _trimCommas = TKR_trimCommas;
OLDNEW
« no previous file with comments | « appengine/monorail/static/js/tracker/tracker-nav.js ('k') | appengine/monorail/static/js/tracker/tracker-util.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698