PDA

View Full Version : Mini Mods - Random logo!


MarkFoster
04-05-2009, 10:00 PM
This mod I created with a friend for a small project on my site, it's a remake of This mod (https://vborg.vbsupport.ru/showthread.php?t=99402) but we created it ourselves.
It works with vBulletin 3.5 up to 3.8.2 from what I know, it probably works with older versions as well.
This allows you to have random logo's anywhere on your site.

First you place this code anywhere in your header (Top is a good place):
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin Random Logo In Header Script

var theImages = new Array() // do not change this

<!-- Edit the url images to match yours
theImages[0] = 'url'
theImages[1] = 'url'



var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<div align="center"><img src="'+theImages[whichImage]+'" border="0" alt="$vboptions[bbtitle]" /></a></div>');
}

// End -->
</script>
You edit the urls to what images you want.
Now if you have large images (The reason we created this mod) then use this code:
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin Random Logo In Header Script

var theImages = new Array() // do not change this

<!-- Edit the url images to match yours
<!-- Edit the url images to match yours
theImages[0] = 'URL'
theImages[1] = 'URL'
theImages[2] = 'URL'
theImages[3] = 'URL'
theImages[4] = 'URL'
theImages[5] = 'URL'
theImages[6] = 'URL'
theImages[7] = 'URL'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-5));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'" border="0" alt="$vboptions[bbtitle]" /></a><img src="'+theImages[whichImage+4]+'" border="0" alt="$vboptions[bbtitle]" /></a></div>');
}

// End -->
</script>

In the url part 0-3 is for the image that will go on the left side and 4-7 is for the image that will go right, they will both be centered thought.

Then wherever you want the images to display add this:
<SCRIPT LANGUAGE="JavaScript">
showImage();
</script>

Then you can additionally add new links to the codes by adding a new line with the same information, you only have to change the number name.

ahmed-samara
04-06-2009, 11:27 AM
first one :)

great work man installed

Jasem
04-06-2009, 01:06 PM
Nice work, thank you!

Installed

John Henry
04-28-2009, 11:22 AM
plz, plz... make something like that but in php... there are addons for browsers that block js and so the images won't change...

simurgs
10-02-2009, 11:05 PM
Hello,

Nice work, how can i add links to the images ?

ZEHH
11-19-2009, 12:03 AM
simurgs,

Acho que se deve adicionar a url de suas imagens aqui:

theImages [0] = 'URL'
theImages [1] = 'URL'