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)

DobieGillis? 02-11-2009 12:16 PM

are people enjoying this mod? Do the users have a choice if they want to use color or not?

bodaudinh 02-11-2009 03:05 PM

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

>> http://mytam.info/forum/member.php?u=50973
https://vborg.vbsupport.ru/external/2009/02/22.jpg

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

n.sinha.p 02-11-2009 03:24 PM

Quote:

Originally Posted by michi123 (Post 1740764)
nice mod dude! how can i change the colors to my liking?

Quote:

Originally Posted by DobieGillis? (Post 1740784)
are people enjoying this mod? Do the users have a choice if they want to use color or not?

Well! In essence this generates random colours.. however you can obviously change the colour selection if you are a pro in javascript. Otherwise if enough people request this, I will come up with a version where you can set your own desired colour! :)

As for whether people are enjoying this or not, it has been just second day that I posted the hack and now it has got 12 installations. Is that bad?? :)

n.sinha.p 02-11-2009 03:34 PM

Quote:

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

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

Hi,

Thanks for this and this is equally good. However, if you talk about performance, which is really a concern for boards, it is about executing 1 function against 4, and in total 27 lines of code against 35. Which one do you think would be faster? :D

bodaudinh 02-11-2009 03:44 PM

In my code, I FIND by Classname (with the key=rainbow), it'll run ONCE time.
Code:

var b = getElementsByClassName(classname);
But in your code, you search by FOR LOOP by TagName with span. How long for ??? Do u thinking abt that ?

Code:

var aspans = document.getElementsByTagName('span');
        for (var i = 0; i < aspans.length; i++)
        {

have 4 functions, It does not run slowly... U can check it again :). Faster ???

DobieGillis? 02-11-2009 03:51 PM

installed, very nice. Let's see what the users think

DobieGillis? 02-11-2009 06:21 PM

uninstalled...it widened the screen for some users, they were not happy.

n.sinha.p 02-11-2009 11:48 PM

Quote:

Originally Posted by DobieGillis? (Post 1741122)
uninstalled...it widened the screen for some users, they were not happy.

Can you upload screenshot so that I can check and try to amend the functionality?

Nadeemjp 02-12-2009 03:24 AM

both codes are very fine. will do them over the week end.

DsmNikki 02-12-2009 05:41 AM

i installed it but its showing my name as undefined??? y is that? what am i doing wrong?


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.01284 seconds
  • Memory Usage 1,740KB
  • 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
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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