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
)}
159 * Utilisé pour l'envoie de donnée avec la méthode ajax de jQuery.
161 Util
.prototype.jsonVersAction = function(json
)
163 // FIXME : ne plus encapsuler json dans de l'xml (problème avec yaws)
164 return {action: "<json>" + JSON
.stringify(json
) + "</json>" }
167 Util
.prototype.md5 = function(chaine
)
169 return hex_md5(chaine
)
172 // pompé de http://www.faqts.com/knowledge_base/view.phtml/aid/13562/fid/130
173 Util
.prototype.setSelectionRange = function(input
, selectionStart
, selectionEnd
)
175 if (input
.setSelectionRange
)
178 input
.setSelectionRange(selectionStart
, selectionEnd
)
180 else if (input
.createTextRange
)
182 var range
= input
.createTextRange()
184 range
.moveEnd('character', selectionEnd
)
185 range
.moveStart('character', selectionStart
)
190 Util
.prototype.setCaretToEnd = function(input
)
192 this.setSelectionRange(input
, input
.value
.length
, input
.value
.length
)
194 Util
.prototype.setCaretToBegin = function(input
)
196 this.setSelectionRange(input
, 0, 0)
198 Util
.prototype.setCaretToPos = function(input
, pos
)
200 this.setSelectionRange(input
, pos
, pos
)
202 Util
.prototype.selectString = function(input
, string
)
204 var match
= new RegExp(string
, "i").exec(input
.value
)
207 this.setSelectionRange (input
, match
.index
, match
.index
+ match
[0].length
)
210 Util
.prototype.replaceSelection = function(input
, replaceString
) {
211 if (input
.setSelectionRange
)
213 var selectionStart
= input
.selectionStart
214 var selectionEnd
= input
.selectionEnd
215 input
.value
= input
.value
.substring(0, selectionStart
) + replaceString
+ input
.value
.substring(selectionEnd
)
217 if (selectionStart
!= selectionEnd
) // has there been a selection
218 this.setSelectionRange(input
, selectionStart
, selectionStart
+ replaceString
.length
)
220 this.setCaretToPos(input
, selectionStart
+ replaceString
.length
)
222 else if (document
.selection
)
224 var range
= document
.selection
.createRange();
225 if (range
.parentElement() == input
)
227 var isCollapsed
= range
.text
== ''
228 range
.text
= replaceString
231 // there has been a selection
232 // it appears range.select() should select the newly
233 // inserted text but that fails with IE
234 range
.moveStart('character', -replaceString
.length
);
241 ///////////////////////////////////////////////////////////////////////////////////////////////////
245 this.pageCourante
= null
249 Pages
.prototype.ajouterPage = function(page
)
251 page
.pages
= this // la magie des langages dynamiques : le foutoire
252 this.pages
[page
.nom
] = page
255 Pages
.prototype.afficherPage = function(nomPage
, forcerChargement
)
257 if (forcerChargement
== undefined) forcerChargement
= false
259 var page
= this.pages
[nomPage
]
260 if (page
== undefined || (!forcerChargement
&& page
== this.pageCourante
)) return
262 if (this.pageCourante
!= null && this.pageCourante
.decharger
)
263 this.pageCourante
.decharger()
265 jQuery("#menu div").removeClass("courante")
266 jQuery("#menu div." + nomPage
).addClass("courante")
268 this.pageCourante
= page
269 jQuery("#page").html(this.pageCourante
.contenu()).removeClass().addClass(this.pageCourante
.nom
)
271 if (this.pageCourante
.charger
)
272 this.pageCourante
.charger()
275 ///////////////////////////////////////////////////////////////////////////////////////////////////
279 this.smiles
= conf
.smiles
280 this.protocoles
= "http|https|ed2k"
282 this.regexUrl
= new RegExp("(?:(?:" + this.protocoles
+ ")://|www\\.)[^ ]*", "gi")
283 this.regexImg
= new RegExp("^.*?\\.(gif|jpg|png|jpeg|bmp|tiff)$", "i")
284 this.regexDomaine
= new RegExp("^(?:(?:" + this.protocoles
+ ")://|www\\.).*?([^/.]+\\.[^/.]+)(?:$|/).*$", "i")
285 this.regexTestProtocoleExiste
= new RegExp("^(?:" + this.protocoles
+ ")://.*$", "i")
286 this.regexNomProtocole
= new RegExp("^(.*?)://")
290 * Formate un pseudo saise par l'utilisateur.
291 * @param pseudo le pseudo brut
292 * @return le pseudo filtré
294 Formateur
.prototype.filtrerInputPseudo = function(pseudo
)
296 return pseudo
.replace(/{|}/g, "").trim()
299 Formateur
.prototype.getSmilesHTML = function()
302 for (var sNom
in this.smiles
)
304 XHTML
+= "<img class=\"" + sNom
+ "\" src=\"img/smileys/" + sNom
+ ".gif\" />"
309 Formateur
.prototype.traitementComplet = function(M
, pseudo
)
311 return this.traiterLiensConv(this.traiterSmiles(this.traiterURL(this.remplacerBalisesHTML(M
), pseudo
)))
315 * Transforme les liens en entités clickables.
316 * Un lien vers une conversation permet d'ouvrire celle ci, elle se marque comme ceci dans un message :
317 * "{5F}" ou 5F est la racine de la conversation.
318 * Ce lien sera transformer en <span class="lienConv">{5F}</span> pouvant être clické pour créer la conv 5F.
320 Formateur
.prototype.traiterLiensConv = function(M
)
326 return "<span class=\"lienConv\">" + lien
+ "</span>"
332 * FIXME : Cette méthode est attrocement lourde ! A optimiser.
334 Formateur
.prototype.traiterSmiles = function(M
)
336 for (var sNom
in this.smiles
)
338 ss
= this.smiles
[sNom
]
339 for (var i
= 0; i
< ss
.length
; i
++)
340 M
= M
.replace(ss
[i
], "<img src=\"img/smileys/" + sNom
+ ".gif\" />")
345 Formateur
.prototype.remplacerBalisesHTML = function(M
)
347 return M
.replace(/</g
, "<").replace(/>/g
, ">")
350 Formateur
.prototype.traiterURL = function(M
, pseudo
)
354 if (pseudo
== undefined)
357 var traitementUrl = function(url
)
359 // si ya pas de protocole on rajoute "http://"
360 if (!thisFormateur
.regexTestProtocoleExiste
.test(url
))
361 url
= "http://" + url
362 var extension
= thisFormateur
.getShort(url
)
363 return "<a " + (extension
[1] ? "title=\"" + thisFormateur
.traiterPourFenetreLightBox(pseudo
, url
) + ": " + thisFormateur
.traiterPourFenetreLightBox(M
, url
) + "\"" + " rel=\"lightbox[groupe]\"" : "") + " href=\"" + url
+ "\" >[" + extension
[0] + "]</a>"
365 return M
.replace(this.regexUrl
, traitementUrl
)
369 * Renvoie une version courte de l'url.
370 * par exemple : http://en.wikipedia.org/wiki/Yakov_Smirnoff devient wikipedia.org
372 Formateur
.prototype.getShort = function(url
)
374 var estUneImage
= false
375 var versionShort
= null
376 var rechercheImg
= this.regexImg
.exec(url
)
378 if (rechercheImg
!= null)
380 versionShort
= rechercheImg
[1].toLowerCase()
381 if (versionShort
== "jpeg") versionShort
= "jpg" // jpeg -> jpg
386 var rechercheDomaine
= this.regexDomaine
.exec(url
)
387 if (rechercheDomaine
!= null && rechercheDomaine
.length
>= 2)
388 versionShort
= rechercheDomaine
[1]
391 var nomProtocole
= this.regexNomProtocole
.exec(url
)
392 if (nomProtocole
!= null && nomProtocole
.length
>= 2)
393 versionShort
= nomProtocole
[1]
397 return [versionShort
== null ? "url" : versionShort
, estUneImage
]
401 * Traite les pseudo et messages à être affiché dans le titre d'une image visualisé avec lightbox.
403 Formateur
.prototype.traiterPourFenetreLightBox = function(M
, urlCourante
)
406 var traitementUrl = function(url
)
408 return "[" + thisFormateur
.getShort(url
)[0] + (urlCourante
== url
? ": image courante" : "") + "]"
411 return this.remplacerBalisesHTML(M
).replace(this.regexUrl
, traitementUrl
)
415 ///////////////////////////////////////////////////////////////////////////////////////////////////
417 var statutType
= {enregistre: 0, identifie: 1, non_identifie: 2}
419 function Client(util
)
424 this.regexCookie
= new RegExp("^cookie=([^;]*)")
426 // données personnels
427 this.resetDonneesPersonnelles()
429 this.setStatut(statutType
.non_identifie
)
431 // le dernier message d'erreur recut du serveur (par exemple une connexion foireuse : "login impossible")
432 this.dernierMessageErreur
= ""
435 Client
.prototype.resetDonneesPersonnelles = function()
437 this.pseudo
= conf
.pseudoDefaut
441 this.css
= jQuery("link#cssPrincipale").attr("href")
443 this.pagePrincipale
= 1
445 // les conversations, une conversation est un objet possédant les attributs suivants :
448 this.conversations
= new Array()
451 Client
.prototype.setCss = function(css
)
457 jQuery("link#cssPrincipale").attr("href", this.css
)
460 if (this.identifie())
464 Client
.prototype.pageSuivante = function(numConv
)
466 if (numConv
< 0 && this.pagePrincipale
> 1)
467 this.pagePrincipale
-= 1
468 else if (this.conversations
[numConv
].page
> 1)
469 this.conversations
[numConv
].page
-= 1
473 Client
.prototype.pagePrecedente = function(numConv
)
476 this.pagePrincipale
+= 1
478 this.conversations
[numConv
].page
+= 1
483 * Définit la première page pour la conversation donnée.
484 * @return true si la page a changé sinon false
486 Client
.prototype.goPremierePage = function(numConv
)
490 if (this.pagePrincipale
== 1)
492 this.pagePrincipale
= 1
496 if (this.conversations
[numConv
].page
== 1)
498 this.conversations
[numConv
].page
= 1
505 * Ajoute une conversation à la vue de l'utilisateur.
506 * Le profile de l'utilisateur est directement sauvegardé sur le serveur.
507 * @param racines la racine de la conversation
508 * @return true si la conversation a été créée sinon false (par exemple si la conv existe déjà)
510 Client
.prototype.ajouterConversation = function(racine
)
512 // vérification s'il elle n'existe pas déjà
513 for (var i
= 0; i
< this.conversations
.length
; i
++)
514 if (this.conversations
[i
].racine
== racine
)
517 this.conversations
.push({racine : racine
, page : 1})
522 Client
.prototype.supprimerConversation = function(num
)
524 if (num
< 0 || num
>= this.conversations
.length
) return
526 // décalage TODO : supprimer le dernier élément
527 for (var i
= num
; i
< this.conversations
.length
- 1; i
++)
528 this.conversations
[i
] = this.conversations
[i
+1]
529 this.conversations
.pop()
534 Client
.prototype.getXMLlogin = function(login
, password
)
536 var XMLDocument
= this.util
.creerDocumentXMLAction()
537 XMLDocument
.documentElement
.setAttribute("name", "login")
539 var nodeLogin
= XMLDocument
.createElement("login")
540 nodeLogin
.appendChild(XMLDocument
.createTextNode(login
))
541 XMLDocument
.documentElement
.appendChild(nodeLogin
)
543 var nodePassword
= XMLDocument
.createElement("password")
544 nodePassword
.appendChild(XMLDocument
.createTextNode(password
))
545 XMLDocument
.documentElement
.appendChild(nodePassword
)
550 Client
.prototype.getJSONLogin = function(login
, password
)
553 "action" : "authentification",
555 "password" : password
559 Client
.prototype.getXMLloginCookie = function()
561 var XMLDocument
= this.util
.creerDocumentXMLAction()
562 XMLDocument
.documentElement
.setAttribute("name", "login")
564 var nodeCookie
= XMLDocument
.createElement("cookie")
565 nodeCookie
.appendChild(XMLDocument
.createTextNode(this.cookie
))
566 XMLDocument
.documentElement
.appendChild(nodeCookie
)
571 Client
.prototype.getXMLEnregistrement = function(login
, password
)
573 var XMLDocument
= this.util
.creerDocumentXMLAction()
574 XMLDocument
.documentElement
.setAttribute("name", "register")
576 var nodeLogin
= XMLDocument
.createElement("login")
577 nodeLogin
.appendChild(XMLDocument
.createTextNode(login
))
578 XMLDocument
.documentElement
.appendChild(nodeLogin
)
580 var nodePassword
= XMLDocument
.createElement("password")
581 nodePassword
.appendChild(XMLDocument
.createTextNode(password
))
582 XMLDocument
.documentElement
.appendChild(nodePassword
)
588 * Sérialize le profile en XML.
589 * TODO : méthode assez lourde, 3.25ms de moyenne
591 Client
.prototype.getXMLProfile = function()
593 var XMLDocument
= this.util
.creerDocumentXMLAction()
594 XMLDocument
.documentElement
.setAttribute("name", "profile")
596 var nodeCookie
= XMLDocument
.createElement("cookie")
597 nodeCookie
.appendChild(XMLDocument
.createTextNode(this.cookie
))
598 XMLDocument
.documentElement
.appendChild(nodeCookie
)
600 var nodeLogin
= XMLDocument
.createElement("login")
601 nodeLogin
.appendChild(XMLDocument
.createTextNode(this.login
))
602 XMLDocument
.documentElement
.appendChild(nodeLogin
)
604 var nodePassword
= XMLDocument
.createElement("password")
605 nodePassword
.appendChild(XMLDocument
.createTextNode(this.password
))
606 XMLDocument
.documentElement
.appendChild(nodePassword
)
608 var nodePseudo
= XMLDocument
.createElement("pseudo")
609 nodePseudo
.appendChild(XMLDocument
.createTextNode(this.pseudo
))
610 XMLDocument
.documentElement
.appendChild(nodePseudo
)
612 var nodeEmail
= XMLDocument
.createElement("email")
613 nodeEmail
.appendChild(XMLDocument
.createTextNode(this.email
))
614 XMLDocument
.documentElement
.appendChild(nodeEmail
)
616 var nodeCSS
= XMLDocument
.createElement("css")
617 nodeCSS
.appendChild(XMLDocument
.createTextNode(this.css
))
618 XMLDocument
.documentElement
.appendChild(nodeCSS
)
620 var nodePagePrincipale
= XMLDocument
.createElement("pagePrincipale")
621 nodePagePrincipale
.appendChild(XMLDocument
.createTextNode(this.pagePrincipale
< 1 ? 1 : this.pagePrincipale
))
622 XMLDocument
.documentElement
.appendChild(nodePagePrincipale
)
624 // mémorise les conversations affichées
625 for (var i
= 0; i
< this.conversations
.length
; i
++)
627 var nodeConv
= XMLDocument
.createElement("conversation")
628 XMLDocument
.documentElement
.appendChild(nodeConv
)
630 var nodeRacine
= XMLDocument
.createElement("racine")
631 nodeRacine
.appendChild(XMLDocument
.createTextNode(this.conversations
[i
].racine
))
632 nodeConv
.appendChild(nodeRacine
)
634 var nodePage
= XMLDocument
.createElement("page")
635 nodePage
.appendChild(XMLDocument
.createTextNode(this.conversations
[i
].page
))
636 nodeConv
.appendChild(nodePage
)
643 * Renvoie null si pas définit.
645 Client
.prototype.getCookie = function()
647 var cookie
= this.regexCookie
.exec(document
.cookie
)
648 if (cookie
== null) this.cookie
= null
649 else this.cookie
= cookie
[1]
652 Client
.prototype.delCookie = function()
654 document
.cookie
= "cookie=; max-age=0"
657 Client
.prototype.setCookie = function(cookie
)
659 if (this.cookie
== null)
663 "cookie="+this.cookie
+
664 "; max-age=" + (60 * 60 * 24 * 365)
667 Client
.prototype.identifie = function()
669 return this.statut
== statutType
.enregistre
|| this.statut
== statutType
.identifie
672 Client
.prototype.setStatut = function(statut
)
674 if(typeof(statut
) == "string")
677 statut
== "enregistre" ?
678 statutType
.enregistre : (statut
== "identifie" ? statutType
.identifie : statutType
.non_identifie
)
681 if (statut
== this.statut
) return
688 * Effectue la connexion vers le serveur.
689 * Cette fonction est bloquante tant que la connexion n'a pas été établie.
690 * S'il existe un cookie en local on s'authentifie directement avec lui.
691 * Si il n'est pas possible de s'authentifier alors on affiche un captcha anti-bot.
693 Client
.prototype.connexionCookie = function()
696 if (this.cookie
== null) return false;
697 return this.connexion(this.util
.xmlVersAction(this.getXMLloginCookie()))
700 Client
.prototype.connexionLogin = function(login
, password
)
702 // return this.connexion(this.util.xmlVersAction(this.getXMLlogin(login, password)))
703 return this.connexion(this.util
.jsonVersAction(this.getJSONLogin(login
, password
)))
706 Client
.prototype.enregistrement = function(login
, password
)
708 if (this.identifie())
711 this.password
= password
713 this.setStatut(statutType
.enregistre
)
718 if (login
== undefined) login
= ""
719 if (password
== undefined) password
= ""
720 return this.connexion(this.util
.xmlVersAction(this.getXMLEnregistrement(login
, password
)))
724 Client
.prototype.connexion = function(action
)
726 action
.action
.dump("Connexion client")
738 //alert(data["error_message"])
739 //thisClient.util.serializer.serializeToString(data).dump("Charger client")
740 //thisClient.chargerDonnees(data)
744 return this.identifie()
747 Client
.prototype.deconnexion = function()
749 this.setStatut(statutType
.non_identifie
) // deconnexion
750 this.resetDonneesPersonnelles()
754 Client
.prototype.chargerDonnees = function(data
)
756 var thisClient
= this
758 this.setStatut(jQuery("statut", data
.documentElement
).text())
760 if (this.identifie())
762 this.cookie
= jQuery("cookie", data
.documentElement
).text()
765 this.login
= jQuery("login", data
.documentElement
).text()
766 this.pseudo
= jQuery("pseudo", data
.documentElement
).text()
767 this.email
= jQuery("email", data
.documentElement
).text()
768 this.css
= jQuery("css", data
.documentElement
).text()
770 // la page de la conversation principale
771 var tmp
= jQuery("pagePrincipale", data
.documentElement
)
772 this.pagePrincipale
= tmp
.length
< 1 ? 1 : parseInt(tmp
.text())
777 jQuery("link#cssPrincipale").attr("href", this.css
)
781 this.conversations
= new Array()
782 jQuery("conversation", data
.documentElement
).each(
785 thisClient
.conversations
.push( { racine : jQuery("racine", this).text(), page : jQuery("page", this).text() } )
789 this.dernierMessageErreur
= jQuery("information", data
.documentElement
).text()
793 * Met à jour les données personne sur serveur.
794 * @param async de manière asynchrone ? défaut = true
796 Client
.prototype.flush = function(async
)
798 if (async
== undefined)
802 this.util
.xmlVersAction(this.getXMLProfile()).action
.dump("Flush client")
809 data: this.util
.xmlVersAction(this.getXMLProfile()),
813 //thisClient.util.log(thisClient.util.serializer.serializeToString(data))
817 // TODO : retourner false si un problème est survenu lors de l'update du profile
821 Client
.prototype.majMenu = function()
823 var displayType
= this.css
== "css/3/euphorik.css" ? "block" : "inline" //this.client
825 // met à jour le menu
826 if (this.statut
== statutType
.enregistre
)
828 jQuery("#menu .profile").css("display", displayType
).text("profile")
829 jQuery("#menu .logout").css("display", displayType
)
830 jQuery("#menu .register").css("display", "none")
832 else if (this.statut
== statutType
.identifie
)
834 jQuery("#menu .profile").css("display", "none")
835 jQuery("#menu .logout").css("display", displayType
)
836 jQuery("#menu .register").css("display", displayType
)
840 jQuery("#menu .profile").css("display", displayType
).text("login")
841 jQuery("#menu .logout").css("display", "none")
842 jQuery("#menu .register").css("display", displayType
)
846 ///////////////////////////////////////////////////////////////////////////////////////////////////
852 jQuery(document
).ready(
855 /* FIXME : ce code pose problème sur konqueror, voir : http://www.kde-forum.org/thread.php?threadid=17993
856 var p = new DOMParser();
857 var doc = p.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
858 var s = new XMLSerializer()
859 alert(s.serializeToString(doc)) */
861 var util
= new Util()
862 var client
= new Client(util
)
863 var pages
= new Pages()
864 var formateur
= new Formateur()
866 // connexion vers le serveur (utilise un cookie qui traine)
867 client
.connexionCookie()
870 for (var i
= 1; i
<= 3; i
++)
872 jQuery("#css"+i
).click(function(){
873 client
.setCss("css/" + jQuery(this).attr("id").charAt(3) + "/euphorik.css")
877 jQuery("#menu .minichat").click(function(){ pages
.afficherPage("minichat") })
878 jQuery("#menu .profile").click(function(){ pages
.afficherPage("profile") })
879 jQuery("#menu .logout").click(function(){
880 util
.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", messageType
.question
,
883 client
.deconnexion();
884 pages
.afficherPage("minichat", true)
890 jQuery("#menu .register").click(function(){ pages
.afficherPage("register") })
892 pages
.ajouterPage(new PageMinichat(client
, formateur
, util
))
893 pages
.ajouterPage(new PageProfile(client
, formateur
, util
))
894 pages
.ajouterPage(new PageRegister(client
, formateur
, util
))
895 pages
.afficherPage("minichat")