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()
58 if (typeof dump
!= "undefined")
60 dump("\n--- EUPHORIK.CH ---\n")
66 ///////////////////////////////////////////////////////////////////////////////////////////////////
69 * Cette classe regroupe des fonctions utilitaires (helpers).
73 if(typeof XMLSerializer
!= "undefined")
74 this.serializer
= new XMLSerializer()
76 jQuery("#info .fermer").click(function(){
77 jQuery("#info").slideUp(50)
82 * Affiche une boite de dialogue avec un message à l'intérieur.
83 * @param message le message (string)
84 * @param type voir 'messageType'. par défaut messageType.informatif
85 * @param les boutons sous la forme d'un objet ou les clefs sont les labels des boutons
86 * et les valeurs les fonctions executées lorsqu'un bouton est activé.
88 Util
.prototype.messageDialogue = function(message
, type
, boutons
)
90 if (type
== undefined)
91 type
= messageType
.informatif
93 if (this.timeoutMessageDialogue
!= undefined)
94 clearTimeout(this.timeoutMessageDialogue
)
96 var fermer = function(){jQuery("#info").slideUp(100)}
99 jQuery("#info .message").html(message
)
102 case messageType
.informatif : jQuery("#info #icone").attr("class", "information"); break
103 case messageType
.question : jQuery("#info #icone").attr("class", "interrogation"); break
104 case messageType
.erreur : jQuery("#info #icone").attr("class", "exclamation"); break
106 jQuery("#info .boutons").html("")
107 for (var b
in boutons
)
108 jQuery("#info .boutons").append("<div>" + b
+ "</div>").find("div:last").click(boutons
[b
]).click(fermer
)
110 jQuery("#info").slideDown(200)
111 this.timeoutMessageDialogue
= setTimeout(fermer
, conf
.tempsAffichageMessageDialogue
)
113 var messageType
= {informatif: 0, question: 1, erreur: 2}
116 * Transforme un document XML en string.
118 Util
.prototype.serializeXML = function(documentXML
)
121 return this.serializer
.serializeToString(documentXML
)
123 return documentXML
.xml
126 Util
.prototype.creerDocumentXMLAction = function()
128 if (document
.implementation
&& document
.implementation
.createDocument
)
130 // var doc = document.implementation.createDocument("", "action", null)
131 var parser
= new DOMParser();
132 var doc
= parser
.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
133 //alert(this.serializeXML(doc))
136 else if (window
.ActiveXObject
)
138 var doc
= new ActiveXObject("MSXML2.DOMDocument") //("Microsoft.XMLDOM")
139 doc
.appendChild(doc
.createElement("action"));
140 //doc.loadXML("<action></action>")
141 //alert(doc.documentElement)
142 //doc.createElement("action")
147 Util
.prototype.xmlVersAction = function(xml
)
149 //return {action: this.to_utf8(this.serializeXML(xml /*, "UTF-8"*/))}
150 return {action: this.serializeXML(xml
)}
153 Util
.prototype.md5 = function(chaine
)
155 return hex_md5(chaine
)
158 // pompé de http://www.faqts.com/knowledge_base/view.phtml/aid/13562/fid/130
159 Util
.prototype.setSelectionRange = function(input
, selectionStart
, selectionEnd
)
161 if (input
.setSelectionRange
)
164 input
.setSelectionRange(selectionStart
, selectionEnd
)
166 else if (input
.createTextRange
)
168 var range
= input
.createTextRange()
170 range
.moveEnd('character', selectionEnd
)
171 range
.moveStart('character', selectionStart
)
176 Util
.prototype.setCaretToEnd = function(input
)
178 this.setSelectionRange(input
, input
.value
.length
, input
.value
.length
)
180 Util
.prototype.setCaretToBegin = function(input
)
182 this.setSelectionRange(input
, 0, 0)
184 Util
.prototype.setCaretToPos = function(input
, pos
)
186 this.setSelectionRange(input
, pos
, pos
)
188 Util
.prototype.selectString = function(input
, string
)
190 var match
= new RegExp(string
, "i").exec(input
.value
)
193 this.setSelectionRange (input
, match
.index
, match
.index
+ match
[0].length
)
196 Util
.prototype.replaceSelection = function(input
, replaceString
) {
197 if (input
.setSelectionRange
)
199 var selectionStart
= input
.selectionStart
200 var selectionEnd
= input
.selectionEnd
201 input
.value
= input
.value
.substring(0, selectionStart
) + replaceString
+ input
.value
.substring(selectionEnd
)
203 if (selectionStart
!= selectionEnd
) // has there been a selection
204 this.setSelectionRange(input
, selectionStart
, selectionStart
+ replaceString
.length
)
206 this.setCaretToPos(input
, selectionStart
+ replaceString
.length
)
208 else if (document
.selection
)
210 var range
= document
.selection
.createRange();
211 if (range
.parentElement() == input
)
213 var isCollapsed
= range
.text
== ''
214 range
.text
= replaceString
217 // there has been a selection
218 // it appears range.select() should select the newly
219 // inserted text but that fails with IE
220 range
.moveStart('character', -replaceString
.length
);
227 ///////////////////////////////////////////////////////////////////////////////////////////////////
231 this.pageCourante
= null
235 Pages
.prototype.ajouterPage = function(page
)
237 page
.pages
= this // la magie des langages dynamiques : le foutoire
238 this.pages
[page
.nom
] = page
241 Pages
.prototype.afficherPage = function(nomPage
, forcerChargement
)
243 if (forcerChargement
== undefined) forcerChargement
= false
245 var page
= this.pages
[nomPage
]
246 if (page
== undefined || (!forcerChargement
&& page
== this.pageCourante
)) return
248 if (this.pageCourante
!= null && this.pageCourante
.decharger
)
249 this.pageCourante
.decharger()
251 jQuery("#menu div").removeClass("courante")
252 jQuery("#menu div." + nomPage
).addClass("courante")
254 this.pageCourante
= page
255 jQuery("#page").html(this.pageCourante
.contenu()).removeClass().addClass(this.pageCourante
.nom
)
257 if (this.pageCourante
.charger
)
258 this.pageCourante
.charger()
261 ///////////////////////////////////////////////////////////////////////////////////////////////////
265 this.smiles
= conf
.smiles
266 this.protocoles
= "http|https|ed2k"
268 this.regexUrl
= new RegExp("(?:(?:" + this.protocoles
+ ")://|www\\.)[^ ]*", "gi")
269 this.regexImg
= new RegExp("^.*?\\.(gif|jpg|png|jpeg|bmp|tiff)$", "i")
270 this.regexDomaine
= new RegExp("^(?:(?:" + this.protocoles
+ ")://|www\\.).*?([^/.]+\\.[^/.]+)(?:$|/).*$", "i")
271 this.regexTestProtocoleExiste
= new RegExp("^(?:" + this.protocoles
+ ")://.*$", "i")
272 this.regexNomProtocole
= new RegExp("^(.*?)://")
276 * Formate un pseudo saise par l'utilisateur.
277 * @param pseudo le pseudo brut
278 * @return le pseudo filtré
280 Formateur
.prototype.filtrerInputPseudo = function(pseudo
)
282 return pseudo
.replace(/{|}/g, "").trim()
285 Formateur
.prototype.getSmilesHTML = function()
288 for (var sNom
in this.smiles
)
290 XHTML
+= "<img class=\"" + sNom
+ "\" src=\"img/smileys/" + sNom
+ ".gif\" />"
295 Formateur
.prototype.traitementComplet = function(M
, pseudo
)
297 return this.traiterSmiles(this.traiterURL(this.remplacerBalisesHTML(M
), pseudo
))
301 * FIXME : Cette méthode est attrocement lourde !!
303 Formateur
.prototype.traiterSmiles = function(M
)
305 for (var sNom
in this.smiles
)
307 ss
= this.smiles
[sNom
]
308 for (var i
= 0; i
< ss
.length
; i
++)
309 M
= M
.replace(ss
[i
], "<img src=\"img/smileys/" + sNom
+ ".gif\" />")
314 Formateur
.prototype.remplacerBalisesHTML = function(M
)
316 return M
.replace(/</g
, "<").replace(/>/g
, ">")
319 Formateur
.prototype.traiterURL = function(M
, pseudo
)
323 if (pseudo
== undefined)
326 var traitementUrl = function(url
)
328 // si ya pas de protocole on rajoute "http://"
329 if (!thisFormateur
.regexTestProtocoleExiste
.test(url
))
330 url
= "http://" + url
331 var extension
= thisFormateur
.getShort(url
)
332 return "<a " + (extension
[1] ? "title=\"" + thisFormateur
.traiterPourFenetreLightBox(pseudo
, url
) + ": " + thisFormateur
.traiterPourFenetreLightBox(M
, url
) + "\"" + " rel=\"lightbox[groupe]\"" : "") + " href=\"" + url
+ "\" >[" + extension
[0] + "]</a>"
334 return M
.replace(this.regexUrl
, traitementUrl
)
338 * Renvoie une version courte de l'url.
339 * par exemple : http://en.wikipedia.org/wiki/Yakov_Smirnoff devient wikipedia.org
341 Formateur
.prototype.getShort = function(url
)
343 var estUneImage
= false
344 var versionShort
= null
345 var rechercheImg
= this.regexImg
.exec(url
)
347 if (rechercheImg
!= null)
349 versionShort
= rechercheImg
[1].toLowerCase()
350 if (versionShort
== "jpeg") versionShort
= "jpg" // jpeg -> jpg
355 var rechercheDomaine
= this.regexDomaine
.exec(url
)
356 if (rechercheDomaine
!= null && rechercheDomaine
.length
>= 2)
357 versionShort
= rechercheDomaine
[1]
360 var nomProtocole
= this.regexNomProtocole
.exec(url
)
361 if (nomProtocole
!= null && nomProtocole
.length
>= 2)
362 versionShort
= nomProtocole
[1]
366 return [versionShort
== null ? "url" : versionShort
, estUneImage
]
370 * Traite les pseudo et messages à être affiché dans le titre d'une image visualisé avec lightbox.
372 Formateur
.prototype.traiterPourFenetreLightBox = function(M
, urlCourante
)
375 var traitementUrl = function(url
)
377 return "[" + thisFormateur
.getShort(url
)[0] + (urlCourante
== url
? ": image courante" : "") + "]"
380 return this.remplacerBalisesHTML(M
).replace(this.regexUrl
, traitementUrl
)
384 ///////////////////////////////////////////////////////////////////////////////////////////////////
386 var statutType
= {enregistre: 0, identifie: 1, non_identifie: 2}
388 function Client(util
)
393 this.regexCookie
= new RegExp("^cookie=([^;]*)")
396 //this.captchaCrypt = null
398 // données personnels
399 this.resetDonneesPersonnelles()
401 this.setStatut(statutType
.non_identifie
)
403 // le dernier message d'erreur recut du serveur (par exemple une connexion foireuse : "login impossible")
404 this.dernierMessageErreur
= ""
407 Client
.prototype.resetDonneesPersonnelles = function()
409 this.pseudo
= conf
.pseudoDefaut
413 this.css
= jQuery("link#cssPrincipale").attr("href")
415 this.pagePrincipale
= 1
417 // les conversations, une conversation est un objet possédant les attributs suivants :
420 this.conversations
= new Array()
423 Client
.prototype.setCss = function(css
)
429 jQuery("link#cssPrincipale").attr("href", this.css
)
432 if (this.identifie())
436 Client
.prototype.pageSuivante = function(numConv
)
439 this.pagePrincipale
+= 1
441 this.conversations
[numConv
].page
+= 1
445 Client
.prototype.pagePrecedente = function(numConv
)
448 this.pagePrincipale
-= 1
450 this.conversations
[numConv
].page
-= 1
455 * Ajoute une conversation à la vue de l'utilisateur.
456 * Le profile de l'utilisateur est directement sauvegardé sur le serveur.
457 * @param racines la racine de la conversation
458 * @return true si la conversation a été créée sinon false (par exemple si la conv existe déjà)
460 Client
.prototype.ajouterConversation = function(racine
)
462 // vérification s'il elle n'existe pas déjà
463 for (var i
= 0; i
< this.conversations
.length
; i
++)
464 if (this.conversations
[i
].racine
== racine
)
467 this.conversations
.push({racine : racine
, page : 1})
472 Client
.prototype.supprimerConversation = function(num
)
474 if (num
< 0 || num
>= this.conversations
.length
) return
476 // décalage TODO : supprimer le dernier élément
477 for (var i
= num
; i
< this.conversations
.length
- 1; i
++)
478 this.conversations
[i
] = this.conversations
[i
+1]
479 this.conversations
.pop()
484 Client
.prototype.getXMLlogin = function(login
, password
)
486 var XMLDocument
= this.util
.creerDocumentXMLAction()
487 XMLDocument
.documentElement
.setAttribute("name", "login")
489 var nodeLogin
= XMLDocument
.createElement("login")
490 nodeLogin
.appendChild(XMLDocument
.createTextNode(login
))
491 XMLDocument
.documentElement
.appendChild(nodeLogin
)
493 var nodePassword
= XMLDocument
.createElement("password")
494 nodePassword
.appendChild(XMLDocument
.createTextNode(password
))
495 XMLDocument
.documentElement
.appendChild(nodePassword
)
500 Client
.prototype.getXMLloginCookie = function()
502 var XMLDocument
= this.util
.creerDocumentXMLAction()
503 XMLDocument
.documentElement
.setAttribute("name", "login")
505 var nodeCookie
= XMLDocument
.createElement("cookie")
506 nodeCookie
.appendChild(XMLDocument
.createTextNode(this.cookie
))
507 XMLDocument
.documentElement
.appendChild(nodeCookie
)
513 Client.prototype.getXMLloginCaptcha = function(captchaCrypt, captchaInput)
515 var XMLDocument = this.util.creerDocumentXMLAction()
516 XMLDocument.documentElement.setAttribute("name", "loginCaptcha")
518 var nodecaptchaCrypt = XMLDocument.createElement("captchaCrypt")
519 nodecaptchaCrypt.appendChild(XMLDocument.createTextNode(captchaCrypt))
520 XMLDocument.documentElement.appendChild(nodecaptchaCrypt)
522 var nodecaptchaInput = XMLDocument.createElement("captchaInput")
523 nodecaptchaInput.appendChild(XMLDocument.createTextNode(captchaInput))
524 XMLDocument.documentElement.appendChild(nodecaptchaInput)
530 Client.prototype.getXMLgenerationCaptcha = function()
532 var XMLDocument = this.util.creerDocumentXMLAction()
533 XMLDocument.documentElement.setAttribute("name", "generationCaptcha")
538 Client
.prototype.getXMLEnregistrement = function(login
, password
)
540 var XMLDocument
= this.util
.creerDocumentXMLAction()
541 XMLDocument
.documentElement
.setAttribute("name", "register")
543 var nodeLogin
= XMLDocument
.createElement("login")
544 nodeLogin
.appendChild(XMLDocument
.createTextNode(login
))
545 XMLDocument
.documentElement
.appendChild(nodeLogin
)
547 var nodePassword
= XMLDocument
.createElement("password")
548 nodePassword
.appendChild(XMLDocument
.createTextNode(password
))
549 XMLDocument
.documentElement
.appendChild(nodePassword
)
554 Client
.prototype.getXMLProfile = function()
556 var XMLDocument
= this.util
.creerDocumentXMLAction()
557 XMLDocument
.documentElement
.setAttribute("name", "profile")
559 var nodeCookie
= XMLDocument
.createElement("cookie")
560 nodeCookie
.appendChild(XMLDocument
.createTextNode(this.cookie
))
561 XMLDocument
.documentElement
.appendChild(nodeCookie
)
563 var nodeLogin
= XMLDocument
.createElement("login")
564 nodeLogin
.appendChild(XMLDocument
.createTextNode(this.login
))
565 XMLDocument
.documentElement
.appendChild(nodeLogin
)
567 var nodePassword
= XMLDocument
.createElement("password")
568 nodePassword
.appendChild(XMLDocument
.createTextNode(this.password
))
569 XMLDocument
.documentElement
.appendChild(nodePassword
)
571 var nodePseudo
= XMLDocument
.createElement("pseudo")
572 nodePseudo
.appendChild(XMLDocument
.createTextNode(this.pseudo
))
573 XMLDocument
.documentElement
.appendChild(nodePseudo
)
575 var nodeEmail
= XMLDocument
.createElement("email")
576 nodeEmail
.appendChild(XMLDocument
.createTextNode(this.email
))
577 XMLDocument
.documentElement
.appendChild(nodeEmail
)
579 var nodeCSS
= XMLDocument
.createElement("css")
580 nodeCSS
.appendChild(XMLDocument
.createTextNode(this.css
))
581 XMLDocument
.documentElement
.appendChild(nodeCSS
)
583 var nodePagePrincipale
= XMLDocument
.createElement("pagePrincipale")
584 nodePagePrincipale
.appendChild(XMLDocument
.createTextNode(this.pagePrincipale
))
585 XMLDocument
.documentElement
.appendChild(nodePagePrincipale
)
587 // mémorise les conversations affichées
588 for (var i
= 0; i
< this.conversations
.length
; i
++)
590 var nodeConv
= XMLDocument
.createElement("conversation")
591 XMLDocument
.documentElement
.appendChild(nodeConv
)
593 var nodeRacine
= XMLDocument
.createElement("racine")
594 nodeRacine
.appendChild(XMLDocument
.createTextNode(this.conversations
[i
].racine
))
595 nodeConv
.appendChild(nodeRacine
)
597 var nodePage
= XMLDocument
.createElement("page")
598 nodePage
.appendChild(XMLDocument
.createTextNode(this.conversations
[i
].page
))
599 nodeConv
.appendChild(nodePage
)
606 * Renvoie null si pas définit.
608 Client
.prototype.getCookie = function()
610 var cookie
= this.regexCookie
.exec(document
.cookie
)
611 if (cookie
== null) this.cookie
= null
612 else this.cookie
= cookie
[1]
615 Client
.prototype.delCookie = function()
617 document
.cookie
= "cookie=; max-age=0"
620 Client
.prototype.setCookie = function(cookie
)
622 if (this.cookie
== null)
626 "cookie="+this.cookie
+
627 "; max-age=" + (60 * 60 * 24 * 365)
630 Client
.prototype.identifie = function()
632 return this.statut
== statutType
.enregistre
|| this.statut
== statutType
.identifie
635 Client
.prototype.setStatut = function(statut
)
637 if(typeof(statut
) == "string")
640 statut
== "enregistre" ?
641 statutType
.enregistre : (statut
== "identifie" ? statutType
.identifie : statutType
.non_identifie
)
644 if (statut
== this.statut
) return
651 * Demande la génération d'un captcha au serveur et l'affiche.
654 Client.prototype.afficherCaptcha = function(query)
656 var thisClient = this
658 $.post("request", this.util.xmlVersAction(this.getXMLgenerationCaptcha()),
659 function(data, textStatus)
661 var chemin = jQuery("chemin", data.documentElement).text()
662 thisClient.captchaCrypt = jQuery("captchaCrypt", data.documentElement).text()
663 jQuery(query).prepend(
664 "<p id=\"captcha\" >Es-tu un bot ? <img class=\"captchaImg\" src=\"" + chemin + "\" />" +
665 "<input name=\"captchaInput\" type=\"text\" size=\"5\" max_length=\"5\" ></p>"
671 Client.prototype.cacherCaptcha = function()
673 jQuery("#captcha").remove()
677 * Effectue la connexion vers le serveur.
678 * Cette fonction est bloquante tant que la connexion n'a pas été établie.
679 * S'il existe un cookie en local on s'authentifie directement avec lui.
680 * Si il n'est pas possible de s'authentifier alors on affiche un captcha anti-bot.
682 Client
.prototype.connexionCookie = function()
685 if (this.cookie
== null) return false;
686 return this.connexion(this.util
.xmlVersAction(this.getXMLloginCookie()))
689 Client
.prototype.connexionLogin = function(login
, password
)
691 return this.connexion(this.util
.xmlVersAction(this.getXMLlogin(login
, password
)))
695 Client.prototype.connexionCaptcha = function()
697 return this.connexion(this.util.xmlVersAction(this.getXMLloginCaptcha(this.captchaCrypt, jQuery("#captcha input").val())))
700 Client
.prototype.enregistrement = function(login
, password
)
702 if (this.identifie())
705 this.password
= password
707 this.setStatut(statutType
.enregistre
)
712 if (login
== undefined) login
= ""
713 if (password
== undefined) password
= ""
714 return this.connexion(this.util
.xmlVersAction(this.getXMLEnregistrement(login
, password
)))
718 Client
.prototype.connexion = function(action
)
720 //action.action.dump()
732 //thisClient.util.serializer.serializeToString(data).dump()
733 thisClient
.chargerDonnees(data
)
737 return this.identifie()
740 Client
.prototype.deconnexion = function()
742 this.setStatut(statutType
.non_identifie
) // deconnexion
743 this.resetDonneesPersonnelles()
747 Client
.prototype.chargerDonnees = function(data
)
749 var thisClient
= this
751 this.setStatut(jQuery("statut", data
.documentElement
).text())
753 if (this.identifie())
755 this.cookie
= jQuery("cookie", data
.documentElement
).text()
758 this.login
= jQuery("login", data
.documentElement
).text()
759 this.pseudo
= jQuery("pseudo", data
.documentElement
).text()
760 this.email
= jQuery("email", data
.documentElement
).text()
761 this.css
= jQuery("css", data
.documentElement
).text()
763 // la page de la conversation principale
764 var tmp
= jQuery("pagePrincipale", data
.documentElement
)
765 this.pagePrincipale
= tmp
.length
< 1 ? 1 : tmp
.text()
770 jQuery("link#cssPrincipale").attr("href", this.css
)
774 this.conversations
= new Array()
775 jQuery("conversation", data
.documentElement
).each(
778 thisClient
.conversations
.push( { racine : jQuery("racine", this).text(), page : jQuery("page", this).text() } )
782 this.dernierMessageErreur
= jQuery("information", data
.documentElement
).text()
786 * Met à jour les données personne sur serveur.
787 * @param async de manière asynchrone ? défaut = true
789 Client
.prototype.flush = function(async
)
791 if (async
== undefined)
795 //thisClient.util.log(this.util.xmlVersAction(this.getXMLProfile()).action)
802 data: this.util
.xmlVersAction(this.getXMLProfile()),
806 //thisClient.util.log(thisClient.util.serializer.serializeToString(data))
810 // TODO : retourner false si un problème est survenu lors de l'update du profile
814 Client
.prototype.majMenu = function()
816 var displayType
= this.css
== "css/3/euphorik.css" ? "block" : "inline" //this.client
818 // met à jour le menu
819 if (this.statut
== statutType
.enregistre
)
821 jQuery("#menu .profile").css("display", displayType
).text("profile")
822 jQuery("#menu .logout").css("display", displayType
)
823 jQuery("#menu .register").css("display", "none")
825 else if (this.statut
== statutType
.identifie
)
827 jQuery("#menu .profile").css("display", "none")
828 jQuery("#menu .logout").css("display", displayType
)
829 jQuery("#menu .register").css("display", displayType
)
833 jQuery("#menu .profile").css("display", displayType
).text("login")
834 jQuery("#menu .logout").css("display", "none")
835 jQuery("#menu .register").css("display", displayType
)
839 ///////////////////////////////////////////////////////////////////////////////////////////////////
845 jQuery(document
).ready(
848 /* FIXME : ce code pose problème sur konqueror, voir : http://www.kde-forum.org/thread.php?threadid=17993
849 var p = new DOMParser();
850 var doc = p.parseFromString("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<action/>", "text/xml")
851 var s = new XMLSerializer()
852 alert(s.serializeToString(doc)) */
854 var util
= new Util()
855 var client
= new Client(util
)
856 var pages
= new Pages()
857 var formateur
= new Formateur()
859 // connexion vers le serveur (utilise un cookie qui traine)
860 client
.connexionCookie()
863 for (var i
= 1; i
<= 3; i
++)
865 jQuery("#css"+i
).click(function(){
866 client
.setCss("css/" + jQuery(this).attr("id").charAt(3) + "/euphorik.css")
870 jQuery("#menu .minichat").click(function(){ pages
.afficherPage("minichat") })
871 jQuery("#menu .profile").click(function(){ pages
.afficherPage("profile") })
872 jQuery("#menu .logout").click(function(){
873 util
.messageDialogue("Êtes-vous sur de vouloir vous délogger ?", messageType
.question
,
876 client
.deconnexion();
877 pages
.afficherPage("minichat", true)
883 jQuery("#menu .register").click(function(){ pages
.afficherPage("register") })
885 pages
.ajouterPage(new PageMinichat(client
, formateur
, util
))
886 pages
.ajouterPage(new PageProfile(client
, formateur
, util
))
887 pages
.ajouterPage(new PageRegister(client
, formateur
, util
))
888 pages
.afficherPage("minichat")