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

Unified Diff: chrome/browser/resources/input_window_dialog.js

Issue 8438037: Change 'Add Page' to show a simple input dialog with --use-more-webui. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/input_window_dialog.js
diff --git a/chrome/browser/resources/input_window_dialog.js b/chrome/browser/resources/input_window_dialog.js
index 74174607e7c3b29b644654b19728b6067d6def61..69cd888df23e38d4aa41abb8426e8f5f7e26533c 100644
--- a/chrome/browser/resources/input_window_dialog.js
+++ b/chrome/browser/resources/input_window_dialog.js
@@ -19,11 +19,14 @@ cr.define('inputWindowDialog', function() {
*/
function closeWithResult(result) {
disableControls();
- var value = [result];
+ var values = [result];
if (result) {
- value.push($('name').value);
+ values.push($('name').value);
+ if ($('url-area').style.display != 'none') {
flackr 2011/11/02 15:38:18 Use class to determine whether a URL is being edit
mazda 2011/11/07 09:59:23 Done. I added a function to check if a URL field i
+ values.push($('url').value);
+ }
}
- var json = JSON.stringify(value);
+ var json = JSON.stringify(values);
chrome.send('DialogClose', [json]);
}
@@ -34,8 +37,16 @@ cr.define('inputWindowDialog', function() {
i18nTemplate.process(document, templateData);
var args = JSON.parse(chrome.dialogArguments);
- $('name-label').textContent = args.label;
- $('name').value = args.contents;
+ $('name-label').textContent = args.nameLabel;
+ $('name').value = args.name;
+
+ if (args.urlLabel && args.url) {
+ $('url-label').textContent = args.urlLabel;
+ $('url').value = args.url;
+ $('url-area').style.display = '-webkit-box';
flackr 2011/11/02 15:38:18 Use class to toggle CSS properties.
mazda 2011/11/07 09:59:23 Done.
+ } else {
+ $('url-area').style.display = 'none';
+ }
$('cancel').onclick = function() {
closeWithResult(false);
@@ -47,11 +58,17 @@ cr.define('inputWindowDialog', function() {
}
}
- $('name').oninput = function() {
- var name = $('name').value;
- chrome.send('validate', [name]);
+ function validate() {
+ var values = [$('name').value]
+ if ($('url-area').style.display != 'none') {
flackr 2011/11/02 15:38:18 Same as above, check class instead of style.
mazda 2011/11/07 09:59:23 Done.
+ values.push($('url').value);
+ }
+ chrome.send('validate', values);
}
+ $('name').oninput = validate;
+ $('url').oninput = $('url-area').style.display != 'none' ? validate : null;
+
document.body.onkeydown = function(evt) {
if (evt.keyCode == 13) { // Enter key
$('ok').onclick();

Powered by Google App Engine
This is Rietveld 408576698