OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html i18n-values="dir:textdirection"> | |
3 <head> | |
4 <link rel="stylesheet" href="dialog.css"> | |
5 <style type="text/css"> | |
arv (Not doing code reviews)
2011/09/07 20:58:20
Skip the type here. text/css is the default and it
Daniel Erat
2011/09/08 01:46:56
Done.
| |
6 body { | |
7 -webkit-user-select: none; | |
8 margin: 10px 10px 0 10px; | |
9 } | |
10 | |
11 form { | |
12 margin: 0; | |
13 } | |
14 | |
15 #explanation { | |
16 cursor: default; | |
17 } | |
18 | |
19 #buttons { | |
20 padding: 10px 0; | |
21 text-align: end; | |
22 } | |
23 | |
24 </style> | |
25 <script> | |
26 function $(o) { | |
27 return document.getElementById(o); | |
28 } | |
29 | |
30 function disableControls() { | |
31 $('cancel').disabled = true; | |
32 $('resend').disabled = true; | |
33 } | |
34 | |
35 function cancel() { | |
36 disableControls(); | |
37 chrome.send('DialogClose', [JSON.stringify([false])]); | |
arv (Not doing code reviews)
2011/09/07 20:58:20
Can you just send false here? chrome.send should u
Daniel Erat
2011/09/08 01:46:56
HtmlDialogUI::OnDialogClosed() interprets the firs
| |
38 } | |
39 | |
40 function handleSubmit(e) { | |
41 disableControls(); | |
42 e.preventDefault(); | |
43 chrome.send('DialogClose', [JSON.stringify([true])]); | |
44 } | |
45 | |
46 function handleKeyDown(e) { | |
47 if (e.keyCode == 27) { // Escape | |
48 e.preventDefault(); | |
49 cancel(); | |
50 } | |
51 } | |
52 | |
53 function load() { | |
54 document.addEventListener('keydown', handleKeyDown); | |
55 $('explanation').textContent = chrome.dialogArguments; | |
56 $('form').onsubmit = handleSubmit; | |
57 $('cancel').onclick = cancel; | |
58 $('cancel').focus(); | |
arv (Not doing code reviews)
2011/09/07 20:58:20
Use autofocus instead?
<input ... autofocus>
Daniel Erat
2011/09/08 01:46:56
Done.
| |
59 } | |
60 | |
61 document.addEventListener('DOMContentLoaded', load); | |
62 </script> | |
63 </head> | |
64 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> | |
65 <div id="explanation"></div> | |
arv (Not doing code reviews)
2011/09/07 20:58:20
<p> seems more correct
Daniel Erat
2011/09/08 01:46:56
How strongly do you feel about this? <p>'s extra
| |
66 <form id="form"> | |
67 <div id="buttons"> | |
68 <input id="cancel" type="button" i18n-values="value:cancel"> | |
arv (Not doing code reviews)
2011/09/07 20:58:20
type="reset" seems more logical
Daniel Erat
2011/09/08 01:46:56
Done.
| |
69 <input id="resend" type="submit" i18n-values="value:resend"> | |
70 </div> | |
71 </form> | |
72 </body> | |
73 </html> | |
OLD | NEW |