enmi12/glossaire/js/form.js
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 0 d970ebf37754
permissions -rwxr-xr-x
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>

$('.commentSection form').click(function(event){
	event.stopPropagation();

});

$('.commentSection input').focus(function(event){

	event.stopPropagation();
	console.log($(this).val() + '   ' + values[returnOldValue($(this).attr('name'))]);
	if($(this).val() == values[returnOldValue($(this).attr('name'))]){
		$(this).val(($(this).attr('name') == 'twitter') ?'@':'');
		$(this).css('color', '#000');
	}
});

$('.commentInput').focus(function(event){

	event.stopPropagation();
	
	if($(this).val() == values[returnOldValue($(this).attr('name'))]){
		$(this).val('');
		$(this).css('color', '#000');
	}
});

var pseudo = 'nom/pseudo';
var mail = 'mail';
var twitter = 'twitter';
var comment = 'votre commentaire';
var values = [pseudo, mail, twitter, comment];

$('.commentSection input').focusout(function(event){
	event.stopPropagation();
	if($(this).val().length	== 0 || $(this).val() == '@'){
		$(this).val(values[returnOldValue($(this).attr('name'))]);
		$(this).css('color', '#b7b7b7');
	}
});

$('.commentInput').focusout(function(event){
	event.stopPropagation();
	console.log(isThisEqual($(this).val().length, 0));
	if($(this).val().length == 0 || $(this).val().length == '@'){
		$(this).val(values[returnOldValue($(this).attr('name'))]);
		$(this).css('color', '#b7b7b7');
	}
});

function isThisEqual(un, deux){
	console.log(un + '//' + deux);
	if(un == deux){
		return true;
	}
	return false;
}

function returnOldValue(attribut)
{
	switch(attribut)
	{
		case 'pseudo':
		return 0
		break;
		
		case 'mail' :
		return 1
		break;
		
		case 'twitter' :
		return 2
		break;
		
		case 'comment' :
		return 3
		break;
	}
}