X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=js%2Feuphorik.js;h=d7ef712c120ce6cf9ed55a3839cdc2fbd7c0a0c0;hb=8875fb445d47bb0925ef46a131a9bc4dec004b49;hp=56c78fddd7f3fc2824f6e683ea9e09272bbd54d7;hpb=7f8025543a7a5d614ec47d18026dc0feb3338fdb;p=euphorik.git diff --git a/js/euphorik.js b/js/euphorik.js index 56c78fd..d7ef712 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -106,8 +106,7 @@ var messageType = {informatif: 0, question: 1, erreur: 2} */ Util.prototype.jsonVersAction = function(json) { - // FIXME : ne plus encapsuler json dans de l'xml (problème avec yaws) - return {action: "" + JSON.stringify(json) + "" } + return {action : JSON.stringify(json) } } Util.prototype.md5 = function(chaine) @@ -184,6 +183,29 @@ Util.prototype.replaceSelection = function(input, replaceString) { } } +Util.prototype.rot13 = function(chaine) +{ + var ACode = 'A'.charCodeAt(0) + var aCode = 'a'.charCodeAt(0) + var MCode = 'M'.charCodeAt(0) + var mCode = 'm'.charCodeAt(0) + var ZCode = 'Z'.charCodeAt(0) + var zCode = 'z'.charCodeAt(0) + + var f = function(ch, pos) { + if (pos == ch.length) + return "" + + var c = ch.charCodeAt(pos); + return String.fromCharCode( + c + + (c >= ACode && c <= MCode || c >= aCode && c <= mCode ? 13 : + (c > MCode && c <= ZCode || c > mCode && c <= zCode ? -13 : 0)) + ) + f(ch, pos + 1) + } + return f(chaine, 0) +} + /////////////////////////////////////////////////////////////////////////////////////////////////// function Pages() @@ -565,11 +587,12 @@ Client.prototype.authentifie = function() Client.prototype.setStatut = function(statut) { + //alert(statut) // conversation en "enum" si en "string" if (typeof(statut) == "string") { statut = - statut == "registered" ? + statut == "auth_registered" ? statutType.auth_registered : (statut == "auth_not_registered" ? statutType.auth_not_registered : statutType.deconnected) } @@ -735,6 +758,16 @@ Client.prototype.majMenu = function() /////////////////////////////////////////////////////////////////////////////////////////////////// +function initialiserListeStyles(client) +{ + jQuery("#menuCss").change( + function() + { + client.setCss("css/" + jQuery("option:selected", this).attr("value") + "/euphorik.css") + } + ) +} + jQuery.noConflict() // charge dynamiquement le script de debug @@ -758,19 +791,12 @@ jQuery(document).ready( // connexion vers le serveur (utilise un cookie qui traine) client.connexionCookie() - // les styles css - for (var i = 1; i <= 3; i++) - { - jQuery("#css"+i).click(function(){ - client.setCss("css/" + jQuery(this).attr("id").charAt(3) + "/euphorik.css") - }) - } + initialiserListeStyles(client) // TODO : pourquoi jQuery(document).unload ne fonctionne pas ? jQuery(window).unload( function() { - //alert("ok") client.flush(false) } ) @@ -789,10 +815,12 @@ jQuery(document).ready( ) }) jQuery("#menu .register").click(function(){ pages.afficherPage("register") }) + jQuery("#menu .about").click(function(){ pages.afficherPage("about") }) pages.ajouterPage(new PageMinichat(client, formateur, util)) pages.ajouterPage(new PageProfile(client, formateur, util)) pages.ajouterPage(new PageRegister(client, formateur, util)) + pages.ajouterPage(new PageAbout(client, formateur, util)) pages.afficherPage("minichat") } ) \ No newline at end of file