X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=js%2FpageMinichat%2Fconversation.js;h=2810b1b3e730d755ffa6fc928ef95672516e4d50;hb=4eed832e336e6056464ebda246c5318e1c9d3a69;hp=645c4d51ecd368855dccc48055112a5436e858a3;hpb=4aa85a2e80963b73773e748fd4402fab2ad852ce;p=euphorik.git
diff --git a/js/pageMinichat/conversation.js b/js/pageMinichat/conversation.js
index 645c4d5..2810b1b 100644
--- a/js/pageMinichat/conversation.js
+++ b/js/pageMinichat/conversation.js
@@ -56,41 +56,43 @@ euphorik.Conversation = function(conversations, num) {
'
' +
(reverse ? messageRacineXHTML : "") +
'
' +
- (num === 0 ? '' : '
') +
+ (this.num === 0 ? '' : '
') + //
'<1>' +
'
' +
(reverse ? "" : messageRacineXHTML) +
'
' +
(reverse ? "" : messagesXHTML) +
- '' +
+ //'' +
'';
$("#conversations tr").append(XHTML);
+ // les infos bulles
+ this.util.infoBulle("Aller à la première page", $("#" + this.getId() + " .titre .numPage"), euphorik.Util.positionBulleType.haut);
+ if (this.num !== 0) {
+ this.util.infoBulle("Créer un lien vers la conversation", $("#" + this.getId() + " .titre .creerLien"));
+ this.util.infoBulle("Fermer la conversation", $("#" + this.getId() + " .titre .fermer"));
+ }
+
// les différents événements liés à la conversation
var thisConversation = this;
- $("#" + this.getId() + " .titre .lien").click(function() {
+ $("#" + this.getId() + " .titre .creerLien").click(function() {
thisConversation.util.replaceSelection(
$("form#posterMessage input.message")[0],
"{" + thisConversation.client.conversations[thisConversation.num - 1].root.toString(36) + "}"
);
});
$("#" + this.getId() + " .titre .fermer").click(function() {
- thisConversation.conversations.supprimerConversation(num);
+ thisConversation.conversations.supprimerConversation(thisConversation.num);
});
+ /*
$("#" + this.getId() + " .titre .reduire").click(function() {
$("#" + thisConversation.getId() + " .titre, #" + thisConversation.getId() + " .messages").hide()
var e = $("#" + thisConversation.getId() + " .messageReduit");
e.get()[0].innerHTML = thisConversation.getMessageReduit()
- });
-
- this.util.infoBulle("Aller à la première page", $("#" + this.getId() + " .numPage"), euphorik.Util.positionBulleType.haut);
- if (num !== 0) {
- this.util.infoBulle("Créer un lien vers la conversation", $("#" + this.getId() + " .lien"));
- this.util.infoBulle("Fermer la conversation", $("#" + this.getId() + " .fermer"));
- }
+ });*/
};
-
+/*
euphorik.Conversation.prototype.getMessageReduit = function() {
return '' +
'' +
@@ -99,7 +101,7 @@ euphorik.Conversation.prototype.getMessageReduit = function() {
'Blabla blablablabla bla blabla ..' +
'' +
'';
-}
+}*/
/**
* @racine un message représentant la racine de la conversation, vaut undefined pour la conversation générale
@@ -284,6 +286,7 @@ euphorik.Conversation.prototype.flush = function() {
/**
* Attache des événements à un message donné.
+ * Utilisé lorsqu'un message est ajouté au document HTML.
* @element le message du DOM
*/
euphorik.Conversation.prototype.attacherEventsSurMessage = function(element) {
@@ -296,7 +299,7 @@ euphorik.Conversation.prototype.attacherEventsSurMessage = function(element) {
var thisConversation = this;
$(".lienConv", element).click(
- function(event) {
+ function(event) {
// FIXME : ya pas mieux ?
var racine = $(event.target).text();
thisConversation.conversations.ouvrirConversation(parseInt(racine.substring(1, racine.length - 1), 36));
@@ -307,31 +310,33 @@ euphorik.Conversation.prototype.attacherEventsSurMessage = function(element) {
$(element).click(function(event) {
if ($(event.target).is("a") || $(event.target).parents("#outilsBan").length > 0) {
return;
+ } else if ($(event.target).is(".extraire")) {
+ thisConversation.util.outilsMessage.hide();
+ thisConversation.conversations.ouvrirConversation(idMess);
+ return;
+ } else if ($(event.target).is(".extraireCompletement")) {
+ thisConversation.util.outilsMessage.hide();
+ thisConversation.conversations.ouvrirConversation(thisConversation.messagesParId[idMess].racineId);
+ return;
}
// met ou enlève la mise en evidence du message
thisConversation.conversations.toggleMessageRepond(thisConversation.messagesParId[idMess]);
-
+
// donne le focus à la ligne de saisie
$("form input.message").focus();
- }).hover(function(event) { // affiche les outils liées au message
+ }).hover(function() { // affiche les outils liées au message
var top = $(this).offset().top
- var left = $(this).offset().left + $(this).width() - thisConversation.util.outilsMessage.width()
- thisConversation.util.outilsMessage.css("top", top + 1).css("left", left).prependTo(this).show();
- TODO
- //
- // extraction d'une conversation
- /*if ($(event.target).is(".extraire")) {
- thisConversation.conversations.ouvrirConversation(idMess);
- return;
- }
-
- if ($(event.target).is(".extraireCompletement")) {
- thisConversation.conversations.ouvrirConversation(thisConversation.messagesParId[idMess].racineId);
- return;
- }*/
- }, function(event) {
- thisConversation.util.outilsMessage.hide();
+ var left = $(this).offset().left + $(this).outerWidth() - thisConversation.util.outilsMessage.outerWidth();
+ $(".extraire", thisConversation.util.outilsMessage).unbind();
+ $(".extraireCompletement", thisConversation.util.outilsMessage).unbind();
+ // TODO : ces deux appels devraient se trouver dans "PageMinichat" lors de la création de thisConversation.util
+ // malheureusement lors de la modification du DOM (suppression des conversations) les événements liés sont supprimés
+ thisConversation.util.infoBulle("Extraction de la conversation à partir de ce message", $(".extraire", thisConversation.util.outilsMessage));
+ thisConversation.util.infoBulle("Extraction de la conversation complète", $(".extraireCompletement", thisConversation.util.outilsMessage));
+ thisConversation.util.outilsMessage.css("top", top).css("left", left).prependTo(this).show();
+ }, function() {
+ thisConversation.util.outilsMessage.hide()
});
// mise en évidence de la conversation
@@ -440,8 +445,7 @@ euphorik.Conversation.prototype.afficherConversation = function(id) {
};
/**
- * Supprime une conversation.
- * Ne l'enlève pas du DOM.
+ * Supprime la conversation du DOM.
*/
euphorik.Conversation.prototype.supprimer = function() {
$("#" + this.getId()).remove();