Effective command preview (action)

This commit is contained in:
fbsanchez 2021-01-21 17:09:36 +01:00
parent 4aba3b7753
commit bf453ab0ef
1 changed files with 14 additions and 9 deletions

View File

@ -1,4 +1,5 @@
var original_command = ""; /* globals $ */
function parse_alert_command(command, classs) { function parse_alert_command(command, classs) {
if (classs == "recovery") { if (classs == "recovery") {
classs = "fields_recovery"; classs = "fields_recovery";
@ -9,16 +10,20 @@ function parse_alert_command(command, classs) {
var nfield = 1; var nfield = 1;
$("." + classs).each(function() { $("." + classs).each(function() {
// Only render values different from '' // Only render values different from ''
if ($(this).val() == "") {
nfield++;
return;
}
var field = "_field" + nfield + "_"; var field = "_field" + nfield + "_";
var regex = new RegExp(field, "gi"); var regex = new RegExp(field, "gi");
console.log($(this).val());
if ($(this).css("-webkit-text-security") == "disc") { if ($(this).val() == "") {
if (
classs == "fields_recovery" &&
$($(".fields")[nfield - 1]).val() != ""
) {
command = command.replace(
regex,
"[RECOVER]" + $($(".fields")[nfield - 1]).val()
);
}
} else if ($(this).css("-webkit-text-security") == "disc") {
var hidden_character = "*"; var hidden_character = "*";
var hidden_string = hidden_character.repeat($(this).val().length); var hidden_string = hidden_character.repeat($(this).val().length);