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".
12 * Normalement 'const' à la place de 'var' mais non supporté par IE7.
15 nbMessageAffiche : 10, // (par page)
16 pseudoDefaut : "<nick>",
17 tempsAffichageMessageDialogue : 4000, // en ms
19 "smile" : [/:\)/g, /:-\)/g],
20 "bigsmile" : [/:D/g, /:-D/g],
21 "clin" : [/;\)/g, /;-\)/g],
22 "cool" : [/8\)/g, /8-\)/g],
23 "eheheh" : [/:P/g, /:-P/g],
24 "oh" : [/:o/g, /:O/g],
25 "pascontent" : [/>\(/g, />\(/g],
26 "sniff" : [/:\(/g, /:-\(/g],
27 "argn" : [/\[:argn\]/g],
28 "bunny" : [/\[:lapin\]/g],
29 "chat" : [/\[:chat\]/g],
30 "renne" : [/\[:renne\]/g],
31 "lol" : [/\[:lol\]/g],
32 "spliff" : [/\[:spliff\]/g],
33 "star" : [/\[:star\]/g],
34 "triste" : [/\[:triste\]/g],
35 "kirby" : [/\[:kirby\]/g]
39 ///////////////////////////////////////////////////////////////////////////////////////////////////
41 String
.prototype.trim = function()
43 return this.replace(/^\s+|\s+$/g, "");
46 String
.prototype.ltrim = function()
48 return this.replace(/^\s+/, "");
51 String
.prototype.rtrim = function()
53 return this.replace(/\s+$/, "");
56 String
.prototype.dump = function(titre
)
58 titre
= titre
== undefined ? "" : titre
59 if (typeof dump
!= "undefined")
61 dump("\n--- EUPHORIK.CH : " + titre
+ " ---\n")
67 ///////////////////////////////////////////////////////////////////////////////////////////////////
70 * Cette classe regroupe des fonctions utilitaires (helpers).
74 if(typeof XMLSerializer
!= "undefined")
75 this.serializer
= new XMLSerializer()
77 jQuery("#info .fermer").click(function(){
78 jQuery("#info").slideUp(50)
83 * Affiche une boite de dialogue avec un message à l'intérieur.
84 * @param message le message (string)
85 * @param type voir 'messageType'. par défaut messageType.informatif
86 * @param les boutons sous la forme d'un objet ou les clefs sont les labels des boutons
87 * et les valeurs les fonctions executées lorsqu'un bouton est activé.
89 Util
.prototype.messageDialogue = function(message
, type
, boutons
)
91 if (type
== undefined)
92 type
= messageType
.informatif
94 if (this.timeoutMessageDialogue
!= undefined)
95 clearTimeout(this.timeoutMessageDialogue
)
97 var fermer = function(){jQuery("#info").slideUp(100)}
100 jQuery("#info .message").html(message
)
103 case messageType
.informatif : jQuery("#info #icone").attr("class", "information"); break
104 case messageType
.question : jQuery("#info #icone").attr("class", "interrogation"); break
105 case messageType
.erreur : jQuery("#info #icone").attr("class", "exclamation"); break
107 jQuery("#info .boutons").html("")
108 for (var b
in boutons
)
109 jQuery("#info .boutons").append("<div>" + b
+ "</div>").find("div:last").click(boutons
[b
]).click(fermer
)
111 jQuery("#info").slideDown(200)
112 this.timeoutMessageDialogue
= setTimeout(fermer
, conf
.tempsAffichageMessageDialogue
)
114 var messageType
= {informatif: 0, question: 1, erreur: 2}
117 * Transforme un document XML en string.
119 Util
.prototype.serializeXML = function(documentXML
)
122 return this.serializer
.serializeToString(documentXML
)
124 return documentXML
.xml
127 var documentXMLBase
= undefined // singleton
128 Util
.prototype.creerDocumentXMLAction = function()
130 // FIXME : essayer de garder le doc de base en cache (singleton) et d'en retourner une copie
131 if (true)//documentXMLBase == undefined)
133 if (document
.implementation
&& document
.implementation
.createDocument
)
135 // var doc = document.implementation.createDocument("", "action", null)
136 var parser
= new DOMParser();
137 documentXMLBase
= parser
.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
138 //alert(this.serializeXML(doc))
140 else if (window
.ActiveXObject
)
142 documentXMLBase
= new ActiveXObject("MSXML2.DOMDocument") //("Microsoft.XMLDOM")
143 documentXMLBase
.appendChild(doc
.createElement("action"));
144 //doc.loadXML("<action></action>")
145 //alert(doc.documentElement)
146 //doc.createElement("action")
149 return documentXMLBase
152 Util
.prototype.xmlVersAction = function(xml
)
154 //return {action: this.to_utf8(this.serializeXML(xml /*, "UTF-8"*/))}
155 return {action: this.serializeXML(xml
)}
158 Util
.prototype.md5 = function(chaine
)
160 return hex_md5(chaine
)
163 // pompé de http://www.faqts.com/knowledge_base/view.phtml/aid/13562/fid/130
164 Util
.prototype.setSelectionRange = function(input
, selectionStart
, selectionEnd
)
166 if (input
.setSelectionRange
)
169 input
.setSelectionRange(selectionStart
, selectionEnd
)
171 else if (input
.createTextRange
)
173 var range
= input
.createTextRange()
175 range
.moveEnd('character', selectionEnd
)
176 range
.moveStart('character', selectionStart
)
181 Util
.prototype.setCaretToEnd = function(input
)
183 this.setSelectionRange(input
, input
.value
.length
, input
.value
.length
)
185 Util
.prototype.setCaretToBegin = function(input
)
187 this.setSelectionRange(input
, 0, 0)
189 Util
.prototype.setCaretToPos = function(input
, pos
)
191 this.setSelectionRange(input
, pos
, pos
)
193 Util
.prototype.selectString = function(input
, string
)
195 var match
= new RegExp(string
, "i").exec(input
.value
)
198 this.setSelectionRange (input
, match
.index
, match
.index
+ match
[0].length
)
201 Util
.prototype.replaceSelection = function(input
, replaceString
) {
202 if (input
.setSelectionRange
)
204 var selectionStart
= input
.selectionStart
205 var selectionEnd
= input
.selectionEnd
206 input
.value
= input
.value
.substring(0, selectionStart
) + replaceString
+ input
.value
.substring(selectionEnd
)
208 if (selectionStart
!= selectionEnd
) // has there been a selection
209 this.setSelectionRange(input
, selectionStart
, selectionStart
+ replaceString
.length
)
211 this.setCaretToPos(input
, selectionStart
+ replaceString
.length
)
213 else if (document
.selection
)
215 var range
= document
.selection
.createRange();
216 if (range
.parentElement() == input
)
218 var isCollapsed
= range
.text
== ''
219 range
.text
= replaceString
222 // there has been a selection
223 // it appears range.select() should select the newly
224 // inserted text but that fails with IE
225 range
.moveStart('character', -replaceString
.length
);
232 ///////////////////////////////////////////////////////////////////////////////////////////////////
236 this.pageCourante
= null
240 Pages
.prototype.ajouterPage = function(page
)
242 page
.pages
= this // la magie des langages dynamiques : le foutoire
243 this.pages
[page
.nom
] = page
246 Pages
.prototype.afficherPage = function(nomPage
, forcerChargement
)
248 if (forcerChargement
== undefined) forcerChargement
= false
250 var page
= this.pages
[nomPage
]
251 if (page
== undefined || (!forcerChargement
&& page
== this.pageCourante
)) return
253 if (this.pageCourante
!= null && this.pageCourante
.decharger
)
254 this.pageCourante
.decharger()
256 jQuery("#menu div").removeClass("courante")
257 jQuery("#menu div." + nomPage
).addClass("courante")
259 this.pageCourante
= page
260 jQuery("#page").html(this.pageCourante
.contenu()).removeClass().addClass(this.pageCourante
.nom
)
262 if (this.pageCourante
.charger
)
263 this.pageCourante
.charger()
266 ///////////////////////////////////////////////////////////////////////////////////////////////////
270 this.smiles
= conf
.smiles
271 this.protocoles
= "http|https|ed2k"
273 this.regexUrl
= new RegExp("(?:(?:" + this.protocoles
+ ")://|www\\.)[^ ]*", "gi")
274 this.regexImg
= new RegExp("^.*?\\.(gif|jpg|png|jpeg|bmp|tiff)$", "i")
275 this.regexDomaine
= new RegExp("^(?:(?:" + this.protocoles
+ ")://|www\\.).*?([^/.]+\\.[^/.]+)(?:$|/).*$", "i")
276 this.regexTestProtocoleExiste
= new RegExp("^(?:" + this.protocoles
+ ")://.*$", "i")
277 this.regexNomProtocole
= new RegExp("^(.*?)://")
281 * Formate un pseudo saise par l'utilisateur.
282 * @param pseudo le pseudo brut
283 * @return le pseudo filtré
285 Formateur
.prototype.filtrerInputPseudo = function(pseudo
)
287 return pseudo
.replace(/{|}/g, "").trim()
290 Formateur
.prototype.getSmilesHTML = function()
293 for (var sNom
in this.smiles
)
295 XHTML
+= "<img class=\"" + sNom
+ "\" src=\"img/smileys/" + sNom
+ ".gif\" />"
300 Formateur
.prototype.traitementComplet = function(M
, pseudo
)
302 return this.traiterLiensConv(this.traiterSmiles(this.traiterURL(this.remplacerBalisesHTML(M
), pseudo
)))
306 * Transforme les liens en entités clickables.
307 * Un lien vers une conversation permet d'ouvrire celle ci, elle se marque comme ceci dans un message :
308 * "{5F}" ou 5F est la racine de la conversation.
309 * Ce lien sera transformer en <span class="lienConv">{5F}</span> pouvant être clické pour créer la conv 5F.
311 Formateur
.prototype.traiterLiensConv = function(M
)
317 return "<span class=\"lienConv\">" + lien
+ "</span>"
323 * FIXME : Cette méthode est attrocement lourde ! A optimiser.
325 Formateur
.prototype.traiterSmiles = function(M
)
327 for (var sNom
in this.smiles
)
329 ss
= this.smiles
[sNom
]
330 for (var i
= 0; i
< ss
.length
; i
++)
331 M
= M
.replace(ss
[i
], "<img src=\"img/smileys/" + sNom
+ ".gif\" />")
336 Formateur
.prototype.remplacerBalisesHTML = function(M
)
338 return M
.replace(/</g
, "<").replace(/>/g
, ">")
341 Formateur
.prototype.traiterURL = function(M
, pseudo
)
345 if (pseudo
== undefined)
348 var traitementUrl = function(url
)
350 // si ya pas de protocole on rajoute "http://"
351 if (!thisFormateur
.regexTestProtocoleExiste
.test(url
))
352 url
= "http://" + url
353 var extension
= thisFormateur
.getShort(url
)
354 return "<a " + (extension
[1] ? "title=\"" + thisFormateur
.traiterPourFenetreLightBox(pseudo
, url
) + ": " + thisFormateur
.traiterPourFenetreLightBox(M
, url
) + "\"" + " rel=\"lightbox[groupe]\"" : "") + " href=\"" + url
+ "\" >[" + extension
[0] + "]</a>"
356 return M
.replace(this.regexUrl
, traitementUrl
)
360 * Renvoie une version courte de l'url.
361 * par exemple : http://en.wikipedia.org/wiki/Yakov_Smirnoff devient wikipedia.org
363 Formateur
.prototype.getShort = function(url
)
365 var estUneImage
= false
366 var versionShort
= null
367 var rechercheImg
= this.regexImg
.exec(url
)
369 if (rechercheImg
!= null)
371 versionShort
= rechercheImg
[1].toLowerCase()
372 if (versionShort
== "jpeg") versionShort
= "jpg" // jpeg -> jpg
377 var rechercheDomaine
= this.regexDomaine
.exec(url
)
378 if (rechercheDomaine
!= null && rechercheDomaine
.length
>= 2)
379 versionShort
= rechercheDomaine
[1]
382 var nomProtocole
= this.regexNomProtocole
.exec(url
)
383 if (nomProtocole
!= null && nomProtocole
.length
>= 2)
384 versionShort
= nomProtocole
[1]
388 return [versionShort
== null ? "url" : versionShort
, estUneImage
]
392 * Traite les pseudo et messages à être affiché dans le titre d'une image visualisé avec lightbox.
394 Formateur
.prototype.traiterPourFenetreLightBox = function(M
, urlCourante
)
397 var traitementUrl = function(url
)
399 return "[" + thisFormateur
.getShort(url
)[0] + (urlCourante
== url
? ": image courante" : "") + "]"
402 return this.remplacerBalisesHTML(M
).replace(this.regexUrl
, traitementUrl
)
406 ///////////////////////////////////////////////////////////////////////////////////////////////////
408 var statutType
= {enregistre: 0, identifie: 1, non_identifie: 2}
410 function Client(util
)
415 this.regexCookie
= new RegExp("^cookie=([^;]*)")
417 // données personnels
418 this.resetDonneesPersonnelles()
420 this.setStatut(statutType
.non_identifie
)
422 // le dernier message d'erreur recut du serveur (par exemple une connexion foireuse : "login impossible")
423 this.dernierMessageErreur
= ""
426 Client
.prototype.resetDonneesPersonnelles = function()
428 this.pseudo
= conf
.pseudoDefaut
432 this.css
= jQuery("link#cssPrincipale").attr("href")
434 this.pagePrincipale
= 1
436 // les conversations, une conversation est un objet possédant les attributs suivants :
439 this.conversations
= new Array()
442 Client
.prototype.setCss = function(css
)
448 jQuery("link#cssPrincipale").attr("href", this.css
)
451 if (this.identifie())
455 Client
.prototype.pageSuivante = function(numConv
)
457 if (numConv
< 0 && this.pagePrincipale
> 1)
458 this.pagePrincipale
-= 1
459 else if (this.conversations
[numConv
].page
> 1)
460 this.conversations
[numConv
].page
-= 1
464 Client
.prototype.pagePrecedente = function(numConv
)
467 this.pagePrincipale
+= 1
469 this.conversations
[numConv
].page
+= 1
474 * Définit la première page pour la conversation donnée.
475 * @return true si la page a changé sinon false
477 Client
.prototype.goPremierePage = function(numConv
)
481 if (this.pagePrincipale
== 1)
483 this.pagePrincipale
= 1
487 if (this.conversations
[numConv
].page
== 1)
489 this.conversations
[numConv
].page
= 1
496 * Ajoute une conversation à la vue de l'utilisateur.
497 * Le profile de l'utilisateur est directement sauvegardé sur le serveur.
498 * @param racines la racine de la conversation
499 * @return true si la conversation a été créée sinon false (par exemple si la conv existe déjà)
501 Client
.prototype.ajouterConversation = function(racine
)
503 // vérification s'il elle n'existe pas déjà
504 for (var i
= 0; i
< this.conversations
.length
; i
++)
505 if (this.conversations
[i
].racine
== racine
)
508 this.conversations
.push({racine : racine
, page : 1})
513 Client
.prototype.supprimerConversation = function(num
)
515 if (num
< 0 || num
>= this.conversations
.length
) return
517 // décalage TODO : supprimer le dernier élément
518 for (var i
= num
; i
< this.conversations
.length
- 1; i
++)
519 this.conversations
[i
] = this.conversations
[i
+1]
520 this.conversations
.pop()
525 Client
.prototype.getXMLlogin = function(login
, password
)
527 var XMLDocument
= this.util
.creerDocumentXMLAction()
528 XMLDocument
.documentElement
.setAttribute("name", "login")
530 var nodeLogin
= XMLDocument
.createElement("login")
531 nodeLogin
.appendChild(XMLDocument
.createTextNode(login
))
532 XMLDocument
.documentElement
.appendChild(nodeLogin
)
534 var nodePassword
= XMLDocument
.createElement("password")
535 nodePassword
.appendChild(XMLDocument
.createTextNode(password
))
536 XMLDocument
.documentElement
.appendChild(nodePassword
)
541 Client
.prototype.getXMLloginCookie = function()
543 var XMLDocument
= this.util
.creerDocumentXMLAction()
544 XMLDocument
.documentElement
.setAttribute("name", "login")
546 var nodeCookie
= XMLDocument
.createElement("cookie")
547 nodeCookie
.appendChild(XMLDocument
.createTextNode(this.cookie
))
548 XMLDocument
.documentElement
.appendChild(nodeCookie
)
553 Client
.prototype.getXMLEnregistrement = function(login
, password
)
555 var XMLDocument
= this.util
.creerDocumentXMLAction()
556 XMLDocument
.documentElement
.setAttribute("name", "register")
558 var nodeLogin
= XMLDocument
.createElement("login")
559 nodeLogin
.appendChild(XMLDocument
.createTextNode(login
))
560 XMLDocument
.documentElement
.appendChild(nodeLogin
)
562 var nodePassword
= XMLDocument
.createElement("password")
563 nodePassword
.appendChild(XMLDocument
.createTextNode(password
))
564 XMLDocument
.documentElement
.appendChild(nodePassword
)
570 * Sérialize le profile en XML.
571 * TODO : méthode assez lourde, 3.25ms de moyenne
573 Client
.prototype.getXMLProfile = function()
575 var XMLDocument
= this.util
.creerDocumentXMLAction()
576 XMLDocument
.documentElement
.setAttribute("name", "profile")
578 var nodeCookie
= XMLDocument
.createElement("cookie")
579 nodeCookie
.appendChild(XMLDocument
.createTextNode(this.cookie
))
580 XMLDocument
.documentElement
.appendChild(nodeCookie
)
582 var nodeLogin
= XMLDocument
.createElement("login")
583 nodeLogin
.appendChild(XMLDocument
.createTextNode(this.login
))
584 XMLDocument
.documentElement
.appendChild(nodeLogin
)
586 var nodePassword
= XMLDocument
.createElement("password")
587 nodePassword
.appendChild(XMLDocument
.createTextNode(this.password
))
588 XMLDocument
.documentElement
.appendChild(nodePassword
)
590 var nodePseudo
= XMLDocument
.createElement("pseudo")
591 nodePseudo
.appendChild(XMLDocument
.createTextNode(this.pseudo
))
592 XMLDocument
.documentElement
.appendChild(nodePseudo
)
594 var nodeEmail
= XMLDocument
.createElement("email")
595 nodeEmail
.appendChild(XMLDocument
.createTextNode(this.email
))
596 XMLDocument
.documentElement
.appendChild(nodeEmail
)
598 var nodeCSS
= XMLDocument
.createElement("css")
599 nodeCSS
.appendChild(XMLDocument
.createTextNode(this.css
))
600 XMLDocument
.documentElement
.appendChild(nodeCSS
)
602 var nodePagePrincipale
= XMLDocument
.createElement("pagePrincipale")
603 nodePagePrincipale
.appendChild(XMLDocument
.createTextNode(this.pagePrincipale
< 1 ? 1 : this.pagePrincipale
))
604 XMLDocument
.documentElement
.appendChild(nodePagePrincipale
)
606 // mémorise les conversations affichées
607 for (var i
= 0; i
< this.conversations
.length
; i
++)
609 var nodeConv
= XMLDocument
.createElement("conversation")
610 XMLDocument
.documentElement
.appendChild(nodeConv
)
612 var nodeRacine
= XMLDocument
.createElement("racine")
613 nodeRacine
.appendChild(XMLDocument
.createTextNode(this.conversations
[i
].racine
))
614 nodeConv
.appendChild(nodeRacine
)
616 var nodePage
= XMLDocument
.createElement("page")
617 nodePage
.appendChild(XMLDocument
.createTextNode(this.conversations
[i
].page
))
618 nodeConv
.appendChild(nodePage
)
625 * Renvoie null si pas définit.
627 Client
.prototype.getCookie = function()
629 var cookie
= this.regexCookie
.exec(document
.cookie
)
630 if (cookie
== null) this.cookie
= null
631 else this.cookie
= cookie
[1]
634 Client
.prototype.delCookie = function()
636 document
.cookie
= "cookie=; max-age=0"
639 Client
.prototype.setCookie = function(cookie
)
641 if (this.cookie
== null)
645 "cookie="+this.cookie
+
646 "; max-age=" + (60 * 60 * 24 * 365)
649 Client
.prototype.identifie = function()
651 return this.statut
== statutType
.enregistre
|| this.statut
== statutType
.identifie
654 Client
.prototype.setStatut = function(statut
)
656 if(typeof(statut
) == "string")
659 statut
== "enregistre" ?
660 statutType
.enregistre : (statut
== "identifie" ? statutType
.identifie : statutType
.non_identifie
)
663 if (statut
== this.statut
) return
670 * Effectue la connexion vers le serveur.
671 * Cette fonction est bloquante tant que la connexion n'a pas été établie.
672 * S'il existe un cookie en local on s'authentifie directement avec lui.
673 * Si il n'est pas possible de s'authentifier alors on affiche un captcha anti-bot.
675 Client
.prototype.connexionCookie = function()
678 if (this.cookie
== null) return false;
679 return this.connexion(this.util
.xmlVersAction(this.getXMLloginCookie()))
682 Client
.prototype.connexionLogin = function(login
, password
)
684 return this.connexion(this.util
.xmlVersAction(this.getXMLlogin(login
, password
)))
687 Client
.prototype.enregistrement = function(login
, password
)
689 if (this.identifie())
692 this.password
= password
694 this.setStatut(statutType
.enregistre
)
699 if (login
== undefined) login
= ""
700 if (password
== undefined) password
= ""
701 return this.connexion(this.util
.xmlVersAction(this.getXMLEnregistrement(login
, password
)))
705 Client
.prototype.connexion = function(action
)
707 //action.action.dump()
719 //thisClient.util.serializer.serializeToString(data).dump("Charger client")
720 thisClient
.chargerDonnees(data
)
724 return this.identifie()
727 Client
.prototype.deconnexion = function()
729 this.setStatut(statutType
.non_identifie
) // deconnexion
730 this.resetDonneesPersonnelles()
734 Client
.prototype.chargerDonnees = function(data
)
736 var thisClient
= this
738 this.setStatut(jQuery("statut", data
.documentElement
).text())
740 if (this.identifie())
742 this.cookie
= jQuery("cookie", data
.documentElement
).text()
745 this.login
= jQuery("login", data
.documentElement
).text()
746 this.pseudo
= jQuery("pseudo", data
.documentElement
).text()
747 this.email
= jQuery("email", data
.documentElement
).text()
748 this.css
= jQuery("css", data
.documentElement
).text()
750 // la page de la conversation principale
751 var tmp
= jQuery("pagePrincipale", data
.documentElement
)
752 this.pagePrincipale
= tmp
.length
< 1 ? 1 : parseInt(tmp
.text())
757 jQuery("link#cssPrincipale").attr("href", this.css
)
761 this.conversations
= new Array()
762 jQuery("conversation", data
.documentElement
).each(
765 thisClient
.conversations
.push( { racine : jQuery("racine", this).text(), page : jQuery("page", this).text() } )
769 this.dernierMessageErreur
= jQuery("information", data
.documentElement
).text()
773 * Met à jour les données personne sur serveur.
774 * @param async de manière asynchrone ? défaut = true
776 Client
.prototype.flush = function(async
)
778 if (async
== undefined)
782 //this.util.xmlVersAction(this.getXMLProfile()).action.dump("Flush client")
789 data: this.util
.xmlVersAction(this.getXMLProfile()),
793 //thisClient.util.log(thisClient.util.serializer.serializeToString(data))
797 // TODO : retourner false si un problème est survenu lors de l'update du profile
801 Client
.prototype.majMenu = function()
803 var displayType
= this.css
== "css/3/euphorik.css" ? "block" : "inline" //this.client
805 // met à jour le menu
806 if (this.statut
== statutType
.enregistre
)
808 jQuery("#menu .profile").css("display", displayType
).text("profile")
809 jQuery("#menu .logout").css("display", displayType
)
810 jQuery("#menu .register").css("display", "none")
812 else if (this.statut
== statutType
.identifie
)
814 jQuery("#menu .profile").css("display", "none")
815 jQuery("#menu .logout").css("display", displayType
)
816 jQuery("#menu .register").css("display", displayType
)
820 jQuery("#menu .profile").css("display", displayType
).text("login")
821 jQuery("#menu .logout").css("display", "none")
822 jQuery("#menu .register").css("display", displayType
)
826 ///////////////////////////////////////////////////////////////////////////////////////////////////
832 jQuery(document
).ready(
835 /* FIXME : ce code pose problème sur konqueror, voir : http://www.kde-forum.org/thread.php?threadid=17993
836 var p = new DOMParser();
837 var doc = p.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
838 var s = new XMLSerializer()
839 alert(s.serializeToString(doc)) */
841 var util
= new Util()
842 var client
= new Client(util
)
843 var pages
= new Pages()
844 var formateur
= new Formateur()
846 // connexion vers le serveur (utilise un cookie qui traine)
847 client
.connexionCookie()
850 for (var i
= 1; i
<= 3; i
++)
852 jQuery("#css"+i
).click(function(){
853 client
.setCss("css/" + jQuery(this).attr("id").charAt(3) + "/euphorik.css")
857 jQuery("#menu .minichat").click(function(){ pages
.afficherPage("minichat") })
858 jQuery("#menu .profile").click(function(){ pages
.afficherPage("profile") })
859 jQuery("#menu .logout").click(function(){
860 util
.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", messageType
.question
,
863 client
.deconnexion();
864 pages
.afficherPage("minichat", true)
870 jQuery("#menu .register").click(function(){ pages
.afficherPage("register") })
872 pages
.ajouterPage(new PageMinichat(client
, formateur
, util
))
873 pages
.ajouterPage(new PageProfile(client
, formateur
, util
))
874 pages
.ajouterPage(new PageRegister(client
, formateur
, util
))
875 pages
.afficherPage("minichat")