LSformElement::password: fix some jshint errors

This commit is contained in:
Benjamin Renard 2020-06-30 09:58:57 +02:00
parent dde982f42c
commit f66b7186e8

View file

@ -8,7 +8,7 @@ var LSformElement_password_field = new Class({
initialiseLSformElement_password_field: function() { initialiseLSformElement_password_field: function() {
// ViewHashBtn // ViewHashBtn
if (this.params['viewHash'] && varLSform.objectdn!= "") { if (this.params.viewHash && varLSform.objectdn!= "") {
this.viewHashBtn = new Element('img'); this.viewHashBtn = new Element('img');
this.viewHashBtn.src = varLSdefault.imagePath('view_hash'); this.viewHashBtn.src = varLSdefault.imagePath('view_hash');
this.viewHashBtn.addClass('btn'); this.viewHashBtn.addClass('btn');
@ -18,8 +18,8 @@ var LSformElement_password_field = new Class({
} }
// Mail // Mail
if (this.params['mail']) { if (this.params.mail) {
if ((this.params.mail['canEdit']==1)||(!$type(this.params.mail['canEdit']))) { if ((this.params.mail.canEdit==1)||(!$type(this.params.mail.canEdit))) {
this.editMailBtn = new Element('img'); this.editMailBtn = new Element('img');
this.editMailBtn.src = varLSdefault.imagePath('mail-edit'); this.editMailBtn.src = varLSdefault.imagePath('mail-edit');
this.editMailBtn.addClass('btn'); this.editMailBtn.addClass('btn');
@ -28,7 +28,7 @@ var LSformElement_password_field = new Class({
this.editMailBtn.injectAfter(this.input); this.editMailBtn.injectAfter(this.input);
varLSdefault.addHelpInfo(this.editMailBtn,'LSformElement_password','editmail'); varLSdefault.addHelpInfo(this.editMailBtn,'LSformElement_password','editmail');
} }
if (this.params.mail['ask']) { if (this.params.mail.ask) {
this.mailBtn = new Element('img'); this.mailBtn = new Element('img');
this.mailBtn.addClass('btn'); this.mailBtn.addClass('btn');
this.mailBtn.addEvent('click',this.onMailBtnClick.bind(this)); this.mailBtn.addEvent('click',this.onMailBtnClick.bind(this));
@ -37,7 +37,7 @@ var LSformElement_password_field = new Class({
name: 'LSformElement_password_' + this.name + '_send', name: 'LSformElement_password_' + this.name + '_send',
type: 'hidden' type: 'hidden'
}); });
if (this.params.mail['send']) { if (this.params.mail.send) {
this.mailInput.value = 1; this.mailInput.value = 1;
this.mailBtn.src = varLSdefault.imagePath('mail'); this.mailBtn.src = varLSdefault.imagePath('mail');
varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','mail'); varLSdefault.addHelpInfo(this.mailBtn,'LSformElement_password','mail');
@ -54,7 +54,7 @@ var LSformElement_password_field = new Class({
// ViewBtn // ViewBtn
this.viewBtn = new Element('img'); this.viewBtn = new Element('img');
if (this.params['clearEdit']) { if (this.params.clearEdit) {
this.viewBtn.src = varLSdefault.imagePath('hide'); this.viewBtn.src = varLSdefault.imagePath('hide');
varLSdefault.addHelpInfo(this.viewBtn,'LSformElement_password','hide'); varLSdefault.addHelpInfo(this.viewBtn,'LSformElement_password','hide');
} }
@ -67,7 +67,7 @@ var LSformElement_password_field = new Class({
this.viewBtn.injectAfter(this.input); this.viewBtn.injectAfter(this.input);
// Verify // Verify
if (this.params['verify']) { if (this.params.verify) {
this.bgColor = this.input.getStyle('background-color'); this.bgColor = this.input.getStyle('background-color');
this.verifyFx = new Fx.Tween(this.input,{property: 'background-color',duration:600}); this.verifyFx = new Fx.Tween(this.input,{property: 'background-color',duration:600});
this.verifyBtn = new Element('img'); this.verifyBtn = new Element('img');
@ -78,7 +78,7 @@ var LSformElement_password_field = new Class({
varLSdefault.addHelpInfo(this.verifyBtn,'LSformElement_password','verify'); varLSdefault.addHelpInfo(this.verifyBtn,'LSformElement_password','verify');
} }
if (this.params['generate']) { if (this.params.generate) {
this.generateBtn = new Element('img'); this.generateBtn = new Element('img');
this.generateBtn.src = varLSdefault.imagePath('generate'); this.generateBtn.src = varLSdefault.imagePath('generate');
this.generateBtn.addClass('btn'); this.generateBtn.addClass('btn');
@ -108,7 +108,7 @@ var LSformElement_password_field = new Class({
initialize_input: function() { initialize_input: function() {
// Verify // Verify
if (this.params['verify']) { if (this.params.verify) {
this.verifyFx = new Fx.Tween(this.input,{property: 'background-color',duration:600}); this.verifyFx = new Fx.Tween(this.input,{property: 'background-color',duration:600});
} }
}, },
@ -133,20 +133,20 @@ var LSformElement_password_field = new Class({
this.LSmail.addEvent('valid',this.onLSmailValid.bind(this)); this.LSmail.addEvent('valid',this.onLSmailValid.bind(this));
} }
var mails = [] var mails = [];
if ($type(this.params.mail['mail_attr'])=='array') { if ($type(this.params.mail.mail_attr)=='array') {
this.params.mail['mail_attr'].each(function(a) { this.params.mail.mail_attr.each(function(a) {
this.append(varLSform.getValue(a)); this.append(varLSform.getValue(a));
},mails); },mails);
} }
else { else {
mails.append(varLSform.getValue(this.params.mail['mail_attr'])); mails.append(varLSform.getValue(this.params.mail.mail_attr));
} }
this.LSmail_open = 1; this.LSmail_open = 1;
this.LSmail.setMails(mails); this.LSmail.setMails(mails);
this.LSmail.setSubject(this.params.mail['subject']); this.LSmail.setSubject(this.params.mail.subject);
this.LSmail.setMsg(this.params.mail['msg']); this.LSmail.setMsg(this.params.mail.msg);
this.LSmail.open(this.editMailBtn); this.LSmail.open(this.editMailBtn);
}, },