Click here to Skip to main content
15,902,893 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,

I want to send a link automatically in text chat when a user click on specified button in chat friend's box. Can you send enter key after i fill text chat box.

Thanks for your answers.
Posted
Comments
Thanks7872 17-Dec-14 7:18am    
You have not shown the code,so no one will be able to provide you the solution. Further, better post it here http://www.oxwall.org/forum where you will find more users working with the same.

1 solution

I could find function for text chat in Oxwall.
This javascript file have all function (ow_plugins/mailbox/static/js/contactmanager.js).

I could find the function for receive key from text chat, When i press enter, This function all text to server.

If i could send key enter (this means i can call this function with enter key parameter) i could send my link after i fill text chat box.
JavaScript
this.textareaControl.keypress(function (ev) {

        if (!self.model.isSelected) {
            self.model.setIsSelected(true);
        }

        if (ev.which === 13 && !ev.shiftKey) {
            alert("jiq oooo dasto hora!!!22222 :D");
            ev.preventDefault();

            var body = $(this).val();
            alert(body);
            if ($.trim(body) == '')
                return;

            self.sendMessage(body);

            if (self.dialogWindowHeight > 0) {
                self.messageListWrapper.height(self.dialogWindowHeight);
            }

            $(this).attr('rows', 1);
            $(this).css('height', self.textareaHeight);

            self.scrollDialog();

            self.model.setIsComposing(false);
        }
        else if (ev.which === 13 && ev.shiftKey) {
            self.adjustTextarea($(this));
        }
        else {
            self.adjustTextarea($(this));
        }
}


I read this function and i could edit this function for better call:

JavaScript
function ehsan11() {

    var ev = window.event;
    alert(ev.which);
    if (!self.model.isSelected) {
        self.model.setIsSelected(true);
    }

    if (ev.which === 13 && !ev.shiftKey) {
        alert("jiq oooo dasto hora!!!22222 :D");
        ev.preventDefault();

        var body = $(this).val();
        alert(body);
        if ($.trim(body) == '')
            return;

        self.sendMessage(body);

        if (self.dialogWindowHeight > 0) {
            self.messageListWrapper.height(self.dialogWindowHeight);
        }

        $(this).attr('rows', 1);
        $(this).css('height', self.textareaHeight);

        self.scrollDialog();

        self.model.setIsComposing(false);
    }
    else if (ev.which === 13 && ev.shiftKey) {
        self.adjustTextarea($(this));
    }
    else {
        self.adjustTextarea($(this));
    }
}

this.textareaControl.keypress(ehsan11);


But i still can not call ehsan11 function from outer, Because this function wrote in this unit:

JavaScript
OWMailbox.Dialog.Controller = function(model){
...
    function ehsan11() {
           ...
    }
    this.textareaControl.keypress(ehsan11);
...
}

Can any one help me.
Thanks a lot.
 
Share this answer
 
Comments
Deepu S Nair 17-Dec-14 8:41am    
Please don't post your question as solution.Use 'Improve question' link to update your question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900