Back to vBulletin 4 Articles

[How-To] Disable double click on Reply buttons
by cbiweb 10 Feb 2010
Rating: (1 vote - 5.00 average)

This article discusses code modifications made directly in the files, and will need to be done each time you upgrade vBulletin. If possible I will write a plugin when I get a chance, and this note and article will become irrelevant.

[How-To] Disable Double-Click On Reply Buttons

A lot of people agree that the new double-click functionality for the "Reply With Quote" and "+ Reply to Thread" buttons is not user friendly, and not a standard behavior for buttons on a web page. The biggest complaint is having to click twice to get to the regular Advanced editor.

It doesn't appear that the developers are going to change this soon, if ever, so until they do I went digging for a solution to bring back the familiar and very user friendly single-click action for these buttons.

Go to your clientscript folder, and open the vbulletin_quick_reply.js file. Look for this section of code:
Code:
function qr_init_buttons(obj)
{
    // intercept post button clicks to use inline form
    var anchors = fetch_tags(obj, 'a');
    for (var i = 0; i < anchors.length; i++)
    {
        // reply button
        if (anchors[i].id && (anchors[i].id.substr(0, 3) == 'qr_' || anchors[i].id.substr(0, 5) == 'qrwq_'))
        {
            YAHOO.util.Event.on(anchors[i], "click", qr_newreply_activate, this);
            //anchors[i].onclick = function(e) { return qr_newreply_activate(this.id.substr(3), false); };
        }
    }
    // set the "+Reply to Thread" buttons onlclick events
    var replytothreadids = ["newreplylink_top", "newreplylink_bottom"];
    YAHOO.util.Event.on(replytothreadids, "click", qr_replytothread_activate, this);
    //YAHOO.util.Event.on(replytothreadids, "dblclick", function(e) { window.location = this.href; }, this);
}
In that section, comment out two of the lines as shown below. All you need to do is add the forward slashes that I've highlighted in red and blue:
Code:
function qr_init_buttons(obj)
{
    // intercept post button clicks to use inline form
    var anchors = fetch_tags(obj, 'a');
    for (var i = 0; i < anchors.length; i++)
    {
        // reply button
        if (anchors[i].id && (anchors[i].id.substr(0, 3) == 'qr_' || anchors[i].id.substr(0, 5) == 'qrwq_'))
        {
            //YAHOO.util.Event.on(anchors[i], "click", qr_newreply_activate, this);
            //anchors[i].onclick = function(e) { return qr_newreply_activate(this.id.substr(3), false); };
        }
    }
    // set the "+Reply to Thread" buttons onlclick events
    var replytothreadids = ["newreplylink_top", "newreplylink_bottom"];
    //YAHOO.util.Event.on(replytothreadids, "click", qr_replytothread_activate, this);
    //YAHOO.util.Event.on(replytothreadids, "dblclick", function(e) { window.location = this.href; }, this);
}
The red commented line reverts the "Reply With Quote" button back to a single click, and takes you directly to the regular Advanced editor with the quoted post included. Note: Commenting out this line will also disable the regular "Reply" button from opening Quick Reply.

The blue commented line reverts the "+ Reply to Thread" buttons back to single click, which takes you directly to the Advanced editor.

One more thing, Multi-quote behavior depends on which line(s) you comment out.

If you ever want to use the default double-click behavior for either button, simply remove the two forward slashes that you added. And remember, until I create the plugin/product, you will need to make this change each time you upgrade your forums.

vblts.ru supports vBulletin®, 2022-2024