X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=js%2Futil.js;h=c22802651a1f270eae9ba4a7714f0ceabf04e239;hb=ec53e68cf2490fe3a9ed74914c0c96d31cabe8c0;hp=1372c9f6965db105e9adee570ba36a66d940c4ac;hpb=02c5d68bed794b888e7d4a41f2c08d688a67ba6d;p=quix0rs-gnu-social.git diff --git a/js/util.js b/js/util.js index 1372c9f696..c22802651a 100644 --- a/js/util.js +++ b/js/util.js @@ -273,7 +273,7 @@ var SN = { // StatusNet }, success: function(data, textStatus) { if (typeof($('form', data)[0]) != 'undefined') { - var form_new = document._importNode($('form', data)[0], true); + form_new = document._importNode($('form', data)[0], true); form.replaceWith(form_new); if (onSuccess) { onSuccess(); @@ -638,13 +638,23 @@ var SN = { // StatusNet // Find the notice we're replying to... var id = $($('.notice_id', notice)[0]).text(); var parentNotice = notice; + var stripForm = true; // strip a couple things out of reply forms that are inline // Find the threaded replies view we'll be adding to... var list = notice.closest('.notices'); - if (list.hasClass('threaded-replies')) { + if (list.closest('.old-school').length) { + // We're replying to an old-school conversation thread; + // use the old-style ping into the top form. + SN.U.switchInputFormTab("status") + replyForm = $('#input_form_status').find('form'); + stripForm = false; + } else if (list.hasClass('threaded-replies')) { // We're replying to a reply; use reply form on the end of this list. // We'll add our form at the end of this; grab the root notice. parentNotice = list.closest('.notice'); + + // See if the form's already open... + var replyForm = $('.notice-reply-form', list); } else { // We're replying to a parent notice; pull its threaded list // and we'll add on the end of it. Will add if needed. @@ -658,18 +668,21 @@ var SN = { // StatusNet SN.U.NoticeInlineReplyPlaceholder(notice); } } - } - // See if the form's already open... - var replyForm = $('.notice-reply-form', list); + // See if the form's already open... + var replyForm = $('.notice-reply-form', list); + } var nextStep = function() { // Override...? replyForm.find('input[name=inreplyto]').val(id); - replyForm.find('#notice_to').attr('disabled', 'disabled').hide(); - replyForm.find('#notice_private').attr('disabled', 'disabled').hide(); - replyForm.find('label[for=notice_to]').hide(); - replyForm.find('label[for=notice_private]').hide(); + if (stripForm) { + // Don't do this for old-school reply form, as they don't come back! + replyForm.find('#notice_to').attr('disabled', 'disabled').hide(); + replyForm.find('#notice_private').attr('disabled', 'disabled').hide(); + replyForm.find('label[for=notice_to]').hide(); + replyForm.find('label[for=notice_private]').hide(); + } // Set focus... var text = replyForm.find('textarea'); @@ -693,7 +706,7 @@ var SN = { // StatusNet nextStep(); } else { // Hide the placeholder... - placeholder = list.find('li.notice-reply-placeholder').hide(); + var placeholder = list.find('li.notice-reply-placeholder').hide(); // Create the reply form entry at the end var replyItem = $('li.notice-reply', list); @@ -701,10 +714,11 @@ var SN = { // StatusNet replyItem = $('
  • '); var intermediateStep = function(formMaster) { - replyItem.append(formMaster); + var formEl = document._importNode(formMaster, true); + replyItem.append(formEl); list.append(replyItem); // *after* the placeholder - var form = replyForm = formMaster; + var form = replyForm = $(formEl); SN.Init.NoticeFormSetup(form); nextStep(); @@ -719,8 +733,8 @@ var SN = { // StatusNet // @fixme this fallback may or may not work var url = $('#form_notice').attr('action'); $.get(url, {ajax: 1}, function(data, textStatus, xhr) { - intermediateStep($('form', $(data).children())); - }, 'xml'); + intermediateStep($('form', data)[0]); + }); } } } @@ -734,7 +748,7 @@ var SN = { // StatusNet list = notice.find('ul.threaded-replies'); } var placeholder = $('
  • ' + - '' + + '' + '
  • '); placeholder.find('input') .val(SN.msg('reply_placeholder')); @@ -759,11 +773,11 @@ var SN = { // StatusNet var url = $(this).attr('href'); var area = $(this).closest('.threaded-replies'); $.get(url, {ajax: 1}, function(data, textStatus, xhr) { - var replies = $('.threaded-replies', $(data).children()); + var replies = $('.threaded-replies', data); if (replies.length) { - area.replaceWith(replies); + area.replaceWith(document._importNode(replies[0], true)); } - }, 'xml'); + }); return false; }); }, @@ -1266,7 +1280,7 @@ var SN = { // StatusNet if (NDMF.length === 0) { $(this).addClass(SN.C.S.Processing); $.get(NDM.attr('href'), null, function(data) { - $('.entity_send-a-message').append($('form', $(data).children())); + $('.entity_send-a-message').append(document._importNode($('form', data)[0], true)); NDMF = $('.entity_send-a-message .form_notice'); SN.U.FormNoticeXHR(NDMF); SN.U.FormNoticeEnhancements(NDMF); @@ -1276,7 +1290,7 @@ var SN = { // StatusNet return false; }); NDM.removeClass(SN.C.S.Processing); - }, 'xml'); + }); } else { NDMF.show(); @@ -1421,7 +1435,15 @@ var SN = { // StatusNet SN.Init.NoticeFormSetup(form); }) .find('.notice_data-text').focus(); - } + }, + + showMoreMenuItems: function(menuid) { + $('#'+menuid+' .more_link').remove(); + var selector = '#'+menuid+' .extended_menu'; + var extended = $(selector); + extended.removeClass('extended_menu'); + return void(0); + } }, Init: { @@ -1513,7 +1535,7 @@ var SN = { // StatusNet if ($('body.user_in').length > 0) { var masterForm = $('.form_notice:first'); if (masterForm.length > 0) { - SN.C.I.NoticeFormMaster = masterForm; + SN.C.I.NoticeFormMaster = document._importNode(masterForm[0], true); } SN.U.NoticeRepeat(); SN.U.NoticeReply();