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

Side by Side Diff: chrome/browser/resources/feedback.js

Issue 10010019: JS style nits (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: couple more Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/crashes.js ('k') | chrome/browser/resources/flags.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Constants. 5 // Constants.
6 var FEEDBACK_LANDING_PAGE = 6 /** @const */ var FEEDBACK_LANDING_PAGE =
7 'http://www.google.com/support/chrome/go/feedback_confirmation' 7 'http://www.google.com/support/chrome/go/feedback_confirmation';
8 8
9 var selectedThumbnailDivId = ''; 9 var selectedThumbnailDivId = '';
10 var selectedThumbnailId = ''; 10 var selectedThumbnailId = '';
11 var selectedImageUrl; 11 var selectedImageUrl;
12 12
13 var savedThumbnailIds = []; 13 var savedThumbnailIds = [];
14 savedThumbnailIds['current-screenshots'] = ''; 14 savedThumbnailIds['current-screenshots'] = '';
15 savedThumbnailIds['saved-screenshots'] = ''; 15 savedThumbnailIds['saved-screenshots'] = '';
16 16
17 var categoryTag = ""; 17 var categoryTag = '';
18 18
19 var localStrings = new LocalStrings(); 19 var localStrings = new LocalStrings();
20 20
21 /** 21 /**
22 * Selects an image thumbnail in the specified div. 22 * Selects an image thumbnail in the specified div.
23 */ 23 */
24 function selectImage(divId, thumbnailId) { 24 function selectImage(divId, thumbnailId) {
25 var thumbnailDivs = $(divId).children; 25 var thumbnailDivs = $(divId).children;
26 selectedThumbnailDivId = divId; 26 selectedThumbnailDivId = divId;
27 if (thumbnailDivs.length == 0) { 27 if (thumbnailDivs.length == 0) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 if (!$('page-url-checkbox').checked) 103 if (!$('page-url-checkbox').checked)
104 pageUrl = ''; 104 pageUrl = '';
105 105
106 var reportArray = [pageUrl, 106 var reportArray = [pageUrl,
107 categoryTag, 107 categoryTag,
108 $('description-text').value, 108 $('description-text').value,
109 imagePath]; 109 imagePath];
110 110
111 // Add chromeos data if it exists. 111 // Add chromeos data if it exists.
112 if ($('user-email-text') && $('sys-info-checkbox')) { 112 if ($('user-email-text') && $('sys-info-checkbox')) {
113 var userEmail= $('user-email-text').textContent; 113 var userEmail = $('user-email-text').textContent;
114 if (!$('user-email-checkbox').checked) 114 if (!$('user-email-checkbox').checked)
115 userEmail = ''; 115 userEmail = '';
116 reportArray = reportArray.concat([userEmail, 116 reportArray = reportArray.concat([userEmail,
117 String($('sys-info-checkbox').checked)]); 117 String($('sys-info-checkbox').checked)]);
118 } 118 }
119 119
120 // open the landing page in a new tab, sendReport will close this one. 120 // open the landing page in a new tab, sendReport will close this one.
121 window.open(FEEDBACK_LANDING_PAGE, '_blank'); 121 window.open(FEEDBACK_LANDING_PAGE, '_blank');
122 chrome.send('sendReport', reportArray); 122 chrome.send('sendReport', reportArray);
123 return true; 123 return true;
124 } 124 }
125 125
126 function cancel() { 126 function cancel() {
127 chrome.send('cancel', []); 127 chrome.send('cancel');
128 return true; 128 return true;
129 } 129 }
130 130
131 /** 131 /**
132 * Select the current screenshots div, restoring the image that was 132 * Select the current screenshots div, restoring the image that was
133 * selected when we had this div open previously. 133 * selected when we had this div open previously.
134 */ 134 */
135 function currentSelected() { 135 function currentSelected() {
136 // TODO(rkc): Change this to use a class instead. 136 // TODO(rkc): Change this to use a class instead.
137 $('current-screenshots').hidden = false; 137 $('current-screenshots').hidden = false;
138 if ($('saved-screenshots')) 138 if ($('saved-screenshots'))
139 $('saved-screenshots').hidden = true; 139 $('saved-screenshots').hidden = true;
140 140
141 if (selectedThumbnailDivId != 'current-screenshots') 141 if (selectedThumbnailDivId != 'current-screenshots')
142 selectImage('current-screenshots', 142 selectImage('current-screenshots',
143 savedThumbnailIds['current-screenshots']); 143 savedThumbnailIds['current-screenshots']);
144 144
145 return true; 145 return true;
146 } 146 }
147 147
148 /** 148 /**
149 * Select the saved screenshots div, restoring the image that was 149 * Select the saved screenshots div, restoring the image that was
150 * selected when we had this div open previously. 150 * selected when we had this div open previously.
151 */ 151 */
152 function savedSelected() { 152 function savedSelected() {
153 $('current-screenshots').hidden = true; 153 $('current-screenshots').hidden = true;
154 154
155 if ($('saved-screenshots').childElementCount == 0) { 155 if ($('saved-screenshots').childElementCount == 0) {
156 // setupSavedScreenshots will take care of changing visibility 156 // setupSavedScreenshots will take care of changing visibility
157 chrome.send('refreshSavedScreenshots', []); 157 chrome.send('refreshSavedScreenshots');
158 } else { 158 } else {
159 $('saved-screenshots').hidden = false; 159 $('saved-screenshots').hidden = false;
160 if (selectedThumbnailDivId != 'saved-screenshots') 160 if (selectedThumbnailDivId != 'saved-screenshots')
161 selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']); 161 selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']);
162 } 162 }
163 163
164 return true; 164 return true;
165 } 165 }
166 166
167 167
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 // If a page url is spcified in the parameters, override the default page url. 244 // If a page url is spcified in the parameters, override the default page url.
245 if (parameters['customPageUrl'] != '') { 245 if (parameters['customPageUrl'] != '') {
246 $('page-url-text').value = parameters['customPageUrl']; 246 $('page-url-text').value = parameters['customPageUrl'];
247 // and disable the page image, since it doesn't make sense on a custum url. 247 // and disable the page image, since it doesn't make sense on a custum url.
248 disableScreenshots(); 248 disableScreenshots();
249 } 249 }
250 250
251 // Pick up the category tag (for most cases this will be an empty string) 251 // Pick up the category tag (for most cases this will be an empty string)
252 categoryTag = parameters['categoryTag']; 252 categoryTag = parameters['categoryTag'];
253 253
254 chrome.send('getDialogDefaults', []); 254 chrome.send('getDialogDefaults');
255 chrome.send('refreshCurrentScreenshot', []); 255 chrome.send('refreshCurrentScreenshot');
256 }; 256 }
257 257
258 function setupCurrentScreenshot(screenshot) { 258 function setupCurrentScreenshot(screenshot) {
259 addScreenshot('current-screenshots', screenshot); 259 addScreenshot('current-screenshots', screenshot);
260 } 260 }
261 261
262 function setupSavedScreenshots(screenshots) { 262 function setupSavedScreenshots(screenshots) {
263 if (screenshots.length == 0) { 263 if (screenshots.length == 0) {
264 $('saved-screenshots').textContent = 264 $('saved-screenshots').textContent =
265 localStrings.getString('no-saved-screenshots'); 265 localStrings.getString('no-saved-screenshots');
266 266
(...skipping 30 matching lines...) Expand all
297 $('user-email-table').hidden = true; 297 $('user-email-table').hidden = true;
298 298
299 // this also means we are in privacy mode, so no saved screenshots. 299 // this also means we are in privacy mode, so no saved screenshots.
300 $('screenshot-link-tosaved').hidden = true; 300 $('screenshot-link-tosaved').hidden = true;
301 } 301 }
302 } 302 }
303 } 303 }
304 } 304 }
305 305
306 window.addEventListener('DOMContentLoaded', load); 306 window.addEventListener('DOMContentLoaded', load);
OLDNEW
« no previous file with comments | « chrome/browser/resources/crashes.js ('k') | chrome/browser/resources/flags.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698