vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Limiting bbcode font sizes (https://vborg.vbsupport.ru/showthread.php?t=215985)

mme42 06-12-2009 08:14 AM

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 :D

Lynne 06-12-2009 02:57 PM

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. :D )

mme42 06-12-2009 03:55 PM

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 :D

Lynne 06-12-2009 05:15 PM

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



mme42 06-13-2009 12:12 PM

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

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.

Lynne 06-13-2009 01:49 PM

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.

mme42 06-13-2009 02:06 PM

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 :D

kpmedia 10-14-2012 07:10 PM

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. :)


All times are GMT. The time now is 12:32 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.01531 seconds
  • Memory Usage 1,741KB
  • 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
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete