Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-04-2008, 09:41 AM
Antyrael Antyrael is offline
 
Join Date: Apr 2002
Location: Netherlands
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Custom CTRL codes in edit-/reply box

Hello, I was wondering if anyone could help me with adding my own custom CTRL-X key press while editing or (quick) replying.

For example, when I'm typing a message, hitting CTRL-B will put [b][ /b] around the cursor, or around the selected text.

I'm using a hack that shows tooltip links for World of Warcraft items, and this requires people to put the item names between [item][ /item] tags.

What I want to do, is add a keypress, similar to CTRL-B, that instantly prints [item][ /item] on the cursor or around the selected text.

I would really appreciate it, because I also hope it will give me a little better understanding of how this works.
I have been digging through some files, but unfortunately I'm not that familiar with Javascripting so I'm stuck real fast...
Reply With Quote
  #2  
Old 04-22-2008, 08:23 PM
Antyrael Antyrael is offline
 
Join Date: Apr 2002
Location: Netherlands
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No one has any idea? that's too bad
Reply With Quote
  #3  
Old 04-23-2008, 10:57 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Have you tried the vbulletin_textedit.js file? There is a function or whatever they call it in javascript: [minicode]vB_Text_Editor_Events.prototype.editdoc_onkeypress = function(e)[/minicode] (Search for that).

You might be able to mess around with that and follow it through. How to edit it exactly I don't know.

P.S. Don't forget the Ctrl+X combination is used for "Cutting" so you should use another key instead of X.
Reply With Quote
  #4  
Old 04-23-2008, 11:37 AM
Antyrael Antyrael is offline
 
Join Date: Apr 2002
Location: Netherlands
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for pointing me in the right direction, I figured it out!

For those who are interested, here's what I did:

In vbulletin_textedit.js

- Added the line
Code:
case 'q': cmd = 'itemlink'; break;
Right after this:
Code:
case 'b': cmd = 'bold'; break;
case 'i': cmd = 'italic'; break;
case 'u': cmd = 'underline'; break;
- Added the following code
Code:
case 'itemlink':
{
  this.wrap_tags('item', false);
  return;
}
Right after this:
Code:
case 'bold':
case 'italic':
case 'underline':
{
  this.wrap_tags(cmd.substr(0, 1), false);
  return;
}
That's all there is to it, when I press CTRL-q it works as intended, pretty simple after all
Only had to find a non-functioning CTRL- key combination, as most are shortcuts for the browser.
Reply With Quote
  #5  
Old 04-23-2008, 12:01 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was suspecting it would be something simple like that

Glad you got it working.
Reply With Quote
  #6  
Old 05-13-2008, 03:46 PM
Antyrael Antyrael is offline
 
Join Date: Apr 2002
Location: Netherlands
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well, with vBulletin 3.7 this solution is no longer viable.

The file vbulletin_textedit.js is just one big line of text and it appears they changed the scripting as well.
I'm going to try to fix it anyway, if anyone's interested I'll post my solution here (if I find it!).

Edit: I was able to fix it, quite easily actually, it's just a b*tch to document because there are no line numbers to go by ...
Reply With Quote
  #7  
Old 05-13-2008, 04:50 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You should be able to download a zip file containing the uncompressed Javascript files, edit this script and upload it to your server instead of the compressed one.
Reply With Quote
Reply


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 04:13 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.03590 seconds
  • Memory Usage 2,215KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete