| 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 <link rel="stylesheet" href="dialog.css"> | 4 <link rel="stylesheet" href="dialog.css"> |
| 5 <style> | 5 <style> |
| 6 body { | 6 body { |
| 7 -webkit-user-select: none; | 7 -webkit-user-select: none; |
| 8 margin: 10px 10px 0 10px; | 8 margin: 10px 10px 0 10px; |
| 9 } | 9 } |
| 10 | 10 |
| 11 form { | 11 form { |
| 12 margin: 0; | 12 margin: 0; |
| 13 } | 13 } |
| 14 | 14 |
| 15 #explanation { | 15 #explanation { |
| 16 cursor: default; | 16 cursor: default; |
| 17 } | 17 } |
| 18 | 18 |
| 19 #buttons { | 19 #buttons { |
| 20 padding: 10px 0; | 20 padding: 10px 0; |
| 21 text-align: end; | 21 text-align: end; |
| 22 } | 22 } |
| 23 | 23 |
| 24 </style> | 24 </style> |
| 25 <script src="chrome://resources/js/i18n_template.js"></script> |
| 25 <script> | 26 <script> |
| 26 function $(o) { | 27 function $(o) { |
| 27 return document.getElementById(o); | 28 return document.getElementById(o); |
| 28 } | 29 } |
| 29 | 30 |
| 30 function disableControls() { | 31 function disableControls() { |
| 31 $('cancel').disabled = true; | 32 $('cancel').disabled = true; |
| 32 $('resend').disabled = true; | 33 $('accept').disabled = true; |
| 33 } | 34 } |
| 34 | 35 |
| 35 function cancel() { | 36 function cancel() { |
| 36 disableControls(); | 37 disableControls(); |
| 37 chrome.send('DialogClose', [JSON.stringify(false)]); | 38 chrome.send('DialogClose', [JSON.stringify(false)]); |
| 38 } | 39 } |
| 39 | 40 |
| 40 function handleSubmit(e) { | 41 function handleSubmit(e) { |
| 41 disableControls(); | 42 disableControls(); |
| 42 e.preventDefault(); | 43 e.preventDefault(); |
| 43 chrome.send('DialogClose', [JSON.stringify(true)]); | 44 chrome.send('DialogClose', [JSON.stringify(true)]); |
| 44 } | 45 } |
| 45 | 46 |
| 46 function handleKeyDown(e) { | 47 function handleKeyDown(e) { |
| 47 if (e.keyCode == 27) { // Escape | 48 if (e.keyCode == 27) { // Escape |
| 48 e.preventDefault(); | 49 e.preventDefault(); |
| 49 cancel(); | 50 cancel(); |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 | 53 |
| 53 function load() { | 54 function load() { |
| 55 i18nTemplate.process(document, JSON.parse(chrome.dialogArguments)); |
| 54 document.addEventListener('keydown', handleKeyDown); | 56 document.addEventListener('keydown', handleKeyDown); |
| 55 $('form').onsubmit = handleSubmit; | 57 $('form').onsubmit = handleSubmit; |
| 56 $('cancel').onclick = cancel; | 58 $('cancel').onclick = cancel; |
| 57 $('cancel').focus(); | 59 $('cancel').focus(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 document.addEventListener('DOMContentLoaded', load); | 62 document.addEventListener('DOMContentLoaded', load); |
| 61 </script> | 63 </script> |
| 62 </head> | 64 </head> |
| 63 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> | 65 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize"> |
| 64 <div id="explanation" i18n-content="explanation"></div> | 66 <div id="explanation" i18n-content="message"></div> |
| 65 <form id="form"> | 67 <form id="form"> |
| 66 <div id="buttons"> | 68 <div id="buttons"> |
| 67 <input id="cancel" type="reset" i18n-values="value:cancel" autofocus> | 69 <input id="cancel" type="reset" i18n-values="value:cancel" autofocus> |
| 68 <input id="resend" type="submit" i18n-values="value:resend"> | 70 <input id="accept" type="submit" i18n-values="value:accept"> |
| 69 </div> | 71 </div> |
| 70 </form> | 72 </form> |
| 71 </body> | 73 </body> |
| 72 </html> | 74 </html> |
| OLD | NEW |