Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 06-12-2009, 09:14 AM
mme42 mme42 is offline
 
Join Date: Feb 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Limiting bbcode font sizes

I'm looking for a way to limit bbcode font sizes in 3.8.x. I don't want to disable bbcode font size completely. But, I'd like to allow a maximum of size "4." Here's what I've tried so far:
  • Removed the options 5-7 for the editor. But, users can still add the higher sizes manually.
  • Removed (and tried just changing size of) the cases in the vbulletin_textedit.js file
  • Added replacement variables (ex. [SIZE="7"] to [SIZE="4"]
  • Searched vb.org for suggestions or mods (There's nothing for 3.8.x that I can find. There seem to be a couple for 3.0 and earlier but they are in the archive and I can't even download them.)

But, so far, nothing has worked on my test board. Does anybody have a method? Or any ideas as to why what I've tried isn't working?

Thanks
Reply With Quote
  #2  
Old 06-12-2009, 03:57 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I was pretty sure it was in vbulletin_textedit.js. Exactly what did you change in there?

You could always use replacement variables:
Find: <font size="7">
Replace with: <font size="1">

(Punish those that try to go around the system. )
Reply With Quote
  #3  
Old 06-12-2009, 04:55 PM
mme42 mme42 is offline
 
Join Date: Feb 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the textedit.js I tried both changing the font sizes for the 5-7 cases to the size for case 4 and removing cases 5-7 completely. Here is what it's like now (starting at line 2078):

PHP Code:
    /**
            * Translate CSS fontSize to HTML Font Size
            */
            
this.translate_fontsize = function(csssize)
            {
                switch (
csssize)
                {
                    case 
'7.5pt':
                    case 
'10px': return 1;
                    case 
'10pt': return 2;
                    case 
'12pt': return 3;
                    case 
'14pt': return 4;
                    default:     return 
'';
                }
            }

            
/**
            * Apply Format
            */ 

As for replacement variables, I was trying bbcode not html. Maybe that's why it didn't work? I'll try html too.

Thanks
Reply With Quote
  #4  
Old 06-12-2009, 06:15 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to use html in the replacement variables. If you look in the source code, it actually says "<font size="7">"

Maybe in the file, instead of deleting the lines for the various cases, just return 1 and see what happens. ie:

PHP Code:
case"14pt":return 4;
case
"18pt":return 1;
case
"24pt":return 1;
case
"36pt":return 1;
default:return

Reply With Quote
  #5  
Old 06-13-2009, 01:12 PM
mme42 mme42 is offline
 
Join Date: Feb 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

No luck on the textedit.js. But the replacement variable thing worked with html tags instead. Thanks.

Will the replacement variable effect anything else other than the bbcode? Like I used a 7pt or 7px font somewhere in a skin? I haven't noticed anything yet, I'm just wondering for future reference.
Reply With Quote
  #6  
Old 06-13-2009, 02:49 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The replacement variables will effect the entire site. However, I don't know that <font size="7"> (or 6 or 5) is used anywhere else in default vbulletin (try a search in your templates to see), so I think it will only effect your posts. If you are worried about it though, you would write a little plugin that just does a str_replace in the posts for those terms.
Reply With Quote
  #7  
Old 06-13-2009, 03:06 PM
mme42 mme42 is offline
 
Join Date: Feb 2009
Posts: 101
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The replacement variables are fine for now. But that sounds like a nice little project to get my feet wet in coding a plug myself.

Thanks again
Reply With Quote
  #8  
Old 10-14-2012, 08:10 PM
kpmedia's Avatar
kpmedia kpmedia is offline
 
Join Date: Jan 2008
Posts: 136
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I know this is a 3-year bump, but I'm hopefully adding something useful...

I've been needing this for a while myself. Like the OP, I'd tried a number of things, and none quite worked. This thread was helpful (filled in the gaps), but I had to read it several times over, because it didn't make a lot of sense in chronological order. I write a lot of guides, mostly as notes to myself, and I put one together for this: How to Change bbcode font sizes in vBulletin

In addition to simply changing or removing sizes, you can also add some styling with the replacement variables, by inserting divs. I like to add a margin of at least 5-10px before the larger fonts, because they tend to be used as subheadings. I mentioned that in the guide, and I wanted to add it here, too.

I also did not find any font size="7" (4,5,6) tags in templates or in my mods/plugins. However keep that last one in mind -- plugins and mods. Because I do know of some that have size references. I don't think "size=number" is valid HTML, which is why it won't be in any themes.

Thanks, Lynne and mme24.
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:32 AM.


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.04645 seconds
  • Memory Usage 2,227KB
  • 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
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)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