Subversion Repositories Sites.tela-botanica.org

Rev

Rev 842 | Rev 944 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
715 jpm 1
/**
2
 * Script JQuery du site
3
 *
787 gduche 4
 * @author Gr�goire Duch� <jpm@tela-botanica.org>
715 jpm 5
 * @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
6
 * @license CECILL v2 <http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt>
7
 * @version $Id$
8
 * @copyright 2009
9
 */
10
 
11
var url_service_jrest = "http://www.tela-botanica.org/client/annuaire_nouveau/actuelle/jrest/TelaUtilisateurs/";
12
$(document).ready(function() {
13
	/**
787 gduche 14
	 * Ajout de contenus : inscrits, connect�s, et boutons pr�c�dents et suivants
715 jpm 15
	 * */
787 gduche 16
	// On ajoute les champs Inscrits et connect�s uniquement si JS obtient une r�ponse du service
715 jpm 17
	$.getJSON(url_service_jrest,
18
		function(data) {
19
			if (data != null) {
787 gduche 20
				//R�ponse du service OK
715 jpm 21
				var nbInscrits = data[0];
22
				var nbVisiteurs = data[1];
23
 
24
				$("#zone-menu-haut ul #connectes span").prepend(nbVisiteurs);
25
				$("#zone-menu-haut ul #inscrits span").prepend(nbInscrits);
26
 
787 gduche 27
				// les div de classe infoInscrits se voient automatiquement concat�n� le nombre d'inscrits
842 aurelien 28
				if($(".infosInscrits a") != null) {
29
					$(".infosInscrits a").html(nbInscrits+$(".infosInscrits a").html());
715 jpm 30
				}
31
			} else {
32
				$("#zone-menu-haut").prepend('<span class="spacer125 hidden">&nbsp</span>');
33
			}
34
		});
35
 
36
	$("#bandeauProjets").addClass("overflow-hidden");
37
	$("#bandeauProjets").css("height", "100px");
38
	$("#bandeauProjets ul").addClass("overflow-hidden");
39
	$("#bandeauProjets ul").css("width", "9000px");
40
 
41
	/********************************************************************************
42
	 * Gestion des projets - menu defilant
43
	 ********************************************************************************/
787 gduche 44
	/* Ajout � la vol�e des boutons suivant et pr�c�dent pour le menu d�filant
45
	 * Attention : le contenu des projets doit �tre une liste d'�l�ments <li>.
715 jpm 46
	 * Ex :
47
	 * <li><img src="" / ><h3>Projet 1</h3></li>
48
	 * <li><img src="" / ><h3>Deuxieme projet</h3></li>
49
	 * */
50
 
51
	$("#bandeauProjets").append("<div id='boutonPrecedent'>&nbsp;</div>");
52
	$("#bandeauProjets").append("<div id='boutonSuivant'>&nbsp;</div>");
53
 
787 gduche 54
	/* Variables pour le d�filement*/
715 jpm 55
	var position = 0;
56
	var increment = 269;
57
 
58
	$("#boutonSuivant").click(function()	{
787 gduche 59
		//Un clic sur le bouton "Projet suivant" doit d�filer la liste des projets
715 jpm 60
		var ul = $(this).parent().children("ul");
61
		var nbLi = ($(ul).children("li").size())-3;
62
		if (position/increment < nbLi) {
63
			position += increment;
64
			$(ul).animate({marginLeft: '-' + position}, 400, function() {});
65
		}
66
	});
67
 
68
	$("#boutonPrecedent").click(function() {
787 gduche 69
		//Un clic sur le bouton "Projet suivant" doit d�filer la liste des projets
715 jpm 70
		if (position > 0) {
71
			position -= increment;
72
			var ul = $(this).parent().children("ul");
73
			$(ul).animate({marginLeft: '-' + position}, 400, function() {});
74
		}
75
	});
76
 
77
	if (navigator.appName == 'Microsoft Internet Explorer') {
78
		$("#zone-titre").css("font-family", "optima2");
79
		$(".motsclefs").css("font-family", "Helveticaneue2");
80
	}
81
});
82
 
787 gduche 83
 
84
/* Vider le champ recherche : prend en compte la valeur par d�faut (multilingue)*/
867 gduche 85
function nettoyerChamp(objetId, valeurDefaut)	{
86
	objet = document.getElementById(objetId);
787 gduche 87
	if (objet.value == valeurDefaut)	{
715 jpm 88
		objet.value = "";
89
	}
787 gduche 90
}