OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html i18n-values="dir:textdirection"> |
| 3 <head> |
| 4 <link rel="stylesheet" href="dialog.css"> |
| 5 <style> |
| 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)]); |
| 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 $('form').onsubmit = handleSubmit; |
| 56 $('cancel').onclick = cancel; |
| 57 $('cancel').focus(); |
| 58 } |
| 59 |
| 60 document.addEventListener('DOMContentLoaded', load); |
| 61 </script> |
| 62 </head> |
| 63 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> |
| 64 <div id="explanation" i18n-content="explanation"></div> |
| 65 <form id="form"> |
| 66 <div id="buttons"> |
| 67 <input id="cancel" type="reset" i18n-values="value:cancel" autofocus> |
| 68 <input id="resend" type="submit" i18n-values="value:resend"> |
| 69 </div> |
| 70 </form> |
| 71 </body> |
| 72 </html> |
OLD | NEW |