Add clear form button for "Add new password" div

This commit is contained in:
Gregory Soutade 2020-08-16 15:29:56 +02:00 committed by Grégory Soutadé
parent 76c7797ee2
commit d2fe770463
2 changed files with 16 additions and 0 deletions

View File

@ -167,6 +167,7 @@ if ($user != "")
echo "<input type=\"button\" name=\"add\" value=\"Add\" onclick=\"add_password();\"/>"; echo "<input type=\"button\" name=\"add\" value=\"Add\" onclick=\"add_password();\"/>";
echo "<br />"; echo "<br />";
echo '<div><a href="http://en.wikipedia.org/wiki/Password_strength">Master key strength</a><div id="scorebarBorder"><div id="score">0%</div><div id="scorebar">&nbsp;</div></div></div>'; echo '<div><a href="http://en.wikipedia.org/wiki/Password_strength">Master key strength</a><div id="scorebarBorder"><div id="score">0%</div><div id="scorebar">&nbsp;</div></div></div>';
echo "<input type=\"button\" name=\"clear\" value=\"Clear Form\" onclick=\"clear_form();\"/>";
} }
?> ?>
</div> </div>

View File

@ -109,6 +109,21 @@ function generate_simple_password()
document.getElementById("new_password").value = _generate_random(8, symbols); document.getElementById("new_password").value = _generate_random(8, symbols);
} }
function clear_form()
{
div = document.getElementById("add_new_password");
inputs = div.getElementsByTagName("input");
for(i=0; i<inputs.length; i++)
{
if (inputs[i].type == "text" ||
inputs[i].type == "password")
inputs[i].value = "";
}
chkPass("");
}
function url_domain(data) { function url_domain(data) {
var uri = parseUri(data) var uri = parseUri(data)
return uri['host']; return uri['host'];