1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-04 02:09:22 +02:00

Update comments

This commit is contained in:
Daniel Neto 2024-08-21 09:11:05 -03:00
parent 91ac7ba018
commit d7965a01b8
302 changed files with 56587 additions and 763 deletions

View file

@ -3359,35 +3359,38 @@ function isOnline() {
}
var notifyInputIfIsOutOfBounds_removeClassTImeout;
var notifyInputIfIsOutOfBounds_animateClassTImeout;
function notifyInputIfIsOutOfBounds(selector, min_length, max_length) {
clearTimeout(notifyInputIfIsOutOfBounds_removeClassTImeout);
clearTimeout(notifyInputIfIsOutOfBounds_animateClassTImeout);
var text = $(selector).val();
// Remove Markdown image syntax from the text
text = text.replace(/!\[.*?\]\(.*?\)/g, '');
var parent = $(selector).parent();
var animationInfo = 'animate__headShake';
var animationError = 'animate__shakeX';
var animationWarning = 'animate__headShake';
parent.removeClass('has-error');
parent.removeClass('has-warning');
parent.removeClass('has-info');
parent.removeClass('has-success');
parent.removeClass('has-feedback');
$(selector).removeClass(animationInfo);
$(selector).removeClass(animationError);
$(selector).removeClass(animationWarning);
parent.removeClass('has-error has-warning has-info has-success has-feedback');
$(selector).removeClass(animationInfo + ' ' + animationError + ' ' + animationWarning);
$(selector).addClass('animate__animated');
parent.find('.help-block').remove();
parent.find('.form-control-feedback').remove();
var isRequired = min_length == 0 || !empty($(selector).attr('required'));
var icon = '';
var feedback = '';
var force_length = parseInt($(selector).attr('maxlength'));
if (text.length == 0 && !isRequired) {
// Do nothing if the text is empty and not required
} else if (isTextOutOfBounds(text, min_length, max_length, isRequired)) {
var feedbackIcon = 'fas fa-exclamation';
parent.addClass('has-feedback');
if (!empty(force_length) && text.length >= force_length) {
text = text.substr(0, force_length);
$(selector).val(text);
@ -3410,6 +3413,7 @@ function notifyInputIfIsOutOfBounds(selector, min_length, max_length) {
$(selector).addClass(animationError);
}, 500);
}
feedback = '<i class="' + feedbackIcon + ' form-control-feedback" style="right:15px;"></i>';
} else {
//console.log('notifyInputIfIsOutOfBounds', text.length, force_length);
@ -3421,14 +3425,15 @@ function notifyInputIfIsOutOfBounds(selector, min_length, max_length) {
icon = '<i class="fas fa-check-circle"></i>';
parent.addClass('has-success');
}
notifyInputIfIsOutOfBounds_removeClassTImeout = setTimeout(function () {
$(selector).removeClass(animationInfo);
$(selector).removeClass(animationError);
$(selector).removeClass(animationWarning);
$(selector).removeClass(animationInfo + ' ' + animationError + ' ' + animationWarning);
}, 1000);
parent.append(feedback + '<small class="help-block">' + icon + ' ' + text.length + ' characters of ' + min_length + '-' + max_length + ' recommended</small>');
}
function passStrengthCheck(selector) {
var minLen = 6;
var pass = $(selector).val();