1 <html i18n-values="dir:textdirection;"> 2 <head> 3 <title></title> 4 <style type="text/css"> 5 body { 6 line-height: 1.5em; 7 background: #FFFFFF; 8 font-size: 11pt; 9 } 10 html[os='mac'] body { 11 line-height: 1.5em; 12 background: #FFFFFF; 13 } 14 form { 15 -webkit-user-select: none; 16 } 17 .error { 18 color: red; 19 font-size: 10pt; 20 } 21 .sync-header { 22 font-size: 1.2em; 23 font-weight: bold; 24 margin-bottom: 10px; 25 } 26 .sync-instructions { 27 margin-top: 10px; 28 margin-bottom: 10px; 29 } 30 .sync-footer { 31 position: fixed; 32 right: 0px; 33 bottom: 0px; 34 margin-right: 10px; 35 margin-bottom: 10px; 36 } 37 .sync-section { 38 background: #EEE; 39 margin: 5px; 40 padding: 10px; 41 } 42 43 #learn-more-link { 44 float: right; 45 } 46 html[dir='rtl'] #learn-more-link { 47 float: left; 48 } 49 html[dir='rtl'] .sync-footer { 50 text-align: left; 51 left: 0px; 52 bottom: 0px; 53 margin-left: 20px; 54 } 55 input[type='button'], 56 input[type='submit'] { 57 min-width: 87px; 58 min-height: 26px; 59 margin-left: 7px; 60 } 61 html[os='mac'] input[type='button'], 62 html[os='mac'] input[type='submit'] { 63 font-size: 12pt; 64 } 65 66 #passphrase { 67 margin-top: 5px; 68 } 69 70 </style> 71 <script src="chrome://resources/js/cr.js"></script> 72 <script> 73 var currentMode; 74 75 // Called once, when this html/js is loaded. 76 function setupDialog(args) { 77 // Allow platform specific rules 78 if (cr.isMac) { 79 document.documentElement.setAttribute('os', 'mac'); 80 } else if (!cr.isWindows) { 81 document.documentElement.setAttribute('os', 'linux'); 82 } 83 84 switchToMode(""); 85 } 86 87 function switchToMode(mode) { 88 document.getElementById("section-explicit").style.display = "none"; 89 90 if (mode == "explicit") { 91 document.getElementById("section-explicit").style.display = "block"; 92 } 93 } 94 95 function getRadioCheckedValue() { 96 var f = document.getElementById("form"); 97 for (var i = 0; i < f.option.length; ++i) { 98 if (f.option[i].checked) { 99 return f.option[i].value; 100 } 101 } 102 return undefined; 103 } 104 105 function onRadioChange() { 106 switchToMode(getRadioCheckedValue()); 107 } 108 109 function checkPassphraseMatch() { 110 var emptyError = document.getElementById("emptyerror"); 111 var mismatchError = document.getElementById("mismatcherror"); 112 emptyError.style.display = "none"; 113 mismatchError.style.display = "none"; 114 115 if (getRadioCheckedValue() != "explicit") { 116 return true; 117 } 118 var f = document.getElementById("form"); 119 if (f.passphrase.value.length == 0) { 120 emptyError.style.display = "block"; 121 return false; 122 } 123 if (f.confirmpassphrase.value != f.passphrase.value) { 124 mismatchError.style.display = "block"; 125 return false; 126 } 127 return true; 128 } 129 130 function sendValuesAndClose() { 131 var f = document.getElementById("form"); 132 if (!checkPassphraseMatch()) { 133 return false; 134 } 135 136 var result = JSON.stringify({"option": getRadioCheckedValue(), 137 "passphrase": f.passphrase.value}); 138 chrome.send("FirstPassphrase", [result]); 139 } 140 141 function optOutOfPasswordsAndClose() { 142 var result = JSON.stringify({"option": "nothanks", 143 "passphrase": ""}); 144 chrome.send("FirstPassphrase", [result]); 145 } 146 </script> 147 </head> 148 <body i18n-values=".style.fontFamily:fontfamily" onload="setupDialog();"> 149 150 </body> 151 </html> 152