MOD correction de bugs (youpi)
[euphorik.git] / js / euphorik.js
1 // coding: utf-8
2
3 /**
4 * Contient la base javascript pour le site euphorik.ch.
5 * Chaque page possède son propre fichier js nommé "page<nom de la page>.js".
6 * Auteur : GBurri
7 * Date : 6.11.2007
8 */
9
10
11 /**
12 * La configuration.
13 * Normalement 'const' à la place de 'var' mais non supporté par IE7.
14 */
15 var conf = {
16 nbMessageAffiche : 10, // (par page)
17 pseudoDefaut : "<nick>",
18 tempsAffichageMessageDialogue : 4000, // en ms
19 smiles : {
20 "smile" : [/:\)/g, /:-\)/g],
21 "bigsmile" : [/:D/g, /:-D/g],
22 "clin" : [/;\)/g, /;-\)/g],
23 "cool" : [/8\)/g, /8-\)/g],
24 "eheheh" : [/:P/g, /:-P/g],
25 "oh" : [/:o/g, /:O/g],
26 "pascontent" : [/>\(/g, /&gt;\(/g],
27 "sniff" : [/:\(/g, /:-\(/g],
28 "argn" : [/\[:argn\]/g],
29 "bunny" : [/\[:lapin\]/g],
30 "chat" : [/\[:chat\]/g],
31 "renne" : [/\[:renne\]/g],
32 "lol" : [/\[:lol\]/g],
33 "spliff" : [/\[:spliff\]/g],
34 "star" : [/\[:star\]/g],
35 "triste" : [/\[:triste\]/g],
36 "kirby" : [/\[:kirby\]/g]
37 }
38 }
39
40 ///////////////////////////////////////////////////////////////////////////////////////////////////
41
42 String.prototype.trim = function()
43 {
44 return jQuery.trim(this) // anciennement : this.replace(/^\s+|\s+$/g, "");
45 }
46
47 String.prototype.ltrim = function()
48 {
49 return this.replace(/^\s+/, "");
50 }
51
52 String.prototype.rtrim = function()
53 {
54 return this.replace(/\s+$/, "");
55 }
56
57 ///////////////////////////////////////////////////////////////////////////////////////////////////
58
59 /**
60 * Cette classe regroupe des fonctions utilitaires (helpers).
61 */
62 function Util()
63 {
64 jQuery("#info .fermer").click(function(){
65 jQuery("#info").slideUp(50)
66 })
67 }
68
69 /**
70 * Affiche une boite de dialogue avec un message à l'intérieur.
71 * @param message le message (string)
72 * @param type voir 'messageType'. par défaut messageType.informatif
73 * @param les boutons sous la forme d'un objet ou les clefs sont les labels des boutons
74 * et les valeurs les fonctions executées lorsqu'un bouton est activé.
75 */
76 Util.prototype.messageDialogue = function(message, type, boutons)
77 {
78 if (type == undefined)
79 type = messageType.informatif
80
81 if (this.timeoutMessageDialogue != undefined)
82 clearTimeout(this.timeoutMessageDialogue)
83
84 var fermer = function(){jQuery("#info").slideUp(100)}
85 fermer()
86
87 jQuery("#info .message").html(message)
88 switch(type)
89 {
90 case messageType.informatif : jQuery("#info #icone").attr("class", "information"); break
91 case messageType.question : jQuery("#info #icone").attr("class", "interrogation"); break
92 case messageType.erreur : jQuery("#info #icone").attr("class", "exclamation"); break
93 }
94 jQuery("#info .boutons").html("")
95 for (var b in boutons)
96 jQuery("#info .boutons").append("<div>" + b + "</div>").find("div:last").click(boutons[b]).click(fermer)
97
98 jQuery("#info").slideDown(200)
99 this.timeoutMessageDialogue = setTimeout(fermer, conf.tempsAffichageMessageDialogue)
100 }
101
102 var messageType = {informatif: 0, question: 1, erreur: 2}
103
104 /**
105 * Utilisé pour l'envoie de donnée avec la méthode ajax de jQuery.
106 */
107 Util.prototype.jsonVersAction = function(json)
108 {
109 // FIXME : ne plus encapsuler json dans de l'xml (problème avec yaws)
110 return {action: "<json>" + JSON.stringify(json) + "</json>" }
111 }
112
113 Util.prototype.md5 = function(chaine)
114 {
115 return hex_md5(chaine)
116 }
117
118 // pompé de http://www.faqts.com/knowledge_base/view.phtml/aid/13562/fid/130
119 Util.prototype.setSelectionRange = function(input, selectionStart, selectionEnd)
120 {
121 if (input.setSelectionRange)
122 {
123 input.focus()
124 input.setSelectionRange(selectionStart, selectionEnd)
125 }
126 else if (input.createTextRange)
127 {
128 var range = input.createTextRange()
129 range.collapse(true)
130 range.moveEnd('character', selectionEnd)
131 range.moveStart('character', selectionStart)
132 range.select()
133 }
134 }
135
136 Util.prototype.setCaretToEnd = function(input)
137 {
138 this.setSelectionRange(input, input.value.length, input.value.length)
139 }
140 Util.prototype.setCaretToBegin = function(input)
141 {
142 this.setSelectionRange(input, 0, 0)
143 }
144 Util.prototype.setCaretToPos = function(input, pos)
145 {
146 this.setSelectionRange(input, pos, pos)
147 }
148 Util.prototype.selectString = function(input, string)
149 {
150 var match = new RegExp(string, "i").exec(input.value)
151 if (match)
152 {
153 this.setSelectionRange (input, match.index, match.index + match[0].length)
154 }
155 }
156 Util.prototype.replaceSelection = function(input, replaceString) {
157 if (input.setSelectionRange)
158 {
159 var selectionStart = input.selectionStart
160 var selectionEnd = input.selectionEnd
161 input.value = input.value.substring(0, selectionStart) + replaceString + input.value.substring(selectionEnd)
162
163 if (selectionStart != selectionEnd) // has there been a selection
164 this.setSelectionRange(input, selectionStart, selectionStart + replaceString.length)
165 else // set caret
166 this.setCaretToPos(input, selectionStart + replaceString.length)
167 }
168 else if (document.selection)
169 {
170 var range = document.selection.createRange();
171 if (range.parentElement() == input)
172 {
173 var isCollapsed = range.text == ''
174 range.text = replaceString
175 if (!isCollapsed)
176 {
177 // there has been a selection
178 // it appears range.select() should select the newly
179 // inserted text but that fails with IE
180 range.moveStart('character', -replaceString.length);
181 range.select();
182 }
183 }
184 }
185 }
186
187 ///////////////////////////////////////////////////////////////////////////////////////////////////
188
189 function Pages()
190 {
191 this.pageCourante = null
192 this.pages = {}
193 }
194
195 Pages.prototype.ajouterPage = function(page)
196 {
197 page.pages = this // la magie des langages dynamiques : le foutoire
198 this.pages[page.nom] = page
199 }
200
201 Pages.prototype.afficherPage = function(nomPage, forcerChargement)
202 {
203 if (forcerChargement == undefined) forcerChargement = false
204
205 var page = this.pages[nomPage]
206 if (page == undefined || (!forcerChargement && page == this.pageCourante)) return
207
208 if (this.pageCourante != null && this.pageCourante.decharger)
209 this.pageCourante.decharger()
210
211 jQuery("#menu div").removeClass("courante")
212 jQuery("#menu div." + nomPage).addClass("courante")
213
214 this.pageCourante = page
215 jQuery("#page").html(this.pageCourante.contenu()).removeClass().addClass(this.pageCourante.nom)
216
217 if (this.pageCourante.charger)
218 this.pageCourante.charger()
219 }
220
221 ///////////////////////////////////////////////////////////////////////////////////////////////////
222
223 function Formateur()
224 {
225 this.smiles = conf.smiles
226 this.protocoles = "http|https|ed2k"
227
228 this.regexUrl = new RegExp("(?:(?:" + this.protocoles + ")://|www\\.)[^ ]*", "gi")
229 this.regexImg = new RegExp("^.*?\\.(gif|jpg|png|jpeg|bmp|tiff)$", "i")
230 this.regexDomaine = new RegExp("^(?:(?:" + this.protocoles + ")://|www\\.).*?([^/.]+\\.[^/.]+)(?:$|/).*$", "i")
231 this.regexTestProtocoleExiste = new RegExp("^(?:" + this.protocoles + ")://.*$", "i")
232 this.regexNomProtocole = new RegExp("^(.*?)://")
233 }
234
235 /**
236 * Formate un pseudo saise par l'utilisateur.
237 * @param pseudo le pseudo brut
238 * @return le pseudo filtré
239 */
240 Formateur.prototype.filtrerInputPseudo = function(pseudo)
241 {
242 return pseudo.replace(/{|}/g, "").trim()
243 }
244
245 Formateur.prototype.getSmilesHTML = function()
246 {
247 var XHTML = ""
248 for (var sNom in this.smiles)
249 {
250 XHTML += "<img class=\"" + sNom + "\" src=\"img/smileys/" + sNom + ".gif\" />"
251 }
252 return XHTML
253 }
254
255 Formateur.prototype.traitementComplet = function(M, pseudo)
256 {
257 return this.traiterLiensConv(this.traiterSmiles(this.traiterURL(this.remplacerBalisesHTML(M), pseudo)))
258 }
259
260 /**
261 * Transforme les liens en entités clickables.
262 * Un lien vers une conversation permet d'ouvrire celle ci, elle se marque comme ceci dans un message :
263 * "{5F}" ou 5F est la racine de la conversation.
264 * Ce lien sera transformer en <span class="lienConv">{5F}</span> pouvant être clické pour créer la conv 5F.
265 */
266 Formateur.prototype.traiterLiensConv = function(M)
267 {
268 return M.replace(
269 /\{\w+\}/g,
270 function(lien)
271 {
272 return "<span class=\"lienConv\">" + lien + "</span>"
273 }
274 )
275 }
276
277 /**
278 * FIXME : Cette méthode est attrocement lourde ! A optimiser.
279 */
280 Formateur.prototype.traiterSmiles = function(M)
281 {
282 for (var sNom in this.smiles)
283 {
284 ss = this.smiles[sNom]
285 for (var i = 0; i < ss.length; i++)
286 M = M.replace(ss[i], "<img src=\"img/smileys/" + sNom + ".gif\" />")
287 }
288 return M
289 }
290
291 Formateur.prototype.remplacerBalisesHTML = function(M)
292 {
293 return M.replace(/</g, "&lt;").replace(/>/g, "&gt;")
294 }
295
296 Formateur.prototype.traiterURL = function(M, pseudo)
297 {
298 thisFormateur = this
299
300 if (pseudo == undefined)
301 pseudo = ""
302
303 var traitementUrl = function(url)
304 {
305 // si ya pas de protocole on rajoute "http://"
306 if (!thisFormateur.regexTestProtocoleExiste.test(url))
307 url = "http://" + url
308 var extension = thisFormateur.getShort(url)
309 return "<a " + (extension[1] ? "title=\"" + thisFormateur.traiterPourFenetreLightBox(pseudo, url) + ": " + thisFormateur.traiterPourFenetreLightBox(M, url) + "\"" + " rel=\"lightbox[groupe]\"" : "") + " href=\"" + url + "\" >[" + extension[0] + "]</a>"
310 }
311 return M.replace(this.regexUrl, traitementUrl)
312 }
313
314 /**
315 * Renvoie une version courte de l'url.
316 * par exemple : http://en.wikipedia.org/wiki/Yakov_Smirnoff devient wikipedia.org
317 */
318 Formateur.prototype.getShort = function(url)
319 {
320 var estUneImage = false
321 var versionShort = null
322 var rechercheImg = this.regexImg.exec(url)
323 //alert(url)
324 if (rechercheImg != null)
325 {
326 versionShort = rechercheImg[1].toLowerCase()
327 if (versionShort == "jpeg") versionShort = "jpg" // jpeg -> jpg
328 estUneImage = true
329 }
330 else
331 {
332 var rechercheDomaine = this.regexDomaine.exec(url)
333 if (rechercheDomaine != null && rechercheDomaine.length >= 2)
334 versionShort = rechercheDomaine[1]
335 else
336 {
337 var nomProtocole = this.regexNomProtocole.exec(url)
338 if (nomProtocole != null && nomProtocole.length >= 2)
339 versionShort = nomProtocole[1]
340 }
341 }
342
343 return [versionShort == null ? "url" : versionShort, estUneImage]
344 }
345
346 /**
347 * Traite les pseudo et messages à être affiché dans le titre d'une image visualisé avec lightbox.
348 */
349 Formateur.prototype.traiterPourFenetreLightBox = function(M, urlCourante)
350 {
351 thisFormateur = this
352 var traitementUrl = function(url)
353 {
354 return "[" + thisFormateur.getShort(url)[0] + (urlCourante == url ? ": image courante" : "") + "]"
355 }
356
357 return this.remplacerBalisesHTML(M).replace(this.regexUrl, traitementUrl)
358 }
359
360
361 ///////////////////////////////////////////////////////////////////////////////////////////////////
362
363 // les statuts possibes du client
364 var statutType = {
365 // mode enregistré, peut poster des messages et modifier son profile
366 auth_registered : 0,
367 // mode identifié, peut poster des messages mais n'a pas accès au profile
368 auth_not_registered : 1,
369 // mode déconnecté, ne peut pas poster de message
370 deconnected : 2
371 }
372
373 function Client(util)
374 {
375 this.util = util
376
377 this.cookie = null
378 this.regexCookie = new RegExp("^cookie=([^;]*)")
379
380 // données personnels
381 this.resetDonneesPersonnelles()
382
383 this.setStatut(statutType.deconnected)
384
385 // le dernier message d'erreur recut du serveur (par exemple une connexion foireuse : "login impossible")
386 this.dernierMessageErreur = ""
387 }
388
389 Client.prototype.resetDonneesPersonnelles = function()
390 {
391 this.pseudo = conf.pseudoDefaut
392 this.login = ""
393 this.password = ""
394 this.email = ""
395 this.css = jQuery("link#cssPrincipale").attr("href")
396
397 this.pagePrincipale = 1
398
399 // les conversations, une conversation est un objet possédant les attributs suivants :
400 // - racine (entier)
401 // - page (entier)
402 this.conversations = new Array()
403 }
404
405 Client.prototype.setCss = function(css)
406 {
407 if (this.css == css)
408 return
409
410 this.css = css
411 jQuery("link#cssPrincipale").attr("href", this.css)
412 this.majMenu()
413 }
414
415 Client.prototype.pageSuivante = function(numConv)
416 {
417 if (numConv < 0 && this.pagePrincipale > 1)
418 this.pagePrincipale -= 1
419 else if (this.conversations[numConv].page > 1)
420 this.conversations[numConv].page -= 1
421 }
422
423 Client.prototype.pagePrecedente = function(numConv)
424 {
425 if (numConv < 0)
426 this.pagePrincipale += 1
427 else
428 this.conversations[numConv].page += 1
429 }
430
431 /**
432 * Définit la première page pour la conversation donnée.
433 * @return true si la page a changé sinon false
434 */
435 Client.prototype.goPremierePage = function(numConv)
436 {
437 if (numConv < 0)
438 {
439 if (this.pagePrincipale == 1)
440 return false
441 this.pagePrincipale = 1
442 }
443 else
444 {
445 if (this.conversations[numConv].page == 1)
446 return false
447 this.conversations[numConv].page = 1
448 }
449 return true
450 }
451
452 /**
453 * Ajoute une conversation à la vue de l'utilisateur.
454 * Le profile de l'utilisateur est directement sauvegardé sur le serveur.
455 * @param racines la racine de la conversation (integer)
456 * @return true si la conversation a été créée sinon false (par exemple si la conv existe déjà)
457 */
458 Client.prototype.ajouterConversation = function(racine)
459 {
460 // vérification s'il elle n'existe pas déjà
461 for (var i = 0; i < this.conversations.length; i++)
462 if (this.conversations[i].root == racine)
463 return false
464
465 this.conversations.push({root : racine, page : 1})
466 return true
467 }
468
469 Client.prototype.supprimerConversation = function(num)
470 {
471 if (num < 0 || num >= this.conversations.length) return
472
473 // décalage TODO : supprimer le dernier élément
474 for (var i = num; i < this.conversations.length - 1; i++)
475 this.conversations[i] = this.conversations[i+1]
476 this.conversations.pop()
477 }
478
479 Client.prototype.getJSONLogin = function(login, password)
480 {
481 return {
482 "action" : "authentification",
483 "login" : login,
484 "password" : password
485 }
486 }
487
488 Client.prototype.getJSONLoginCookie = function()
489 {
490 return {
491 "action" : "authentification",
492 "cookie" : this.cookie
493 }
494 }
495
496 /**
497 * le couple (login, password) est facultatif. S'il n'est pas fournit alors il ne sera pas possible
498 * de s'autentifier avec (login, password).
499 */
500 Client.prototype.getJSONEnregistrement = function(login, password)
501 {
502 var mess = { "action" : "register" }
503
504 if (login != undefined && password != undefined)
505 {
506 mess["login"] = login
507 mess["password"] = password
508 }
509
510 return mess;
511 }
512
513 Client.prototype.getJSONConversations = function()
514 {
515 var conversations = new Array()
516 for (var i = 0; i < this.conversations.length; i++)
517 conversations.push({ "root" : this.conversations[i].root, "page" : this.conversations[i].page})
518 return conversations
519 }
520
521 Client.prototype.getJSONProfile = function()
522 {
523 return {
524 "action" : "set_profile",
525 "cookie" : this.cookie,
526 "login" : this.login,
527 "password" : this.password,
528 "nick" : this.pseudo,
529 "email" : this.email,
530 "css" : this.css,
531 "main_page" : this.pagePrincipale < 1 ? 1 : this.pagePrincipale,
532 "conversations" : this.getJSONConversations()
533 }
534 }
535
536 /**
537 * Renvoie null si pas définit.
538 */
539 Client.prototype.getCookie = function()
540 {
541 var cookie = this.regexCookie.exec(document.cookie)
542 if (cookie == null) this.cookie = null
543 else this.cookie = cookie[1]
544 }
545
546 Client.prototype.delCookie = function()
547 {
548 document.cookie = "cookie=; max-age=0"
549 }
550
551 Client.prototype.setCookie = function(cookie)
552 {
553 if (this.cookie == null)
554 return
555
556 document.cookie =
557 "cookie="+this.cookie+
558 "; max-age=" + (60 * 60 * 24 * 365)
559 }
560
561 Client.prototype.authentifie = function()
562 {
563 return this.statut == statutType.auth_registered || this.statut == statutType.auth_not_registered
564 }
565
566 Client.prototype.setStatut = function(statut)
567 {
568 // conversation en "enum" si en "string"
569 if (typeof(statut) == "string")
570 {
571 statut =
572 statut == "registered" ?
573 statutType.auth_registered :
574 (statut == "auth_not_registered" ? statutType.auth_not_registered : statutType.deconnected)
575 }
576
577 if (statut == this.statut) return
578
579 this.statut = statut
580 this.majMenu()
581 }
582
583 /**
584 * Effectue la connexion vers le serveur.
585 * Cette fonction est bloquante tant que la connexion n'a pas été établie.
586 * S'il existe un cookie en local on s'authentifie directement avec lui.
587 * Si il n'est pas possible de s'authentifier alors on affiche un captcha anti-bot.
588 */
589 Client.prototype.connexionCookie = function()
590 {
591 this.getCookie()
592 if (this.cookie == null) return false;
593 return this.connexion(this.getJSONLoginCookie())
594 }
595
596 Client.prototype.connexionLogin = function(login, password)
597 {
598 return this.connexion(this.getJSONLogin(login, password))
599 }
600
601 Client.prototype.enregistrement = function(login, password)
602 {
603 if (this.authentifie())
604 {
605 this.login = login
606 this.password = password
607 if(this.flush())
608 this.setStatut(statutType.auth_registered)
609 return true
610 }
611 else
612 {
613 return this.connexion(this.getJSONEnregistrement(login, password))
614 }
615 }
616
617 Client.prototype.connexion = function(messageJson)
618 {
619 ;;; dumpObj(messageJson)
620 thisClient = this
621 jQuery.ajax(
622 {
623 async: false,
624 type: "POST",
625 url: "request",
626 dataType: "json",
627 data: this.util.jsonVersAction(messageJson),
628 success:
629 function(data)
630 {
631 ;;; dumpObj(data)
632 thisClient.chargerDonnees(data)
633 }
634 }
635 )
636 return this.authentifie()
637 }
638
639 Client.prototype.deconnexion = function()
640 {
641 this.setStatut(statutType.deconnected) // deconnexion
642 this.resetDonneesPersonnelles()
643 this.delCookie ()
644 }
645
646 Client.prototype.chargerDonnees = function(data)
647 {
648 var thisClient = this
649
650 this.setStatut(data["status"])
651
652 if (this.authentifie())
653 {
654 this.cookie = data["cookie"]
655 this.setCookie()
656
657 this.login = data["login"]
658 this.pseudo = data["nick"]
659 this.email = data["email"]
660 this.css = data["css"]
661
662 // la page de la conversation principale
663 this.pagePrincipale = data["main_page"] == undefined ? 1 : data["main_page"]
664
665 // met à jour la css
666 if (this.css != "")
667 {
668 jQuery("link#cssPrincipale").attr("href", this.css)
669 this.majMenu()
670 }
671 // les conversations
672 thisClient.conversations = data["conversations"]
673
674 }
675 this.dernierMessageErreur = data["error_message"]
676 }
677
678 /**
679 * Met à jour les données personne sur serveur.
680 * @param async de manière asynchrone ? défaut = true
681 * @return false si le flush n'a pas pû se faire sinon true
682 */
683 Client.prototype.flush = function(async)
684 {
685 if (async == undefined)
686 async = true
687
688 if (!this.authentifie())
689 return false
690
691 thisClient = this
692 ;;; dumpObj(this.getJSONProfile())
693 jQuery.ajax(
694 {
695 async: async,
696 type: "POST",
697 url: "request",
698 dataType: "json",
699 data: this.util.jsonVersAction(this.getJSONProfile()),
700 success:
701 function(data)
702 {
703 //thisClient.util.log(thisClient.util.serializer.serializeToString(data))
704 }
705 }
706 )
707 // TODO : retourner false si un problème est survenu lors de l'update du profile
708 return true
709 }
710
711 Client.prototype.majMenu = function()
712 {
713 var displayType = this.css == "css/3/euphorik.css" ? "block" : "inline" //this.client
714
715 // met à jour le menu
716 if (this.statut == statutType.auth_registered)
717 {
718 jQuery("#menu .profile").css("display", displayType).text("profile")
719 jQuery("#menu .logout").css("display", displayType)
720 jQuery("#menu .register").css("display", "none")
721 }
722 else if (this.statut == statutType.auth_not_registered)
723 {
724 jQuery("#menu .profile").css("display", "none")
725 jQuery("#menu .logout").css("display", displayType)
726 jQuery("#menu .register").css("display", displayType)
727 }
728 else
729 {
730 jQuery("#menu .profile").css("display", displayType).text("login")
731 jQuery("#menu .logout").css("display", "none")
732 jQuery("#menu .register").css("display", displayType)
733 }
734 }
735
736 ///////////////////////////////////////////////////////////////////////////////////////////////////
737
738 jQuery.noConflict()
739
740 // charge dynamiquement le script de debug
741 ;;; jQuery.ajax({async : false, url : "js/debug.js", dataType : "script"})
742
743 // le main
744 jQuery(document).ready(
745 function()
746 {
747 /* FIXME : ce code pose problème sur konqueror, voir : http://www.kde-forum.org/thread.php?threadid=17993
748 var p = new DOMParser();
749 var doc = p.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
750 var s = new XMLSerializer()
751 alert(s.serializeToString(doc)) */
752
753 var util = new Util()
754 var client = new Client(util)
755 var pages = new Pages()
756 var formateur = new Formateur()
757
758 // connexion vers le serveur (utilise un cookie qui traine)
759 client.connexionCookie()
760
761 // les styles css
762 for (var i = 1; i <= 3; i++)
763 {
764 jQuery("#css"+i).click(function(){
765 client.setCss("css/" + jQuery(this).attr("id").charAt(3) + "/euphorik.css")
766 })
767 }
768
769 // TODO : pourquoi jQuery(document).unload ne fonctionne pas ?
770 jQuery(window).unload(
771 function()
772 {
773 //alert("ok")
774 client.flush(false)
775 }
776 )
777
778 jQuery("#menu .minichat").click(function(){ pages.afficherPage("minichat") })
779 jQuery("#menu .profile").click(function(){ pages.afficherPage("profile") })
780 jQuery("#menu .logout").click(function(){
781 util.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", messageType.question,
782 {"Oui" : function()
783 {
784 client.deconnexion();
785 pages.afficherPage("minichat", true)
786 },
787 "Non" : function(){}
788 }
789 )
790 })
791 jQuery("#menu .register").click(function(){ pages.afficherPage("register") })
792
793 pages.ajouterPage(new PageMinichat(client, formateur, util))
794 pages.ajouterPage(new PageProfile(client, formateur, util))
795 pages.ajouterPage(new PageRegister(client, formateur, util))
796 pages.afficherPage("minichat")
797 }
798 )