Browse Source

set autofocus, eye to show pswd

master 1.0.1
Sergey-V Markov 2 years ago
parent
commit
0ce80b5d20
  1. 0
      README.md
  2. BIN
      images/eye.png
  3. BIN
      images/eye2.png
  4. 6
      index.html
  5. 13
      main.js
  6. 0
      style.css

BIN
images/eye.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
images/eye2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

6
index.html

@ -44,10 +44,12 @@
<br /><br /><br />
<img src="images/default_face.png" id="user-image" width="88" height="88"/><br />
<p id="user" />
<form onSubmit="doLogin()">
<table>
<tr><td colspan="2"><div id="underline"><input type="password" name="password" id="password" class="input" autocomplete="off" placeholder="Введите пароль" /></div></td></tr>
<tr><td><select name="sessions" id="sessions" /></td><td align="right"><button type="button" id="submit" class='input_submit' onClick="doLogin()">Поехали!</button></td></tr>
<tr><td colspan="2"><div id="underline"><input type="password" name="password" id="password" class="input" autocomplete="off" placeholder="Введите пароль" autofocus /><img src="images/eye.png" id="eye" onClick="togglePasswordVisibility()" style="width:18px;height:18px;vertical-align: middle" /></div></td></tr>
<tr><td><select name="sessions" id="sessions" /></td><td align="right"><button type="submit" id="submit" class='input_submit'>Поехали!</button></td></tr>
</table>
</form>
</center>
<br /><br /><br />
<div style="margin-bottom:5px" class="user-dropdown"><button>Изменить польлзователя</button>

13
main.js

@ -2,6 +2,18 @@ const DEFAULT_USER = "defaultUser";
const DEFAULT_SESSION = "defaultSession";
const DEFAULT_WALLPAPPER = "defaultWallpapper";
function togglePasswordVisibility() {
var passwd = document.getElementById("password");
var eye = document.getElementById("eye");
if (passwd.type === "password") {
passwd.type = "text";
eye.src = "images/eye2.png"
} else {
passwd.type = "password";
eye.src = "images/eye.png"
}
}
function updateDefaults(user, session) {
localStorage.setItem(DEFAULT_USER, user)
@ -34,6 +46,7 @@ function selectItemByValue(elmnt, value){
}
function doLogin() {
event.preventDefault();
var user = document.getElementById("user").textContent
var password = document.getElementById("password").value
var session = document.getElementById("sessions").value

Loading…
Cancel
Save