Back to vBulletin 3.6 Template Modifications

Multi-Choice background color using Javascript
Mod Version: 1.00, by UKBusinessLive

This modification is in the archives.
vB Version: 3.6.12 Rating: (1 vote - 5.00 average) Installs: 3
Released: 29 Dec 2008 Last Update: 29 Dec 2008 Downloads: 18
Not Supported Template Edits Re-usable Code Translations  

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

This modification is archived, downloads are still allowed.

File Type: %1$s backcolor.zip (394 Bytes, 19 downloads)

Screenshots

Click image for larger version
Name:	page10.png
Views:	20
Size:	147.6 KB
ID:	91383   Click image for larger version
Name:	page11.png
Views:	19
Size:	153.6 KB
ID:	91384   Click image for larger version
Name:	page12.png
Views:	16
Size:	158.3 KB
ID:	91385  

Similar Mods

End-User Options Multi-Choice background color using Javascript vBulletin 3.8 Template Modifications
End-User Options Multi-Choice background color using Javascript vBulletin 3.7 Template Modifications

vblts.ru supports vBulletin®, 2022-2024