OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html i18n-values="dir:textdirection"> | 2 <html i18n-values="dir:textdirection"> |
3 <head> | 3 <head> |
4 <style type="text/css"> | 4 <style type="text/css"> |
5 body { | 5 body { |
6 margin: 0px; | 6 margin: 0px; |
7 } | 7 } |
8 | 8 |
9 #buttons { | 9 #buttons { |
10 text-align: right; | 10 text-align: right; |
(...skipping 23 matching lines...) Expand all Loading... | |
34 function sendCredentialsAndClose() { | 34 function sendCredentialsAndClose() { |
35 disableControls(); | 35 disableControls(); |
36 | 36 |
37 var result = JSON.stringify({ | 37 var result = JSON.stringify({ |
38 'username': $('username').value, | 38 'username': $('username').value, |
39 'password': $('password').value}); | 39 'password': $('password').value}); |
40 | 40 |
41 chrome.send('DialogClose', [result]); | 41 chrome.send('DialogClose', [result]); |
42 } | 42 } |
43 | 43 |
44 function cancel() { | |
45 disableControls(); | |
46 chrome.send('DialogClose', ['']); | |
arv (Not doing code reviews)
2011/08/23 00:14:59
chrome.send('DialogClose')
Daniel Erat
2011/08/23 00:48:04
Done.
| |
47 } | |
48 | |
49 function handleSubmit(e) { | |
50 sendCredentialsAndClose(); | |
51 return false; | |
arv (Not doing code reviews)
2011/08/23 00:14:59
e.preventDefault()
Daniel Erat
2011/08/23 00:48:04
Done.
| |
52 } | |
53 | |
54 function handleKeyDown(e) { | |
55 if (event.keyCode == 27) { | |
xiyuan
2011/08/22 22:29:05
nit: use 'e' instead of 'event'
xiyuan
2011/08/22 22:29:05
nit: add a comment of what key this is.
arv (Not doing code reviews)
2011/08/23 00:14:59
// Esc
Daniel Erat
2011/08/23 00:48:04
Done.
Daniel Erat
2011/08/23 00:48:04
Done.
| |
56 cancel(); | |
57 return false; | |
xiyuan
2011/08/22 22:29:05
nit: you probably don't need to return anything.
arv (Not doing code reviews)
2011/08/23 00:14:59
e.preventDefault();
Daniel Erat
2011/08/23 00:48:04
Done.
| |
58 } | |
59 return true; | |
xiyuan
2011/08/22 22:29:05
same here.
| |
60 } | |
61 | |
44 function setAutofillCredentials(username, password) { | 62 function setAutofillCredentials(username, password) { |
45 $('username').value = username; | 63 $('username').value = username; |
46 $('password').value = password; | 64 $('password').value = password; |
47 } | 65 } |
48 | 66 |
49 function load() { | 67 function load() { |
68 document.onkeydown = handleKeyDown; | |
Daniel Erat
2011/08/22 22:14:18
Should I be setting the body element's handler ins
xiyuan
2011/08/22 22:29:05
Think it's fine to use document.
xiyuan
2011/08/22 22:29:05
nit: suggest to use document.addEventListener('key
Daniel Erat
2011/08/23 00:48:04
Done.
| |
50 $('explanation').textContent = chrome.dialogArguments; | 69 $('explanation').textContent = chrome.dialogArguments; |
51 | 70 $('form').onsubmit = handleSubmit; |
52 $('cancel').onclick = function() { | 71 $('cancel').onclick = cancel; |
53 disableControls(); | |
54 chrome.send('DialogClose', ['']); | |
55 }; | |
56 | |
57 $('login').onclick = function() { | |
58 sendCredentialsAndClose(); | |
59 }; | |
60 | |
61 $('username').focus(); | 72 $('username').focus(); |
62 | 73 |
63 chrome.send('GetAutofill', ['']); | 74 chrome.send('GetAutofill', ['']); |
64 } | 75 } |
65 | 76 |
66 document.addEventListener('DOMContentLoaded', load); | 77 document.addEventListener('DOMContentLoaded', load); |
67 </script> | 78 </script> |
68 </head> | 79 </head> |
69 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> | 80 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> |
70 <div id="explanation"></div> | 81 <div id="explanation"></div> |
71 <table> | 82 <form id="form"> |
arv (Not doing code reviews)
2011/08/23 00:14:59
Add this to your css
form {
margin: 0;
}
Daniel Erat
2011/08/23 00:48:04
Done.
| |
72 <tr> | 83 <table> |
73 <td i18n-content="username"></td> | 84 <tr> |
74 <td> | 85 <td i18n-content="username"></td> |
75 <input id="username" type="text"> | 86 <td> |
76 </td> | 87 <input id="username" type="text"> |
77 </tr> | 88 </td> |
78 <tr> | 89 </tr> |
79 <td i18n-content="password"></td> | 90 <tr> |
80 <td> | 91 <td i18n-content="password"></td> |
81 <input id="password" name="password" type="password"> | 92 <td> |
82 </td> | 93 <input id="password" name="password" type="password"> |
83 </tr> | 94 </td> |
84 </table> | 95 </tr> |
85 <div id="buttons"> | 96 </table> |
86 <input id="cancel" type="button" i18n-values="value:cancel"> | 97 <div id="buttons"> |
87 <input id="login" type="button" i18n-values="value:signin"> | 98 <input id="cancel" type="button" i18n-values="value:cancel"> |
88 </div> | 99 <input id="login" type="submit" i18n-values="value:signin"> |
100 </div> | |
101 </form> | |
89 </body> | 102 </body> |
90 </html> | 103 </html> |
OLD | NEW |