MOD passage au JSON terminé
[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].racine == racine)
463 return false
464
465 this.conversations.push({racine : 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({ "racine" : this.conversations[i].racine, "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 "email" : this.email,
529 "css" : this.css,
530 "main_page" : this.pagePrincipale < 1 ? 1 : this.pagePrincipale,
531 "conversations" : this.getJSONConversations()
532 }
533 }
534
535 /**
536 * Renvoie null si pas définit.
537 */
538 Client.prototype.getCookie = function()
539 {
540 var cookie = this.regexCookie.exec(document.cookie)
541 if (cookie == null) this.cookie = null
542 else this.cookie = cookie[1]
543 }
544
545 Client.prototype.delCookie = function()
546 {
547 document.cookie = "cookie=; max-age=0"
548 }
549
550 Client.prototype.setCookie = function(cookie)
551 {
552 if (this.cookie == null)
553 return
554
555 document.cookie =
556 "cookie="+this.cookie+
557 "; max-age=" + (60 * 60 * 24 * 365)
558 }
559
560 Client.prototype.authentifie = function()
561 {
562 return this.statut == statutType.auth_registered || this.statut == statutType.auth_not_registered
563 }
564
565 Client.prototype.setStatut = function(statut)
566 {
567 // conversation en "enum" si en "string"
568 if (typeof(statut) == "string")
569 {
570 statut =
571 statut == "registered" ?
572 statutType.auth_registered :
573 (statut == "auth_not_registered" ? statutType.auth_not_registered : statutType.deconnected)
574 }
575
576 if (statut == this.statut) return
577
578 this.statut = statut
579 this.majMenu()
580 }
581
582 /**
583 * Effectue la connexion vers le serveur.
584 * Cette fonction est bloquante tant que la connexion n'a pas été établie.
585 * S'il existe un cookie en local on s'authentifie directement avec lui.
586 * Si il n'est pas possible de s'authentifier alors on affiche un captcha anti-bot.
587 */
588 Client.prototype.connexionCookie = function()
589 {
590 this.getCookie()
591 if (this.cookie == null) return false;
592 return this.connexion(this.getJSONLoginCookie())
593 }
594
595 Client.prototype.connexionLogin = function(login, password)
596 {
597 return this.connexion(this.getJSONLogin(login, password))
598 }
599
600 Client.prototype.enregistrement = function(login, password)
601 {
602 if (this.authentifie())
603 {
604 this.login = login
605 this.password = password
606 if(this.flush())
607 this.setStatut(statutType.auth_registered)
608 return true
609 }
610 else
611 {
612 return this.connexion(this.getJSONEnregistrement(login, password))
613 }
614 }
615
616 Client.prototype.connexion = function(messageJson)
617 {
618 ;;; dumpObj(messageJson)
619 thisClient = this
620 jQuery.ajax(
621 {
622 async: false,
623 type: "POST",
624 url: "request",
625 dataType: "json",
626 data: this.util.jsonVersAction(messageJson),
627 success:
628 function(data)
629 {
630 ;;; dumpObj(data)
631 thisClient.chargerDonnees(data)
632 }
633 }
634 )
635 return this.authentifie()
636 }
637
638 Client.prototype.deconnexion = function()
639 {
640 this.setStatut(statutType.deconnected) // deconnexion
641 this.resetDonneesPersonnelles()
642 this.delCookie ()
643 }
644
645 Client.prototype.chargerDonnees = function(data)
646 {
647 var thisClient = this
648
649 this.setStatut(data["status"])
650
651 if (this.authentifie())
652 {
653 this.cookie = data["cookie"]
654 this.setCookie()
655
656 this.login = data["login"]
657 this.pseudo = data["nick"]
658 this.email = data["email"]
659 this.css = data["css"]
660
661 // la page de la conversation principale
662 this.pagePrincipale = data["main_page"] == undefined ? 1 : data["main_page"]
663
664 // met à jour la css
665 if (this.css != "")
666 {
667 jQuery("link#cssPrincipale").attr("href", this.css)
668 this.majMenu()
669 }
670 // les conversations
671 thisClient.conversations = data["conversations"]
672
673 }
674 this.dernierMessageErreur = data["error_message"]
675 }
676
677 /**
678 * Met à jour les données personne sur serveur.
679 * @param async de manière asynchrone ? défaut = true
680 * @return false si le flush n'a pas pû se faire sinon true
681 */
682 Client.prototype.flush = function(async)
683 {
684 if (async == undefined)
685 async = true
686
687 if (!this.authentifie())
688 return false
689
690 thisClient = this
691 //this.util.jsonVersAction(this.getJSONProfile()).action.dump("Flush client")
692 jQuery.ajax(
693 {
694 async: async,
695 type: "POST",
696 url: "request",
697 dataType: "json",
698 data: this.util.jsonVersAction(this.getJSONProfile()),
699 success:
700 function(data)
701 {
702 //thisClient.util.log(thisClient.util.serializer.serializeToString(data))
703 }
704 }
705 )
706 // TODO : retourner false si un problème est survenu lors de l'update du profile
707 return true
708 }
709
710 Client.prototype.majMenu = function()
711 {
712 var displayType = this.css == "css/3/euphorik.css" ? "block" : "inline" //this.client
713
714 // met à jour le menu
715 if (this.statut == statutType.auth_registered)
716 {
717 jQuery("#menu .profile").css("display", displayType).text("profile")
718 jQuery("#menu .logout").css("display", displayType)
719 jQuery("#menu .register").css("display", "none")
720 }
721 else if (this.statut == statutType.auth_not_registered)
722 {
723 jQuery("#menu .profile").css("display", "none")
724 jQuery("#menu .logout").css("display", displayType)
725 jQuery("#menu .register").css("display", displayType)
726 }
727 else
728 {
729 jQuery("#menu .profile").css("display", displayType).text("login")
730 jQuery("#menu .logout").css("display", "none")
731 jQuery("#menu .register").css("display", displayType)
732 }
733 }
734
735 ///////////////////////////////////////////////////////////////////////////////////////////////////
736
737 jQuery.noConflict()
738
739 // charge dynamiquement le script de debug
740 ;;; jQuery.ajax({async : false, url : "js/debug.js", dataType : "script"})
741
742 // le main
743 jQuery(document).ready(
744 function()
745 {
746 /* FIXME : ce code pose problème sur konqueror, voir : http://www.kde-forum.org/thread.php?threadid=17993
747 var p = new DOMParser();
748 var doc = p.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
749 var s = new XMLSerializer()
750 alert(s.serializeToString(doc)) */
751
752 var util = new Util()
753 var client = new Client(util)
754 var pages = new Pages()
755 var formateur = new Formateur()
756
757 // connexion vers le serveur (utilise un cookie qui traine)
758 client.connexionCookie()
759
760 // les styles css
761 for (var i = 1; i <= 3; i++)
762 {
763 jQuery("#css"+i).click(function(){
764 client.setCss("css/" + jQuery(this).attr("id").charAt(3) + "/euphorik.css")
765 })
766 }
767
768 jQuery(document).unload(
769 function()
770 {
771 alert("ok")
772 client.flush()
773 }
774 )
775
776 jQuery("#menu .minichat").click(function(){ pages.afficherPage("minichat") })
777 jQuery("#menu .profile").click(function(){ pages.afficherPage("profile") })
778 jQuery("#menu .logout").click(function(){
779 util.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", messageType.question,
780 {"Oui" : function()
781 {
782 client.deconnexion();
783 pages.afficherPage("minichat", true)
784 },
785 "Non" : function(){}
786 }
787 )
788 })
789 jQuery("#menu .register").click(function(){ pages.afficherPage("register") })
790
791 pages.ajouterPage(new PageMinichat(client, formateur, util))
792 pages.ajouterPage(new PageProfile(client, formateur, util))
793 pages.ajouterPage(new PageRegister(client, formateur, util))
794 pages.afficherPage("minichat")
795 }
796 )