Chromium Code Reviews| Index: chrome/browser/resources/bug_report.js |
| diff --git a/chrome/browser/resources/bug_report.js b/chrome/browser/resources/bug_report.js |
| old mode 100644 |
| new mode 100755 |
| index c9af14f4595c172dec743a971105999bf12aac83..8bda99e7ef26f0ff0a792b34bfa17127fdc2349a |
| --- a/chrome/browser/resources/bug_report.js |
| +++ b/chrome/browser/resources/bug_report.js |
| @@ -16,6 +16,8 @@ savedThumbnailIds['saved-screenshots'] = ''; |
| var localStrings = new LocalStrings(); |
| +var privacyMode = false; |
|
oshima
2010/11/29 23:00:22
please add comment and explain what this is.
rkc
2010/11/29 23:15:59
Removed, was left over from code I had added then
|
| + |
| /** |
| * Selects an image thumbnail in the specified div. |
| */ |
| @@ -52,22 +54,18 @@ function addScreenshot(divId, screenshot) { |
| }; |
| var innerDiv = document.createElement('div'); |
| - innerDiv.className = 'image-thumbnail'; |
| + if (divId == 'current-screenshots') |
| + innerDiv.className = 'image-thumbnail-current'; |
| + else |
| + innerDiv.className = 'image-thumbnail'; |
| var thumbnail = document.createElement('img'); |
| thumbnail.id = thumbnailDiv.id + '-image'; |
| // We add the ?+timestamp to make sure the image URLs are unique |
| // and Chrome does not load the image from cache. |
| - thumbnail.src = screenshot + "?" + Date.now(); |
| + thumbnail.src = screenshot + '?' + Date.now(); |
| innerDiv.appendChild(thumbnail); |
| - var largeImage = document.createElement('img'); |
| - largeImage.src = screenshot + "?" + Date.now(); |
| - |
| - var popupDiv = document.createElement('div'); |
| - popupDiv.appendChild(largeImage); |
| - innerDiv.appendChild(popupDiv); |
| - |
| thumbnailDiv.appendChild(innerDiv); |
| $(divId).appendChild(thumbnailDiv); |
| @@ -84,22 +82,31 @@ function sendReport() { |
| if (!$('issue-with-combo').selectedIndex) { |
| alert(localStrings.getString('no-issue-selected')); |
| return false; |
| + } else if ($('description-text').value.length == 0) { |
| + alert(localStrings.getString('no-description')); |
| + return false; |
| } |
| var imagePath = ''; |
| if (selectedThumbnailId) |
| imagePath = $(selectedThumbnailId + '-image').src; |
| - // Note, categories are based from 1 in our protocol buffers, so no |
| - // adjustment is needed on selectedIndex. |
| + // Note, categories are based from 1 in our protocol buffers, so no |
| + // adjustment is needed on selectedIndex. |
| + var pageUrl = $('page-url-text').value; |
| + if (!$('page-url-checkbox').checked) |
| + pageUrl = ''; |
| var reportArray = [String($('issue-with-combo').selectedIndex), |
| - $('page-url-text').value, |
| + pageUrl, |
| $('description-text').value, |
| imagePath]; |
| - // Add chromeos data if it exists. |
| - if ($('user-email-text') && $('sys-info-checkbox')) { |
| - reportArray = reportArray.concat([$('user-email-text').value, |
| + // Add chromeos data if it exists. |
| + if ($('user-email-text') && $('sys-info-checkbox')) { |
| + var userEmail= $('user-email-text').textContent; |
| + if (!$('user-email-checkbox').checked) |
| + userEmail = ''; |
| + reportArray = reportArray.concat([userEmail, |
| String($('sys-info-checkbox').checked)]); |
| } |
| @@ -133,26 +140,49 @@ function currentSelected() { |
| /** |
| * Select the saved screenshots div, restoring the image that was |
| * selected when we had this div open previously. |
| - */ |
| -function savedSelected() { |
| + */ |
| +function savedSelected() { |
| $('current-screenshots').style.display = 'none'; |
| - $('saved-screenshots').style.display = 'block'; |
| - if (selectedThumbnailDivId != 'saved-screenshots') |
| - selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']); |
| + if ($('saved-screenshots').childElementCount == 0) { |
| + // setupSavedScreenshots will take care of changing visibility |
| + chrome.send('refreshSavedScreenshots', []); |
| + } else { |
| + $('saved-screenshots').style.display = 'block'; |
| + if (selectedThumbnailDivId != 'saved-screenshots') |
| + selectImage('saved-screenshots', savedThumbnailIds['saved-screenshots']); |
| + } |
| return true; |
| } |
| + |
| /** |
| - * Unselect all screenshots divs. |
| + * Change the type of screenshot we're showing to the user from |
| + * the current screenshot to saved screenshots |
| */ |
| -function noneSelected() { |
| - $('current-screenshots').style.display = 'none'; |
| - if ($('saved-screenshots')) |
| - $('saved-screenshots').style.display = 'none'; |
| +function changeToSaved() { |
| + $('screenshot-label-current').style.display = 'none'; |
| + $('screenshot-label-saved').style.display = 'inline'; |
|
oshima
2010/11/29 23:00:22
can you add TODO to use a class?
rkc
2010/11/29 23:15:59
Done.
|
| + |
| + // Change the link to say "go to original" |
| + $('screenshot-link-tosaved').style.display = 'none'; |
| + $('screenshot-link-tocurrent').style.display = 'inline'; |
| + |
| + savedSelected(); |
| +} |
| - selectedThumbnailDivId = ''; |
| - selectedThumbnailId = ''; |
| - return true; |
| +/** |
| + * Change the type of screenshot we're showing to the user from |
| + * the saved screenshots to the current screenshots |
| + */ |
| +function changeToCurrent() { |
| + $('screenshot-label-current').style.display = 'inline'; |
| + $('screenshot-label-saved').style.display = 'none'; |
| + |
| + // Change the link to say "go to original" |
| + $('screenshot-link-tosaved').style.display = 'inline'; |
| + $('screenshot-link-tocurrent').style.display = 'none'; |
| + |
| + currentSelected(); |
| } |