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

Reply
 
Thread Tools
Multi-Choice background color using Javascript Details »»
Multi-Choice background color using Javascript
Version: 1.00, by UKBusinessLive UKBusinessLive is offline
Developer Last Online: Feb 2012 Show Printable Version Email this Page

Category: End-User Options - Version: 3.8.0 RC 2 Rating:
Released: 12-28-2008 Last Update: 12-28-2008 Installs: 8
Template Edits
Re-useable Code Translations  
No support by the author.

Multi-Choice background color using Javascript

Just a quickie here to give your members a choice of what color to display for the forum Background.

I quickly bought this together as a result of this request here https://vborg.vbsupport.ru/showthread.php?t=200086

Firstly, you need to save this code as a Javascript so copy it to your notepad and save it as "Backcolor.js"

Code:
function change_it() {
	
  if (document.getElementById && document.createTextNode) {
	  
    var new_color = "";
    var color_sel = document.getElementById("change_bg").value;
	color_sel *= 1;
    
	switch (color_sel) {
      case 0 : window.alert("Please select a color."); return false;
	  case 1 : new_color = "#FFFF00"; break;
      case 2 : new_color = "#3333FF"; break; 
	  case 3 : new_color = "#009900"; break;
	}
    
	document.body.style.backgroundColor= new_color;
    return false;
	
  }
 
}
then you upload the backcolor.js file to same directory as the Web page on which you will use the script (ideally your Forum Root)

Then enter the code below, between the <body> and </body> tags where you want the select box and button to appear, ideally in the footer or header templates

As an example i saved it to the end of my header template, see the pictures

Code:
<form action="#" onsubmit="return change_it();">
<select name="change_bg" id="change_bg">
<option selected="selected" value="0">Select Background</option>
<option value="1">Yellow</option>
<option value="2">Blue</option>
<option value="3">Green</option>
</select> 
<input type="submit" value="Change Color" />
</form>
<script type="text/javascript" src="backcolor.js"></script>
What that will do is give your users a dropdown box with a Change Color button ( for the english spelling please change the above code here <input type="submit" value="Change Color" /> )

i've done this very basic, but you can change the colors in the backcolor.js file just change the case 1, 2 and 3 options with a new hex color #FFFFFF

You need to change the hex values to the colors that you choose for your site, in the javascript file (Hex numbers) and then with the template code (The color names)

You can get a nice selection of hexcolors here http://www.december.com/html/spec/colorsafe.html

This is what you get, Mind you it won't work well on my forum as its fluid, but it'll work well with fixed forums





Remember you can change these colors, I've just done 3 as an example, But you can add as many as you want and with millions of combinations by using a color Hex chart.

Have Fun

Download Now

File Type: zip backcolor.zip (394 Bytes, 60 views)

Screenshots

File Type: png page10.png (147.6 KB, 0 views)
File Type: png page11.png (153.6 KB, 0 views)
File Type: png page12.png (158.3 KB, 0 views)

Show Your Support

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

Comments
  #12  
Old 01-28-2009, 10:05 PM
Fungsten's Avatar
Fungsten Fungsten is offline
 
Join Date: Jul 2006
Posts: 1,131
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Triky View Post
Is there any news, UKBusinessLive?
Same here. VB 3.8.1.

Also I"d like to find out on how to change the "page background".
Reply With Quote
  #13  
Old 05-05-2009, 08:27 PM
rob01 rob01 is offline
 
Join Date: Sep 2008
Location: Mexico
Posts: 410
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

is this stuff still working :S

or there is any other mod for this?.. i remember there was a mod for the colors just like vb.org has
Reply With Quote
  #14  
Old 05-05-2009, 08:57 PM
UKBusinessLive UKBusinessLive is offline
 
Join Date: Sep 2008
Location: Essex, United Kingdom
Posts: 1,637
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rob01 View Post
is this stuff still working :S


or there is any other mod for this?.. i remember there was a mod for the colors just like vb.org has
here it is rob


https://vborg.vbsupport.ru/showthread.php?t=205755
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 02:33 PM.


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.12942 seconds
  • Memory Usage 2,265KB
  • Queries Executed 19 (?)
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
  • (2)bbcode_code
  • (2)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
  • (1)pagenav_pagelink
  • (4)post_thanks_box
  • (4)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (4)post_thanks_postbit_info
  • (3)postbit
  • (4)postbit_attachment
  • (4)postbit_onlinestatus
  • (4)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_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete