vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.8 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=235)
-   -   Forum Display Enhancements - Rainbow (Multicolour) Username for Usergroups (https://vborg.vbsupport.ru/showthread.php?t=204838)

dai-kun 02-12-2009 07:11 AM

Quote:

Originally Posted by bodaudinh (Post 1740939)
Replace this code for rainbow.js. ^^ It'll be cool...

Code:

/**
Rainbow Text
**/
function RGB2Color(r,g,b)
{
  return '#' + byte2Hex(r) + byte2Hex(g) + byte2Hex(b);
}

function byte2Hex(n)
{
  var nybHexString = "0123456789ABCDEF";
  return String(nybHexString.substr((n >> 4) & 0x0F,1)) + nybHexString.substr(n & 0x0F,1);
}


function colorText(str,phase)
{
        var result="";
  if (phase == undefined)
    phase = 0;
  center = 128;
  width = 127;
  frequency = Math.PI*2/str.length;
  for (var i = 0; i < str.length; ++i)
  {
    red  = Math.sin(frequency*i+2+phase) * width + center;
    green = Math.sin(frequency*i+0+phase) * width + center;
    blue  = Math.sin(frequency*i+4+phase) * width + center;
    result += ( '<font color="' + RGB2Color(red,green,blue) + '">' + str.substr(i,1) + '</font>');
  }
  return result;
}

function nickmausac(classname){
var txtValue = "";
        var b = getElementsByClassName(classname);

    for ( var i = 0; i < b.length; i++ ) {
                txtValue = colorText(b[i].innerHTML,1);
        b[i].innerHTML = txtValue;
    }
}

Use same as this mod...
Code:

<span class="rainbow">
add to footer//
Code:

<!-- rainbow text initialize -->
<script type="text/javascript">
<!--
nickmausac('rainbow');
//  End -->
</script>
<!-- rainbow text end -->

I have same as ideas by my sister, she asked me take her nickname has rainbow color... ^^




Does not work ... I did your edits.



You forgot to include

Code:

function getElementsByClassName(classname, node) {

        if(!node) node = document.getElementsByTagName("body")[0];
                var a = [];
                var re = new RegExp('\\b' + classname + '\\b');
                var els = node.getElementsByTagName("*");
                for(var i=0,j=els.length; i<j; i++)
                        if(re.test(els[i].className)) a.push(els[i]);
        return a;
}

in your js file.

The rainbow color does not appear until everything on the page has been loaded..

bodaudinh 02-12-2009 11:30 AM

Quote:

Originally Posted by dai-kun (Post 1741586)
Does not work ... I did your edits.

You forgot to include

Code:

function getElementsByClassName(classname, node) {

        if(!node) node = document.getElementsByTagName("body")[0];
                var a = [];
                var re = new RegExp('\\b' + classname + '\\b');
                var els = node.getElementsByTagName("*");
                for(var i=0,j=els.length; i<j; i++)
                        if(re.test(els[i].className)) a.push(els[i]);
        return a;
}

in your js file.

The rainbow color does not appear until everything on the page has been loaded..


vbb using YUI, this function has been included.
http://yui.yahooapis.com/2.6.0/build...event.js?v=381

n.sinha.p 02-12-2009 12:16 PM

Quote:

Originally Posted by DsmNikki (Post 1741528)
i installed it but its showing my name as undefined??? y is that? what am i doing wrong?

Is your name showing otherwise? What is the markup for your usergroup? Can you post screenshots?

y2krazy 02-13-2009 06:51 PM

Ok, installed, but the names for the specific usergroup I'm applying this to shows up as "undefined" for each letter in the usergroup name and the actual member's name. The colors show up fine, so what would cause the letters to show up as "undefined"? Example:

"Administrators" turns into....

"undefinedundefinedundefinedundefinedundefinedunde finedundefinedundefinedundefinedundefinedundefined undefinedundefinedundefined"

Very frustrating! Any help? Thanks.

EDIT: I think it might be clashing with this addon:

https://vborg.vbsupport.ru/showthread.php?t=201385

~ Sean

n.sinha.p 02-14-2009 06:23 AM

Quote:

Originally Posted by y2krazy (Post 1743163)
Ok, installed, but the names for the specific usergroup I'm applying this to shows up as "undefined" for each letter in the usergroup name and the actual member's name. The colors show up fine, so what would cause the letters to show up as "undefined"? Example:

"Administrators" turns into....

"undefinedundefinedundefinedundefinedundefinedunde finedundefinedundefinedundefinedundefinedundefined undefinedundefinedundefined"

Very frustrating! Any help? Thanks.

EDIT: I think it might be clashing with this addon:

https://vborg.vbsupport.ru/showthread.php?t=201385

~ Sean

Ok! This means the mod is not able to handle the names when embedded by multiple random span tags. Let me install the mod and see if I can come up with an enhancement to overcome this.

Thanks for letting me know.

SuperTaz 02-14-2009 06:42 AM

I have the undefined problem too.

Mecho 02-15-2009 09:40 PM

nice , is it possible to have certain colors in this random things as some of the colors would be not really readable in some styles ( dark / white ones ) ?

thanks

michi123 02-16-2009 10:16 AM

sumbody on my site got undefindet (in colors) aswell, and sumbody not! so i think it depense on their java version!

n.sinha.p 02-20-2009 04:29 AM

Quote:

Originally Posted by Mecho (Post 1745329)
nice , is it possible to have certain colors in this random things as some of the colors would be not really readable in some styles ( dark / white ones ) ?

thanks

Thanks for your feedback.

It is quite possible and very soon I will be uploading the enhancement.

aakhan136 02-20-2009 06:56 PM

thanks


All times are GMT. The time now is 04:30 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.01209 seconds
  • Memory Usage 1,749KB
  • 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
  • (5)bbcode_code_printable
  • (5)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete