Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles

Reply
 
Thread Tools
[How-To] Disable double click on Reply buttons
cbiweb
Join Date: May 2004
Posts: 238

 

Nova Scotia, Canada
Show Printable Version Email this Page Subscription
cbiweb cbiweb is offline 02-09-2010, 10:00 PM

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.
Reply With Quote
  #2  
Old 02-12-2010, 02:43 AM
Switch3130 Switch3130 is offline
 
Join Date: Jun 2006
Location: United States
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Awesome work just what I was looking for.
Reply With Quote
  #3  
Old 02-12-2010, 02:51 AM
Merjawy's Avatar
Merjawy Merjawy is offline
 
Join Date: Sep 2002
Location: USA
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you
Reply With Quote
  #4  
Old 02-13-2010, 12:40 AM
Switch3130 Switch3130 is offline
 
Join Date: Jun 2006
Location: United States
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #5  
Old 02-13-2010, 11:19 AM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Switch3130 View Post
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.
Reply With Quote
  #6  
Old 02-15-2010, 10:51 AM
Switch3130 Switch3130 is offline
 
Join Date: Jun 2006
Location: United States
Posts: 242
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
Reply With Quote
  #7  
Old 02-15-2010, 11:40 AM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #8  
Old 02-21-2010, 10:29 AM
BizAdventure BizAdventure is offline
 
Join Date: Apr 2008
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 02-21-2010, 07:28 PM
cbiweb cbiweb is offline
 
Join Date: May 2004
Location: Nova Scotia, Canada
Posts: 238
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey Biz, we meet again. 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.
Reply With Quote
  #10  
Old 02-22-2010, 01:04 AM
BizAdventure BizAdventure is offline
 
Join Date: Apr 2008
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I will wait patiently, thank you!!!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:57 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05273 seconds
  • Memory Usage 2,289KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete