enmi12/glossaire/js/main.js
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 1 f6eb5a861d2f
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>

function preg_replace (array_pattern, array_pattern_replace, my_string) { var new_string = String (my_string); for (i=0; i<array_pattern.length; i++) { var reg_exp= RegExp(array_pattern[i], "gi"); var val_to_replace = array_pattern_replace[i]; new_string = new_string.replace (reg_exp, val_to_replace); } return new_string; }

function removeAccents (my_string) { var new_string = ""; var pattern_accent = new Array("é", "è", "ê", "ë", "ç", "à", "â", "ä", "î", "ï", "ù", "ô", "ó", "ö"); var pattern_replace_accent = new Array("e", "e", "e", "e", "c", "a", "a", "a", "i", "i", "u", "o", "o", "o"); if (my_string && my_string!= "") { new_string = preg_replace (pattern_accent, pattern_replace_accent, my_string); } new_string = new_string.replace(/\s+/g, ''); return new_string; }

$('#container').isotope({
  itemSelector : '.definition',
  layoutMode : 'fitRows'
});

$(function()
{
	if($('#champsRecherche').val().length > 0)
	{
		var recherche = $('#champsRecherche').val().toLowerCase();
		recherche = removeAccents(recherche);
		var resultat = $("[data-mot*='" + recherche + "']").add('.row-end');
		var selector = resultat;
		
		$('#container').isotope({ 
		filter: selector 
		});
	}
	
	$(".copyButton").click(function(evt) {
            var elt = $(evt.target);
            if(elt.siblings(".zclip").length === 0) {
                elt.zclip({
	       	    path: "ZeroClipboard.swf",
	    	    copy: function(){return elt.prev().val();},
		    afterCopy: function(){elt.text('Copié !');},
                });
            }
	});
});

$('.defineTile').click(function(event){
	event.stopPropagation();
	$(this).addClass('active');
	$(this).siblings('li').removeClass('active');
	$(this).parent().nextAll('.commentSection').hide();
});

$('.commentTile').click(function(event){
	event.stopPropagation()
	$(this).addClass('active');
	$(this).siblings('li').removeClass('active');
	$(this).parent().nextAll('.commentSection').show();
	
	//xmlRequest(event);
});

$('#menuExtraContent a').click(function(event){
	event.stopPropagation();
	$(this).addClass('active');
	$(this).siblings('a').removeClass('active');
});

$('#filters input').click(function(){
	$(this).siblings().attr('checked', false);
	$(this).attr('checked', true);
	
	if($('#champsRecherche').val().length == 0)
	{
		var selector = $('div input[checked]').attr('data-filter');
	}
	else
	{
		var recherche = $('#champsRecherche').val().toLowerCase();
		recherche = removeAccents(recherche);
		var resultat = $("[data-mot*='" + recherche + "']");
		var selector = $($('div input[checked]').attr('data-filter')).filter(resultat).add('.row-end');
	}
	
	$('#container').isotope({ 
	filter: selector 
	});
});

$('#champsRecherche').keyup(function(event){
	var recherche = $('#champsRecherche').val().toLowerCase();
	recherche = removeAccents(recherche);
	var resultat = $("[data-mot*='" + recherche + "']");
	var selector = $($('div input[checked]').attr('data-filter')).filter(resultat).add('.row-end');

	
	if($('#champsRecherche').val().length == 0)
	{
		selector = $('div input[checked]').attr('data-filter');
	}
	$('#container').isotope({ 
	filter: selector 
	});

});

$('.element').click(function(){
	if(!$(this).hasClass("folder")){
		$(this).toggleClass("large");
		if(!$(this).prevAll('.folder').first().hasClass('height2')){
			$(this).prevAll('.folder').first().toggleClass('height2');
		}
		else if($(this).prevAll('.folder').first().hasClass('height2') && $(this).siblings('.large').length == 0 && !$(this).hasClass('large')){
			$(this).prevAll('.folder').first().toggleClass('height2');
		}
		$('#container').isotope(
			'reLayout');
	}
});