![]() |
Fix vBulletin JS to work with prototype/scriptaculous
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() { } 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" Hopefully some will find this helpfull :) |
Thank you. Will try this fix soon :)
|
Has the server enable the Pl to do it ?
|
Yeah you need perl, it's run from the command line so you need shell access. I can't upload fixed .js files due to the license
|
[2007-02-20 17:42:52]: error: file is writable by others: (/home/ben225/public_html/fixfor.pl)
[2007-02-20 17:39:47]: error: file is writable by others: (/home/ben225/public_html/forums/clientscript/fixfor.pl) [2007-02-20 17:38:51]: error: file has no execute permission: (/home/ben225/public_html/forums/clientscript/fixfor.pl) [2007-02-20 17:35:11]: error: file has no execute permission: (/home/ben225/public_html/fixfor.pl) [2007-02-20 17:33:44]: error: file has no execute permission: (/home/ben225/public_html/fixfor.pl) Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, webmaster@ben225.hostultra.com and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. I got these errors and am not sure the problem. I have perl 5.8.6 on my paid webhost. Any clue what the prob might be? |
You don't run it over the web, you run it at the command line.
|
for the benefit of everybody, please provide a PHP version of your script, or a list of FIND/REPLACE so everybody can handle this modification as it is supposed to be...
most of the users here have no idea how to handle that kind of script... |
It appears that this misses a few instances - inlinemod.js, vbulletin_ajax_namesugg.js, vbulletin_multi_quote.js, and vbulletin_thrdpostlist.js.
I simply changed "for (i in var)" to "for (i=0; i< var.length;i++) I'll report back if it doesn't work momentarily. Edit... This seems to be the fix for vbulletin_inline_mod.js - I haven't tested the others quite yet. |
Quote:
|
I attached a modified version of the script that also replaces those missed for's
Quick hack, but it worked for me... Btw this is not only for Prototype users, Mootools also works fine after this fix.. and probably other libraries too. |
All times are GMT. The time now is 02:41 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|