Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Text Fade (Rainbow Faded Text) BBCode Details »»
Text Fade (Rainbow Faded Text) BBCode
Version: 1.00, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.0.x Rating:
Released: 07-14-2010 Last Update: Never Installs: 33
Re-useable Code Additional Files Translations  
No support by the author.

This BB Code produces a rainbow like text fade effect. It uses Javascript to put multiple html font color tags between characters. There are two ways of doing this, the first method uses an external javascript file. In the second post you add the javascript to every page via the header template instead, this may be better if you expect the rainbow text to be called many times on a single page.

Demo: here.

Screen Shot:


Before You Start - See tyteen4a03's post (#18) for additional code changes that will allow you to rainbow color usernames and remove a limitation where you couldn't use double-quotes (").

1. Download the attached textfade.js.txt file, rename it to textfade.js, and upload it to your forums/clientscript folder.

2. Add a new BBCode

Title: Text Fade
BB Code Tag Name: fade
Replacement:
Code:
<script type="text/javascript" src="/forums/clientscript/textfade.js"></script> 
<script>fadeText("{param}");</script>
*Adjust the path to the textfade.js file as necessary. For example if your forum is installed in the web root (www.my-domain.com/) instead of (www.my-domain.com/forums/) then your path would simply be src="/clientscript/textfade.js"

Example: [fade]This code fades text in a rainbow.[/fade]
Description: This uses javascript to make a smooth rainbow effect in text.
Use Option: No
Button Image: (optional)
Remove Tag If Empty: Yes
All Disable Options: Yes except disable word wrapping: No

Limitations:
  • You can not use other bbcode within this bbcode, but you can use it OUTSIDE of this bbcode to change the font style/color/type etc...
  • You can't use smilies within this bbcode.
  • You can't use the double quote (") within this bbcode.

This BB Code was tested on vb4 but should work on all current versions.

Please mark as installed if you use this.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 07-15-2010, 01:00 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Alternate Method- no external file.

1. In Style Manager -> All Style Options edit the headinclude Template for each style
At the bottom add:
Code:
<script type="text/javascript">
function makeHex()
{
  this.length = 16;
     this[1]  = "0";
     this[2]  = "1";
     this[3]  = "2";
     this[4]  = "3";
     this[5]  = "4";
     this[6]  = "5";
     this[7]  = "6";
     this[8]  = "7";
     this[9]  = "8";
     this[10] = "9";
     this[11] = "A";
     this[12] = "B";
     this[13] = "C";
     this[14] = "D";
     this[15] = "E";
     this[16] = "F";
     return this;
}
newHex = new makeHex();

function con2hex (x)
{
     if( x < 17)
          x = 16;
     var top = (x / 16);
     var sub = top + '';
     sub = sub.substring (0, 2);
     top = parseInt (sub, 10);
     var before = newHex[top + 1];
     var bot = x - top * 16;
     if (bot < 1)
        bot = 1;
     sub = bot + '';
     sub = sub.substring (0, 2);
     bot = parseInt (sub, 10);
     var after = newHex[bot + 1];
     var thestring = before + '' + after;
     return thestring;
}

  function fadeText (intext)
{
     intext = intext.substring (0, intext.length);
     colorx = 255;
     z = colorx / intext.length;
     for (var i = 0; i < intext.length; i++)
     {
        colorx = 255 * Math.sin (i / (intext.length / 3));
        colory = con2hex (colorx);
        colorz = z * i;
        colorw = con2hex(colorz);
        k = intext.length;
        j = k - i;
        if(j < 0)
           j = 0;
        coloru = z * j;
        colorv = con2hex(coloru);
        document.write("<font color=\"#" + colorv + colory + colorw + "\">" + intext.substring(i, i + 1) + "</font>")
     }
}
</script>
2.Add a new BBCode

Title: Text Fade
BB Code Tag Name: fade
Replacement:
Code:
<script>fadeText("{param}");</script>
Example: [fade]This code fades text in a rainbow.[/fade]
Note- the example won't work in Admin CP because the standard header is not loaded, but it will work in your forum.

Description: This uses javascript to make a smooth rainbow effect in text.
Use Option: No
Button Image: (optional)
Remove Tag If Empty: Yes
All Disable Options: Yes except disable word wrapping: No

All the same limitations as the original method in the top post apply.
Reply With Quote
  #3  
Old 07-15-2010, 11:24 AM
asj's Avatar
asj asj is offline
 
Join Date: Jul 2006
Posts: 117
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

the problem of the Arabic language ?
Reply With Quote
  #4  
Old 07-15-2010, 01:56 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm sorry I can't try this on other languages, maybe if you can describe the problem you're having? I have marked this to allow 'translations' so if someone who knows what issues might come up with other languages are free to post versions for those other languages.

From the screen shot it appears to be working?
Reply With Quote
  #5  
Old 07-15-2010, 05:40 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you want the rainbow to fade the other direction (VIBGTOR instead of ROYGBIV) then change the line near the bottom from:
Code:
 document.write("<font color=\"#" + colorv + colory + colorw + "\">" + intext.substring(i, i + 1) + "</font>")
to
Code:
 document.write("<font color=\"#" + colorw + colory + colorv + "\">" + intext.substring(i, i + 1) + "</font>")
Reply With Quote
  #6  
Old 07-16-2010, 04:30 AM
whitedd's Avatar
whitedd whitedd is offline
 
Join Date: Jan 2010
Posts: 110
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

...is it posible to make fade text in name of usergroups?...
Reply With Quote
  #7  
Old 07-16-2010, 10:15 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by whitedd View Post
...is it posible to make fade text in name of usergroups?...
A 'search' on this topic revealed this mod:
https://vborg.vbsupport.ru/showthread.php?t=208274

But I've never used it. My guess is if you end up using that mod you could use it to make rainbow bbcode as well... [s]use the same settings as above but don't bother uploading the javascript file here nor putting the javascript in post #2 in the header. Then instead of the replacement text I provided use:[/s]
Code:
<span class="rainbow">{param}</span>
[s]That should do it and save you from installing 2 mods.[/s]

And yes that mod should work on 4.0 too, no reason it wouldn't.

The only 'issue' with that mod is that it isn't a rainbow per say because it doesn't fade from red-to-orange-to-yellow... etc... (ROYGBIV) but I'm sure that won't bother most people.
Reply With Quote
  #8  
Old 07-28-2010, 01:36 AM
Xencored Xencored is offline
 
Join Date: Sep 2008
Location: UK, Scuny
Posts: 1,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Code:
<span class="rainbow">{param}</span>
Dont work the "{param}" is just sitting there doing nothing

anyways nice bbcode thanks installed

also tryed
Code:
<span style='font-weight: bold; color: rainbow;'>   </span>
Without luck
Reply With Quote
  #9  
Old 07-28-2010, 01:46 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ehh.. sorry. Thanks.
Reply With Quote
  #10  
Old 08-08-2010, 05:23 AM
sulasno sulasno is offline
 
Join Date: Feb 2010
Posts: 588
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

do I need special rights to upload the js file to the server ?
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 05:20 AM.


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.08832 seconds
  • Memory Usage 2,307KB
  • 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
  • (8)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (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
  • 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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete