[TH] Newest Post First [Deleted]

I use this addon since several weeks and my users love it. However, today a problem occured when I tried to move a thread from one forum to another.

screenshot-bookmark.webp

It seems as if this addon collides with the bokmark addon. It is interesting to see that everything works fine as soon as I disable "newest post" or "bookmarks". However I would like to use both.

What can I do @Jon W @Daniel Hood
 
@Jon W

I just installed the add-on but when select the option to put the newest posts first, all it moves is the box to type your reply and not the order of the posts... Got no errors or anything.
 
I use this addon since several weeks and my users love it. However, today a problem occured when I tried to move a thread from one forum to another.

View attachment 93665

It seems as if this addon collides with the bokmark addon. It is interesting to see that everything works fine as soon as I disable "newest post" or "bookmarks". However I would like to use both.

What can I do @Jon W @Daniel Hood
This is fixed in the next release of Bookmarks.
 
Am I the only who has problem with the quick reply box not emptying it's contents after posting a reply:
testing.jpg


Works fine when using the default view order from oldest to newest. Other than that it's working all fine on v1.2.3.
Or is it just not compatible with version 1.2.3 yet?


I just tried it on 1.4.3. The quick reply is not emptying. - FIXED

Post order is a nice feature.
 
Last edited:
confirmed: I reversed order and the quick-reply box at the bottom keeps the content and the focus after posting. To the user it looks like the post hasn`t been sent at all and so they keep re-posting.
@Jon W could you please fix this, as it is confusing for the members. They think the answer hasn`t been posted because normally the reply box will be empty after submitting it.
 
To all that have requested the "fix" from me....

I'm not using the addon any more, but here is what I did:

discussion.js

NOTE: If you are using the minimized version of this script, you will have to use whatever tools you like to un-minimize the file, or modify these instructions to deal with the minimized file and any variable replacement the minimize tool performed.

Original un-minimized file:
Code:
/**
 * @author waindigo
 */

/** @param {jQuery} $ jQuery Object */
!function($, window, document, _undefined)
{
   //TODO: Enable jQuery plugin and compressor in editor template.

   /**
    * Enables quick reply for a message form
    * @param $form
    */
   XenForo.QuickReply = function($form)
   {
     if ($('#messageList').length == 0)
     {
       return console.error('Quick Reply not possible for %o, no #messageList found.', $form);
     }

     var submitEnableCallback = XenForo.MultiSubmitFix($form);

     /**
      * Scrolls QuickReply into view and focuses the editor
      */
     this.scrollAndFocus = function()
     {
       $(document).scrollTop($form.offset().top);

       if (window.tinyMCE)
       {
         window.tinyMCE.editors['ctrl_message_html'].focus();
       }
       else
       {
         $('#QuickReply').find('textarea:first').get(0).focus();
       }

       return this;
     };

     $form.data('QuickReply', this).bind(
     {
       /**
        * Fires just before the form would be AJAX submitted,
        * to detect whether or not the 'more options' button was clicked,
        * and to abort AJAX submission if it was.
        *
        * @param event e
        * @return
        */
       AutoValidationBeforeSubmit: function(e)
       {
         if ($(e.clickedSubmitButton).is('input[name="more_options"]'))
         {
           e.preventDefault();
           e.returnValue = true;
         }
       },

       /**
        * Fires after the AutoValidator form has successfully validated the AJAX submission
        *
        * @param event e
        */
       AutoValidationComplete: function(e)
       {
         if (e.ajaxData._redirectTarget)
         {
           window.location = e.ajaxData._redirectTarget;
         }

         $('input[name="last_position"]', $form).val(e.ajaxData.lastPosition);
         $('input[name="last_date"]', $form).val(e.ajaxData.lastDate);

         if (submitEnableCallback)
         {
           submitEnableCallback();
         }

         $form.find('input:submit').blur();

         new XenForo.ExtLoader(e.ajaxData, function()
         {
           $(e.ajaxData.templateHtml).each(function()
           {
             if (this.tagName)
             {
               $(this).xfInsert('prependTo', $('#messageList'));
             }
           });
         });

         $('#QuickReply').find('textarea').val('');
         if (window.tinyMCE)
         {
           window.tinyMCE.editors['ctrl_message_html'].setContent('');
         }

         if (window.sessionStorage)
         {
           window.sessionStorage.quickReplyText = null;
         }

         $form.trigger('QuickReplyComplete');

         return false;
       }
     });
   };
}
(jQuery, this, document);

I replaced:
Code:
$("#QuickReply").find("textarea").val("");

with:

var $textarea = $('#QuickReply').find('textarea');
$textarea.val('');
var ed = $textarea.data('XenForo.BbCodeWysiwygEditor');
if (ed)
{
ed.resetEditor();
}

The resulting discussion.js will be:

Code:
/**
 * @author waindigo
 */

/** @param {jQuery} $ jQuery Object */
!function($, window, document, _undefined)
{
   //TODO: Enable jQuery plugin and compressor in editor template.

   /**
    * Enables quick reply for a message form
    * @param $form
    */
   XenForo.QuickReply = function($form)
   {
     if ($('#messageList').length == 0)
     {
       return console.error('Quick Reply not possible for %o, no #messageList found.', $form);
     }

     var submitEnableCallback = XenForo.MultiSubmitFix($form);

     /**
      * Scrolls QuickReply into view and focuses the editor
      */
     this.scrollAndFocus = function()
     {
       $(document).scrollTop($form.offset().top);

       if (window.tinyMCE)
       {
         window.tinyMCE.editors['ctrl_message_html'].focus();
       }
       else
       {
         $('#QuickReply').find('textarea:first').get(0).focus();
       }

       return this;
     };

     $form.data('QuickReply', this).bind(
     {
       /**
        * Fires just before the form would be AJAX submitted,
        * to detect whether or not the 'more options' button was clicked,
        * and to abort AJAX submission if it was.
        *
        * @param event e
        * @return
        */
       AutoValidationBeforeSubmit: function(e)
       {
         if ($(e.clickedSubmitButton).is('input[name="more_options"]'))
         {
           e.preventDefault();
           e.returnValue = true;
         }
       },

       /**
        * Fires after the AutoValidator form has successfully validated the AJAX submission
        *
        * @param event e
        */
       AutoValidationComplete: function(e)
       {
         if (e.ajaxData._redirectTarget)
         {
           window.location = e.ajaxData._redirectTarget;
         }

         $('input[name="last_position"]', $form).val(e.ajaxData.lastPosition);
         $('input[name="last_date"]', $form).val(e.ajaxData.lastDate);

         if (submitEnableCallback)
         {
           submitEnableCallback();
         }

         $form.find('input:submit').blur();

         new XenForo.ExtLoader(e.ajaxData, function()
         {
           $(e.ajaxData.templateHtml).each(function()
           {
             if (this.tagName)
             {
               $(this).xfInsert('prependTo', $('#messageList'));
             }
           });

         });

         var $textarea = $('#QuickReply').find('textarea');
        $textarea.val('');
        var ed = $textarea.data('XenForo.BbCodeWysiwygEditor');
        if (ed)
       {
          ed.resetEditor();
       }

         if (window.tinyMCE)
         {
           window.tinyMCE.editors['ctrl_message_html'].setContent('');
         }

         if (window.sessionStorage)
         {
           window.sessionStorage.quickReplyText = null;
         }

         $form.trigger('QuickReplyComplete');

         return false;
       }
     });
   };
}
(jQuery, this, document);

If you want to minimize the file again, use whatever tools you prefer.
 
This is the minimized discussion.js I used....
Code:
!function(e,t,n,r){XenForo.QuickReply=function(r){if(e("#messageList").length==0){return console.error("Quick Reply not possible for %o, no #messageList found.",r)}var i=XenForo.MultiSubmitFix(r);this.scrollAndFocus=function(){e(n).scrollTop(r.offset().top);if(t.tinyMCE){t.tinyMCE.editors["ctrl_message_html"].focus()}else{e("#QuickReply").find("textarea:first").get(0).focus()}return this};r.data("QuickReply",this).bind({AutoValidationBeforeSubmit:function(t){if(e(t.clickedSubmitButton).is('input[name="more_options"]')){t.preventDefault();t.returnValue=true}},AutoValidationComplete:function(n){if(n.ajaxData._redirectTarget){t.location=n.ajaxData._redirectTarget}e('input[name="last_position"]',r).val(n.ajaxData.lastPosition);e('input[name="last_date"]',r).val(n.ajaxData.lastDate);if(i){i()}r.find("input:submit").blur();new XenForo.ExtLoader(n.ajaxData,function(){e(n.ajaxData.templateHtml).each(function(){if(this.tagName){e(this).xfInsert("prependTo",e("#messageList"))}})});var m=e('#QuickReply').find('textarea');m.val('');var o=m.data('XenForo.BbCodeWysiwygEditor');if (o){o.resetEditor();}if(t.tinyMCE){t.tinyMCE.editors["ctrl_message_html"].setContent("")}if(t.sessionStorage){t.sessionStorage.quickReplyText=null}r.trigger("QuickReplyComplete");$("textarea").val("");return false}})}}(jQuery,this,document)
 
Last edited:
Hi, have there been any instances reported where the details of the person who started a thread is shown as the last person to post in a thread?
 
Top Bottom