vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [How-To] Disable double click on Reply buttons (https://vborg.vbsupport.ru/showthread.php?t=235535)

cbiweb 02-09-2010 10:00 PM

[How-To] Disable double click on Reply buttons
 
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.

Switch3130 02-12-2010 02:43 AM

Awesome work just what I was looking for.

Merjawy 02-12-2010 02:51 AM

Thank you

Switch3130 02-13-2010 12:40 AM

Would you mind sending me over the .js file with the updated changes? I tried making the changes and things didn't seem right.

Also when I searched for this "YAHOO.util.Event.on(anchors[i]" in the file to make the changes it wasn't found.

What is going on?

cbiweb 02-13-2010 11:19 AM

Quote:

Originally Posted by Switch3130 (Post 1981116)
when I searched for this "YAHOO.util.Event.on(anchors[i]" in the file to make the changes it wasn't found.

What is going on?

The code is there, but if you downloaded the compressed version of the file it looks slightly different. You need to search for these two strings:
Code:

{YAHOO.util.Event.on(C[b],"click",qr_newreply_activate,this)}
and
Code:

YAHOO.util.Event.on(A,"click",qr_replytothread_activate,this)
Comment them per my first post. Depending what result you want will determine which one(s) you comment out. (Yes, the first one has a curly brace but the second one does not. :) ) If it doesn't work for you, try adding a space before the comment lines, which worked for boatswife in post #11 below.

I only found out about the compressed version after I wrote the article, or I would've included it then. :)

Switch3130 02-15-2010 10:51 AM

After I made those changes I get errors on the thread page:

missing } in compound statement
[Break on this error] _tbody","hidden");vB_Editor[QR_EditorI...;return false}}var vB_QuickReply=true;

cbiweb 02-15-2010 11:40 AM

That is strange. I've done it with the compressed and non-compressed versions of the file with no problems. Try again because it would be easy to make a mistake with the compressed file, being that it's all mushed together. PM me if you have further problems. :)

BizAdventure 02-21-2010 10:29 AM

I am curious if you got this working on 4.0.2 - I cannot find that information in that file - I find similarities, but not what is above.

I can paste the code, but it's awfully long.

cbiweb 02-21-2010 07:28 PM

Hey Biz, we meet again. :D As you know, I'm in the middle of reinstalling everything onto a new HD today, so I can't access my vBulletin projects to check on this for 4.0.2. But soon as I'm able, I will.

BizAdventure 02-22-2010 01:04 AM

I will wait patiently, thank you!!!


All times are GMT. The time now is 02:35 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01203 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete