Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 General Discussions
FAQ Community Calendar Today's Posts Search

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-28-2012, 12:19 AM
Sarteck's Avatar
Sarteck Sarteck is offline
 
Join Date: Mar 2008
Posts: 304
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Not sure if you wanted something like this, but this is what I've got.

On a fetch_musername hook, I've got a plugin with the following (more or less):

PHP Code:

if (!function_exists('zebra_text')) {function zebra_text($text)
{
  
$ret ''$white true$textlength strlen($text);
  for (
$i=0;$i<$textlength;$i++)
    {
$fgc = ($white)?'#FFFFFF':'#000000'$bgc = (!$white)?'#FFFFFF':'#000000'$white = !$white$ret .= '<span style="color:'.$fgc.';background-color:'.$bgc.'">'.$text[$i].'</span>';}
  return 
$ret;
}}

if (!
function_exists('spastic_rainbow_text')) {function spastic_rainbow_text($text)
{
  
$text str_replace("'","\'",$text); $len 16$base='123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'$max=strlen($base)-1$randstr=''mt_srand((double)microtime()*1000000);
  while (
strlen($randstr)<$len+1) {$randstr .= $base[mt_rand(0,$max)];}
  
$output '
<span id="spastic_rainbow_container_'
.$randstr.'">'.$text.'</span>
<script type="text/javascript">
set_as_spastic(document.getElementById(\'spastic_username_container_'
.$randstr.'\'),\''.$text.'\');
</script>'
;
  return 
$output;
}}

if (!
function_exists('rainbow_text')) {function rainbow_text($text)
{
  
$ret ''$colors = array('ff00ff''ff0099''ff0000''ff9900''ffff00''99ff00''00ff00''00ff99''00ffff''0099ff''0000ff''9900ff'); $i 0;
  
$pattern '/(&[^\s]*;|.)/'preg_match_all($pattern$text$matches); $textarray $matches[1]; $textlength strlen($text);
  while(
$i<=$textlength) {foreach($colors as $value) {if ($textarray[$i] != "") {$ret .= '<span style="color:#'.$value.';">'.$textarray[$i]."</span>";} $i++;}}
  return 
$ret;
}}

if (
$some_condition_about_the_user)
{
  
$user['musername'] = zebra_text($user['username']);
  
/// Could also put the Rainbow or Spastic Rainbow in here.

(Note: For the "Spastic" Rainbow username, which is a moving rainbow, I added the following to my headinclude template
HTML Code:
<script type="text/javascript">
function randint(len) {var chars = "0123456789"; if (!len) {len=8;} var randomstring = ''; for (var i=0; i<len; i++) {var rnum = Math.floor(Math.random() * chars.length); randomstring += chars.substring(rnum,rnum+1);} return randomstring;}

function set_as_spastic(el,name,idstring)
{
  var randid = 0;
  if (idstring) {randid = idstring;} else {randid = Math.floor(Math.random() * 102400);}
  el.id = 'spastic_username_container_' + randid;
  spastic_Timer[randid] = 0;
  spastic_Names[randid] = name;
  if (!idstring) {spastic_index[randid] = 0;}
  spastic_letters[randid] = name.split("");
  spastic_Timers[randid] = setInterval("spastic_username("+randid+")", 50); 
}

var spastic_Names = new Array();
var spastic_Timer = new Array();
var spastic_Timers = new Array();
var spastic_index = new Array();
var spastic_letters = new Array();

function spastic_username(idstring)
{
  var colors = new Array('ff00ff', 'ff0099', 'ff0000', 'ff9900', 'ffff00', '99ff00', '00ff00', '00ff99', '00ffff', '0099ff', '0000ff', '9900ff');
  var bgcolors = new Array('880088', '880033', '880000', '883300', '888800', '338800', '008800', '008833', '008888', '003388', '000088', '330088');
  spastic_index[idstring]++;
  if (spastic_index[idstring] > colors.length-1) {spastic_index[idstring] = 0;}
  var temp_index = spastic_index[idstring];
  var output = '';
  for (var i=0; i<spastic_letters[idstring].length; i++)
  {
    if (temp_index > colors.length-1) {temp_index = 0;}
    output += '<span style="color:#'+colors[temp_index]+';background-color:#'+bgcolors[temp_index]+';">'+spastic_letters[idstring][i]+'</span>'; temp_index++;
  }
  document.getElementById('spastic_username_container_'+idstring).innerHTML = output;
  document.getElementById('spastic_username_container_'+idstring).onmouseover = new Function('pauseSpastic('+idstring+')');
  document.getElementById('spastic_username_container_'+idstring).onmouseout = new Function('unpauseSpastic('+idstring+')');
}

function pauseSpastic(idstring)   {clearInterval(spastic_Timers[idstring]);}
function unpauseSpastic(idstring) {set_as_spastic(document.getElementById('spastic_username_container_' + idstring),spastic_Names[idstring],idstring);}
</script>
Reply With Quote
Благодарность от:
Lynne
 


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 01:08 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.05065 seconds
  • Memory Usage 2,361KB
  • Queries Executed 12 (?)
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
  • (1)bbcode_code
  • (1)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (1)post_thanks_box_bit
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (2)post_thanks_postbit_info
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)postbit_wrapper
  • (1)showthread_list
  • (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_threadedmode.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • 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_threaded
  • showthread_threaded_construct_link
  • 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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete