From f9bb95174b93de4ce28167eea21535a01394f71f Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 31 Oct 2009 16:14:38 +0100 Subject: Added XHR for direct messages. --- js/util.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'js') diff --git a/js/util.js b/js/util.js index 11b06298d..c7a3e8f88 100644 --- a/js/util.js +++ b/js/util.js @@ -57,6 +57,8 @@ $(document).ready(function(){ SN.U.NoticeReply(); SN.U.NoticeDataAttach(); + + SN.U.NewDirectMessage(); } SN.U.NoticeAttachments(); @@ -350,6 +352,32 @@ var SN = { // StatusNet NDA.val(''); }); }); + }, + + NewDirectMessage: function() { + NDM = $('.entity_send-a-message a'); + NDM.attr({'href':NDM.attr('href')+'&ajax=1'}); + NDM.click(function() { + var NDMF = $('.entity_send-a-message form'); + if (NDMF.length == 0) { + $.get(NDM.attr('href'), null, function(data) { + $('.entity_send-a-message').append(document._importNode($('form', data).get(0), true)); + $('.entity_send-a-message textarea').focus(); + + NDMF = $('.entity_send-a-message form'); + NDMF.append(''); + $('.entity_send-a-message button').click(function(){ + NDMF.hide(); + return false; + }); + }); + } + else { + NDMF.show(); + $('.entity_send-a-message textarea').focus(); + } + return false; + }); } } } -- cgit v1.2.3-54-g00ecf