Back to vBulletin 3.6 Add-ons

Fix vBulletin JS to work with prototype/scriptaculous
Mod Version: 1.00, by YogiTW

This modification is in the archives.
vB Version: 3.6.4 Rating: (2 votes - 5.00 average) Installs: 11
Released: 12 Feb 2007 Last Update: 12 Feb 2007 Downloads: 166
Not Supported Code Changes  

There is a problem with some of the for loops in vBulletin's javascript (or it's a problem with prototype.js, depends who you talk to )

The problem is vB's use of the for/in loop: for (var i in array_var) { }

When you alter the array prototype, those new values show up as i. For example:

Code:
Array.prototype.wtf = function() { }
var s = new Array("1", "2", "3");
for (var i in s) {
  alert(i);
}
you will get pop ups that say 1, 2, 3, and wtf.

The solution is to add a little line of code in each of these loops to test the typeof on array_var[i] and see if it == 'function'. If so, continue.

I wrote a perl script that will scan all the js files in your client script directory and insert this check.

Unzip the attached zip file and there is a perl script inside. Upload the script to your server and edit the line at the top that read:

Code:
my $dir = "CHANGEME"
set this variable to be the ABSOLUTE path to your clientscript directory. It will create backup files.

Hopefully some will find this helpfull

Download

This modification is archived, downloads are still allowed.

File Type: %1$s fixfor.zip (557 Bytes, 117 downloads)

Similar Mods

Board Optimization Scriptaculous Effects for vBulletin with User Dialogs Modification Graveyard

vblts.ru supports vBulletin®, 2022-2025