From: Greg Burri Date: Sun, 9 Dec 2007 21:23:27 +0000 (+0000) Subject: MOD Lors d'une erreur lors d'en envoie de message le message n'est plus enlevé de... X-Git-Tag: 1.0.0^2~203 X-Git-Url: http://git.euphorik.ch/?p=euphorik.git;a=commitdiff_plain;h=cb001bf4e6e3ec3064b954b7c5583db8440f3492 MOD Lors d'une erreur lors d'en envoie de message le message n'est plus enlevé de la textbox --- diff --git a/doc/TODO.txt b/doc/TODO.txt index caae47e..a148ee5 100755 --- a/doc/TODO.txt +++ b/doc/TODO.txt @@ -51,10 +51,10 @@ [ok] Pouvoir modifier la css (dark/light) * Créer le style lite * Créer le style old (avec le style de l'ancien site) -[ok] Ne pas afficher la css dans le profile +[ok] Ne pas afficher la css dans le profile +[ok] Ne pas effacer le message (dans le ) si l'on recoit un "pas ok" lors de l'envoie * Utiliser une listbox pour la liste de css -* Ne pas effacer le message (dans le ) si l'on recoit un "pas ok" lors de l'envoie * Ralentir volontairement le connexion lors d'un mauvais login * Shift-enter pour ajouter une ligne dans la ligne de saisie (retour à la ligne) * Crée un
XHTML diff --git a/js/euphorik.js b/js/euphorik.js index 9dd3357..e56acde 100755 --- a/js/euphorik.js +++ b/js/euphorik.js @@ -128,7 +128,11 @@ Util.prototype.creerDocumentXMLAction = function() { if (document.implementation && document.implementation.createDocument) { - return document.implementation.createDocument("", "action", null) + // var doc = document.implementation.createDocument("", "action", null) + var parser = new DOMParser(); + var doc = parser.parseFromString("\n", "text/xml") + //alert(this.serializeXML(doc)) + return doc } else if (window.ActiveXObject) { @@ -143,32 +147,9 @@ Util.prototype.creerDocumentXMLAction = function() Util.prototype.xmlVersAction = function(xml) { - return {action: this.to_utf8(this.serializeXML(xml /*, "UTF-8"*/))} + //return {action: this.to_utf8(this.serializeXML(xml /*, "UTF-8"*/))} + return {action: this.serializeXML(xml)} } - -// voir : http://homepage3.nifty.com/aokura/jscript/utf8.html -// et : http://www1.tip.nl/~t876506/utf8tbl.html -Util.prototype.to_utf8 = function(s) -{ - if (!s) return "" - - var c, d = "" - for (var i = 0; i < s.length; i++) - { - c = s.charCodeAt(i); - if (c <= 0x7f) { - d += s.charAt(i); - } else if (c >= 0x80 && c <= 0x7ff) { - d += String.fromCharCode(((c >> 6) & 0x1f) | 0xc0); - d += String.fromCharCode((c & 0x3f) | 0x80); - } else { - d += String.fromCharCode((c >> 12) | 0xe0); - d += String.fromCharCode(((c >> 6) & 0x3f) | 0x80); - d += String.fromCharCode((c & 0x3f) | 0x80); - } - } - return d; -} Util.prototype.md5 = function(chaine) { @@ -775,6 +756,12 @@ jQuery.noConflict() jQuery(document).ready( function() { + /* FIXME : ce code pose problème sur konqueror, voir : http://www.kde-forum.org/thread.php?threadid=17993 + var p = new DOMParser(); + var doc = p.parseFromString("\n", "text/xml") + var s = new XMLSerializer() + alert(s.serializeToString(doc)) */ + var util = new Util() var client = new Client(util) var pages = new Pages() diff --git a/js/pageMinichat.js b/js/pageMinichat.js index 3093807..5c36577 100755 --- a/js/pageMinichat.js +++ b/js/pageMinichat.js @@ -205,10 +205,9 @@ PageMinichat.prototype.envoyerMessage = function(pseudo, message) data : this.util.xmlVersAction(this.getXMLMessage(pseudo, message, repondA)), dataType : "xml", success : function(data, textStatus) - { - // TODO : traiter les erreurs - //alert(data) - jQuery("form input.message").val("") + { + if(jQuery("statut", data.documentElement).text() == "ok") + jQuery("form input.message").val("") } } ) @@ -523,6 +522,7 @@ Messages.prototype.rafraichirMessages = function(vider) var thisMessages = this // caisupair javacrypte //this.util.log(this.util.serializer.serializeToString(this.getXMLrafraichirMessages())) + //alert(this.util.xmlVersAction(this.getXMLrafraichirMessages()).action) this.attenteCourante = jQuery.ajax({ type: "POST", url: "request",