]> git.wh0rd.org - chrome-ext/web-power-switch.git/commitdiff
options: improve field handling v3.0
authorMike Frysinger <vapier@gentoo.org>
Sun, 5 Jan 2020 07:15:35 +0000 (13:00 +0545)
committerMike Frysinger <vapier@gentoo.org>
Sun, 5 Jan 2020 07:15:35 +0000 (13:00 +0545)
Don't allow Chrome to try to spellcheck/autocorrect these values.

Make the password field more like a standard password field.

options.html
options.js

index f9cac46f4ceeefcbcceaab0aa20421d59fd37997..263a898c1b258f44bcba2f059bc6ba066dd21e71 100644 (file)
 <body>
 <table>
 <tr>
- <td>URL:</td><td><input type='text' id='url' size=40></td>
+ <td>URL:</td>
+ <td><input type='text' id='url' size=40
+            autocapitalize='none' autocorrect='off' spellcheck='false'></td>
 </tr>
 <tr>
- <td>User:</td><td><input type='text' id='user' size=40></td>
+ <td>User:</td>
+ <td><input type='text' id='user' size=40
+            autocapitalize='none' autocorrect='off' spellcheck='false'></td>
 </tr>
 <tr>
- <td>Pass:</td><td><input type='text' id='pass' size=40></td>
+ <td>Pass:</td>
+ <td><input type='password' id='pass' size=30
+            autocapitalize='none' autocorrect='off' spellcheck='false'>&nbsp;<button id='show-pass'>👁</button></td>
 </tr>
 </table>
 
index bda30386299867b902bf547378d8b4e2307fc4d3..e1c9702e1ac7b932672cf5b2a5dccf1a7ce1f0ed 100644 (file)
@@ -48,6 +48,13 @@ function keydown(e) {
        }
 }
 
+function toggle_visible_pass() {
+       const ele = document.getElementById('pass');
+       ele.type = (ele.type == 'password') ? 'text' : 'password';
+       // Disable form submission.
+       return false;
+}
+
 window.onload = function() {
        storage.get(settings_keys, function(settings) {
                var field = document.getElementById('save');
@@ -59,4 +66,5 @@ window.onload = function() {
                        field.onkeydown = keydown;
                });
        });
+       document.getElementById('show-pass').onclick = toggle_visible_pass;
 };