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..52871694931bf7d68cba674e921411d11e9d34b0 |
--- a/chrome/browser/resources/bug_report.js |
+++ b/chrome/browser/resources/bug_report.js |
@@ -52,7 +52,10 @@ 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'; |
@@ -61,13 +64,6 @@ function addScreenshot(divId, screenshot) { |
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 +80,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').value; |
+ if (!$('user-email-checkbox').checked) |
+ userEmail = ""; |
oshima
2010/11/29 19:09:22
single quote
rkc
2010/11/29 22:41:08
Done.
|
+ reportArray = reportArray.concat([userEmail, |
String($('sys-info-checkbox').checked)]); |
} |
@@ -133,13 +138,18 @@ 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; |
} |
@@ -156,3 +166,37 @@ function noneSelected() { |
selectedThumbnailId = ''; |
return true; |
} |
+ |
+/** |
+ * Toggle the type of screenshot we're showing to the user between |
+ * the current screenshot, and a list of saved screenshots |
+ */ |
+function toggleScreenshotType() { |
+ // If we are showing the current screenshot, show the saved screenshots; |
+ // otherwise, show the current screenshot. Update the text appropriately, |
+ // the text is our marker to know what we are currently showing. |
+ if ($('screenshot-label').innerHTML.indexOf( |
+ localStrings.getString('current-screenshot')) > -1) { |
+ // Switch to saved screenshots. |
+ $('screenshot-label').innerHTML = $('screenshot-label').innerHTML.replace( |
+ localStrings.getString('current-screenshot'), |
+ localStrings.getString('saved-screenshot')); |
+ |
+ $('screenshot-link').innerHTML = $('screenshot-link').innerHTML.replace( |
+ localStrings.getString('choose-different-screenshot'), |
+ localStrings.getString('choose-original-screenshot')); |
oshima
2010/11/29 19:09:22
This looks a bit hacky. can't this be done via css
rkc
2010/11/29 22:41:08
Done.
|
+ |
+ savedSelected(); |
+ } else { |
+ // Go back to current screenshot. |
+ $('screenshot-label').innerHTML = $('screenshot-label').innerHTML.replace( |
+ localStrings.getString('saved-screenshot'), |
+ localStrings.getString('current-screenshot')); |
+ |
+ $('screenshot-link').innerHTML = $('screenshot-link').innerHTML.replace( |
+ localStrings.getString('choose-original-screenshot'), |
+ localStrings.getString('choose-different-screenshot')); |
+ |
+ currentSelected(); |
+ } |
+} |