The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
bbcode font-size semantics
Currently vb uses <font> for bbcode font-size and so I'm trying to replace it with <span>
So far I've edited class_bbcode.php Example (color): PHP Code:
PHP Code:
PHP Code:
PHP Code:
so my question is where can I find where to change "default" font sizes 1 - 7 to say 10 - 20 (px)? |
#2
|
|||
|
|||
Someone asked that question on stackoverflow: http://stackoverflow.com/questions/8...-size-10-to-px . Someone there came up with a conversion to ems.
|
#3
|
|||
|
|||
Thanks but that's not what I mean, converting sizes to Points/Pixels/Ems is the easy part, I'm needing to change how vbulletin converts the members bbcode choice:
PHP Code:
PHP Code:
Code:
html' => '<span style="font-size:1%2$spx;">%1$s</span>, ..but I would still like to know where in vbulletin the font-size function, CSS or whatever is allowing me to choose specifically which font sizes I wish whether it be within a template or php file as I can't find where myself. |
#4
|
|||
|
|||
Oh, OK. I think what you can do is change that code to use a callback like this:
Code:
// [SIZE=XXX] $tag_list['option']['size'] = array( 'callback' => 'handle_bbcode_size', 'option_regex' => '#^[0-9\+\-]+$#', 'strip_empty' => true ); Then write a function called handle_bbcode_size that takes the size number 1-7 as a parameter and returns the replacment html. That way you can write whatever php you want to do the conversion. (Edit: I think the function actually takes two parameters, the text between the tags and the font size number). BTW, I haven't tried it, and looking at the other tags that have a callback I notice none of them have an option_regex so I don't know if that works with a callback or not. |
#5
|
|||
|
|||
Hello... Can you please help me on this? How can i use %2$s and %1$s in the sample function below?
PHP Code:
|
#6
|
|||
|
|||
Can you please say if it is possible or not please?
|
#7
|
|||
|
|||
Well, I never did actually try it, as I mentioned above. But did you make the change to $tag_list that I posted above? It's in includes/class_bbcode.php. And the handle_bbcode_size function should go in there too, somewhere before the final } so that it's part of the class.
|
#8
|
|||
|
|||
PHP Code:
PHP Code:
I enter some text in WYSIWYG text area and select the text, then i pick a size like 5. It changes the font size perfectly. (in the page source code it still says <font*) I click the preview button (in newreply), the page reloads and it still displays font size as "5". I check the page source code both in the preview table cell and WYSIWYG text area and they both display "<span style***" which is correct. I click the preview button once again and this time i notice the text's font size is converted to default size and the size tag is completely removed. Then I opened vbulletin_textedit.js and changed the line below: Code:
option.innerHTML = '<font size="' + sizeoptions[n] + '">' + sizeoptions[n] + '</font>'; Code:
option.innerHTML = '<span style="font-size:' + sizeoptions[n] + '">' + sizeoptions[n] + '</span>'; |
#9
|
|||
|
|||
Oh, right, I forgot about the fact that it has to be able to go back and forth between bbcode and html. There's a file includes/class_wysiwygparser.php that goes from html to bbcode, and it uses the <font> tag instead of the font-size attribute. So you could either change your replacement to use the font tag (which I know isn't the way it's done these days), or else figure out how to change the code in class_wysiwygparser.php. I only glanced at it, but there's a function parse_style_attribute(), and it currently doesn't parse out the font size. You might be able to add a line to the $searchlist array to make it find the font size and insert a size tag for it. Probably something like:
Code:
array('tag' => 'size', 'option' => true, 'regex' => '#font-size:\s*([0-9]+px;?)#i', 'match' => 1) |
#10
|
|||
|
|||
Quote:
--------------- Added 23 Apr 2015 at 15:47 --------------- Btw, my vb version is 3.8.8 and i don't see a file named class_wysiwygparser.php. Maybe it's a vb 4.x file? There is file named functions_wysiwyg.php though. Is this the related section? PHP Code:
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|