Subversion Repositories Sites.tela-botanica.org

Rev

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

Rev Author Line No. Line
616 gduche 1
/**
2
 * Script JQuery du site
3
 *
4
 * @author Grégoire Duché <jpm@tela-botanica.org>
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://162.38.234.3/jrest_tela/TelaUtilisateurs";
12
$(document).ready(function() {
13
 
14
	/**
15
	 * Ajout de contenus : inscrits, connectés, et boutons précédents et suivants
16
	 * */
17
 
18
	// On ajoute les champs Inscrits et connectés uniquement si JS obtient une réponse du service
19
	$.getJSON(url_service_jrest,
20
	        function(data){
636 gduche 21
				if (data !=null) {
22
					//Réponse du service OK
23
 
24
					var nbInscrits = data[0];
25
					var nbVisiteurs = data[1];
616 gduche 26
 
636 gduche 27
					$("#zone-menu-haut ul").prepend('<li class="vert" id="connectes"> Visiteurs : <span class="gris">' + nbVisiteurs + '</span></li>');
28
					$("#zone-menu-haut ul").prepend('<li class="vert" id="inscrits"> Inscrits : <span class="gris">' + nbInscrits + '</span></li>');
29
				} else {
30
					$("#zone-menu-haut").prepend('<span class="spacer125 hidden">&nbsp</span>');
31
				}
616 gduche 32
	        });
33
 
34
	$("#bandeauProjets").addClass("overflow-hidden");
35
	$("#bandeauProjets").css("height", "100px");
36
	$("#bandeauProjets ul").addClass("overflow-hidden");
37
	$("#bandeauProjets ul").css("width", "9000px");
38
 
39
 
40
	/********************************************************************************
41
	 * Gestion des projets - menu defilant											*
42
	 ********************************************************************************/
43
	 /*  Ajout à la volée des boutons suivant et précédent pour le menu défilant */
693 gduche 44
	 /*
45
	  *		Attention : le contenu des projets doit être une liste d'éléments <li>.
46
	  *		Ex :
47
	  *		<li><img src="" / ><h3>Projet 1</h3></li>
48
	  *		<li><img src="" / ><h3>Deuxieme projet</h3></li>
49
	  * */
616 gduche 50
 
51
		$("#bandeauProjets").append("<div id='boutonPrecedent'>&nbsp;</div>");
52
		$("#bandeauProjets").append("<div id='boutonSuivant'>&nbsp;</div>");
53
 
54
		/* Variables pour le défilement*/
55
		var position = 0;
56
		var increment = 269;
693 gduche 57
 
616 gduche 58
		$("#boutonSuivant").click(function()	{
59
			//Un clic sur le bouton "Projet suivant" doit défiler la liste des projets
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()	{
69
			//Un clic sur le bouton "Projet suivant" doit défiler la liste des projets
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
);
83
 
84
/**
85
 * Vider le champ recherche lorsqu'on clique dessus.
86
 * */
87
//TODO : mettre les versions EN...
88
function saisieChampRecherche(objet)	{
89
	if (objet.value=="Rechercher dans le site") {
90
	 objet.value = "";
91
	}
92
}