--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/enmi12/glossaire/js/main.js Wed Nov 06 03:21:17 2013 +0000
@@ -0,0 +1,104 @@
+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").zclip({
+ path: "ZeroClipboard.swf",
+ copy: function(){return $(this).prev().val();},
+ afterCopy: function(){$(this).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');
+ }
+});
\ No newline at end of file