X-Git-Url: http://git.euphorik.ch/?a=blobdiff_plain;f=js%2FpageMinichat.js;h=13f337581a7312be1356ce7a787fdcf3cd799a0d;hb=0fd41878c239877c274bd2bf58caf65b24977e52;hp=ef368923d78a19ab30b1b05592719052f6780122;hpb=fa4dd5af772a44a6de9fbe4d2f68548ff5c89ca8;p=euphorik.git diff --git a/js/pageMinichat.js b/js/pageMinichat.js index ef36892..13f3375 100755 --- a/js/pageMinichat.js +++ b/js/pageMinichat.js @@ -1,820 +1,292 @@ // coding: utf-8 - -function PageMinichat(client, formateur, util) -{ - this.nom = "minichat" - - this.client = client - this.formateur = formateur - this.util = util - - this.regexMessageTagMatch = /\{.*?\}>/g - this.regexMessageTagReplace = /^(.*?\{.*?\}>)*/ -} - -PageMinichat.prototype.contenu = function() -{ -// \ - return '\ -
\ -\ -' -} - -PageMinichat.prototype.charger = function() -{ - thisPage = this - - jQuery("form input.pseudo").val(this.client.pseudo) - - // cet appel ne doit pas être fait avant l'appel à 'charger' - this.messages = new Messages(this.client, this.formateur, this.util) - - this.messages.rafraichirMessages(true) - - this.util.setCaretToEnd(jQuery("form input.message")[0]) - - // affichage des smiles - jQuery("#smiles").html(this.formateur.getSmilesHTML()).children().each( - function(i) - { - var opacityBase = jQuery(this).css("opacity") - jQuery(this).click( - function(event) - { - thisPage.util.replaceSelection(jQuery("form input.message")[0], thisPage.formateur.smiles[jQuery(this).attr("class")][0].source.replace(/\\/g, "")) - } - ) - .hover( - function() - { - jQuery(this).animate( - { - opacity: 1 - }, 200 - ) - }, - function() - { - jQuery(this).animate( - { - opacity: opacityBase - }, 200 - ) - } - ) - } - ) - - /// événements - jQuery("form button.return").click( - function() - { - // captcha anti bot - if (jQuery("form input.captcha").val() != "") return - - thisPage.envoyerMessage( - jQuery("form input.pseudo").val(), - jQuery("form input.message").val() - ) - - jQuery("form input.message")[0].focus() - } - ) - // interdiction de submiter le formulaire - jQuery("form").submit(function(){return false}) - - jQuery("input.pseudo").click( - function() - { - var input = jQuery("input.pseudo")[0] - if (input.value == conf.pseudoDefaut) - input.value = "" - } - ) -} - -PageMinichat.prototype.decharger = function() -{ - if (this.attenteCourante != null) - this.attenteCourante.abort() -} - -PageMinichat.prototype.getXMLMessage = function(pseudo, message, repondA) -{ - var XMLDocument = this.util.creerDocumentXMLAction() - XMLDocument.documentElement.setAttribute("name", "message") - - var nodeCookie = XMLDocument.createElement("cookie") - nodeCookie.appendChild(XMLDocument.createTextNode(this.client.cookie)) - XMLDocument.documentElement.appendChild(nodeCookie) - - var nodePseudo = XMLDocument.createElement("pseudo") - nodePseudo.appendChild(XMLDocument.createTextNode(pseudo)) - XMLDocument.documentElement.appendChild(nodePseudo) - - var nodeContenu = XMLDocument.createElement("contenu") - nodeContenu.appendChild(XMLDocument.createTextNode(message)) - XMLDocument.documentElement.appendChild(nodeContenu) - - if (repondA.length > 0) - { - var nodeReponses = XMLDocument.createElement("reponses") - XMLDocument.documentElement.appendChild(nodeReponses) - for (var i = 0; i < repondA.length; i++) - { - var nodeReponse = XMLDocument.createElement("reponse") - nodeReponse.setAttribute("id", repondA[i]) - nodeReponses.appendChild(nodeReponse) - } +// Copyright 2008 Grégory Burri +// +// This file is part of Euphorik. +// +// Euphorik is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Euphorik is distributed in the hope that it will be useful, +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Euphorik. If not, see