refactoring

This commit is contained in:
Roland Gruber 2019-10-15 16:06:46 +02:00
parent dc94c51cda
commit 4128f703aa
1 changed files with 14 additions and 10 deletions

View File

@ -28,7 +28,7 @@ window.lam = window.lam || {};
*/ */
function list_click(box) { function list_click(box) {
var cbox = document.getElementsByName(box)[0]; var cbox = document.getElementsByName(box)[0];
if (cbox.checked == true) { if (cbox.checked) {
cbox.checked = false; cbox.checked = false;
} }
else { else {
@ -383,8 +383,10 @@ function equalWidth(elementIDs) {
// no action if invalid width value (e.g. because of hidden tab) // no action if invalid width value (e.g. because of hidden tab)
return; return;
} }
for (var i = 0; i < elementIDs.length; ++i) { for (var elementId = 0; elementId < elementIDs.length; ++elementId) {
jQuery(elementIDs[i]).css({'width': maxWidth - (jQuery(elementIDs[i]).outerWidth() - jQuery(elementIDs[i]).width())}); jQuery(elementIDs[elementId]).css({
'width': maxWidth - (jQuery(elementIDs[elementId]).outerWidth() - jQuery(elementIDs[elementId]).width())
});
} }
} }
@ -400,8 +402,10 @@ function equalHeight(elementIDs) {
max = jQuery(elementIDs[i]).height(); max = jQuery(elementIDs[i]).height();
} }
} }
for (var i = 0; i < elementIDs.length; ++i) { for (var elementId = 0; elementId < elementIDs.length; ++elementId) {
jQuery(elementIDs[i]).css({'height': max - (jQuery(elementIDs[i]).outerHeight() - jQuery(elementIDs[i]).height())}); jQuery(elementIDs[elementId]).css({
'height': max - (jQuery(elementIDs[elementId]).outerHeight() - jQuery(elementIDs[elementId]).height())
});
} }
} }
@ -567,7 +571,7 @@ function checkPasswordStrength(fieldID, ajaxURL, tokenName, tokenValue) {
*/ */
function checkPasswordStrengthHandleReply(data, fieldID) { function checkPasswordStrengthHandleReply(data, fieldID) {
var field = jQuery('#' + fieldID); var field = jQuery('#' + fieldID);
if (data.result == true) { if (data.result === true) {
field.removeClass('markFail'); field.removeClass('markFail');
field.addClass('markOk'); field.addClass('markOk');
field.prop('title', ''); field.prop('title', '');
@ -601,11 +605,11 @@ function updateModulePositions(id, oldPos, newPos) {
positions[newPos] = save; positions[newPos] = save;
} }
if (newPos < oldPos) { if (newPos < oldPos) {
var save = positions[oldPos]; var oldPosition = positions[oldPos];
for (var i = oldPos; i > newPos; i--) { for (var position = oldPos; position > newPos; position--) {
positions[i] = positions[i - 1]; positions[position] = positions[position - 1];
} }
positions[newPos] = save; positions[newPos] = oldPosition;
} }
jQuery('#' + id).val(positions.join(',')); jQuery('#' + id).val(positions.join(','));
} }