![]() |
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. |
Mootools uses prototype =)
Thank you so much for this. You might consider releasing some diff patches instead? Perhaps with a patcher application. Using a patcher app you could make it so anyone can patch their clientscripts just by downloading them, run the patch, upload them. All fixed =) |
Can FIND/REPLACE instructions or a PHP version (if that's possible) please be made? Not everyone has command line access.
I would really like to add some nice effects to my boards, but now I'm currently limited to what pages I can use the Mootools JS on. |
I'm really stuck on this too, could you explain a little about what the script does pleaseand I'll do it manually?
Thankyou :) |
Hi, i'd really like to be able to use this, but i do not know how to run the script via perl shell. Please provide a php version of this?
|
For in is not the only incompatibility between vb and prototype, just the most noticeable. I'm about 1/3 of the way through the only truly workable approach to this problem - replacing the stock javascript entirely, and with it most of the vb templates that are laced to the gills with javascript calls.
For in also appears in a couple of templates - which this will not correct. (I don't remember which ones off hand but remember seeing them). |
We ran this patch in an attempt to fix an issue with using Script.aculo.us (and Prototype). This fixed an issue with bad entries in Fonts and Sizes dropdown which occurred in FireFox.
But we still have an issue with problems switching to Standard Editor and problems Cancelling and Saving in QuickEdit... Problem only seems to occur in IE (both 6 and 7). FireFox appears to be working fine now. Any idea why FireFox 2 would be working but IE6 and IE7 is not working? |
Has anyone managed to get this working on 3.7, as neither script seems to work on it :(
|
Doesn't seem to work... I'd be willing to pay if somebody could find a solution.
|
the only ajax api compatible to the rest is jQuery... i testet it on vb 3.7.0... it works and doesn't ++++ up the vbulletin scripts using YUI. ;) the problematic issue here is namespaces and jquery got its own. the rest is using the same and this is whats killing your scripts.
use jQuery and your stuff runs fine... :cool: |
3.7 they changed and made this edit I see you guys doing if I am mistaken let me know. But there is still issue with IE6 and IE7. Please I need this fixes asap as a portion of my mod requires prototype.
|
AWESOME...thanks...that worked great! Much oblidged!
|
All times are GMT. The time now is 05:50 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:
|