Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Fix vBulletin JS to work with prototype/scriptaculous Details »
Fix vBulletin JS to work with prototype/scriptaculous
Mod Version: 1.00, by YogiTW (Member) YogiTW is offline
Developer Last Online: Dec 2011 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.6.4 Rating: (2 votes - 5.00 average) Installs: 10
Released: 12 Feb 2007 Last Update: 12 Feb 2007 Downloads: 156
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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

set this variable to be the ABSOLUTE path to your clientscript directory. It will create backup files.

Hopefully some will find this helpfull

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Similar Mod
Mod Developer Type Replies Last Post
Board Optimization Scriptaculous Effects for vBulletin with User Dialogs Michael Morris Modification Graveyard 51 10 Mar 2007 18:36

Comments
  #2  
Old 12 Feb 2007, 16:12
MaTraX MaTraX is offline
 
Join Date: Jan 2005
Thank you. Will try this fix soon
__________________
CEO of MaTraX.NETwork | Member of Polish vBulletin.pl
vB forum: http://www.matrax.net/forum
Reply With Quote
  #3  
Old 12 Feb 2007, 21:05
HOST-KSA.COM HOST-KSA.COM is offline
 
Join Date: Jul 2006
Has the server enable the Pl to do it ?
Reply With Quote
  #4  
Old 13 Feb 2007, 01:24
YogiTW YogiTW is offline
 
Join Date: Jan 2004
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
Reply With Quote
  #5  
Old 20 Feb 2007, 17:45
SimplyBen's Avatar
SimplyBen SimplyBen is offline
 
Join Date: Aug 2006
[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?
Reply With Quote
  #6  
Old 22 Feb 2007, 22:02
YogiTW YogiTW is offline
 
Join Date: Jan 2004
You don't run it over the web, you run it at the command line.
Reply With Quote
  #7  
Old 22 Feb 2007, 22:41
nexialys
Guest
 
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...
Reply With Quote
  #8  
Old 01 Mar 2007, 09:53
nevetS nevetS is offline
 
Join Date: Jun 2005
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.

Last edited by nevetS; 01 Mar 2007 at 10:12.
Reply With Quote
  #9  
Old 19 Apr 2007, 05:33
RoughJunk RoughJunk is offline
 
Join Date: Jul 2006
Originally Posted by nevetS View Post
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.
did you test the other ones?
Reply With Quote
  #10  
Old 16 May 2007, 12:08
ROTPAR ROTPAR is offline
 
Join Date: May 2004
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.
Attached Files
File Type: zip fixfor.zip (629 Bytes, 54 views)
Reply With Quote
  #11  
Old 22 May 2007, 12:06
liquidx liquidx is offline
 
Join Date: Nov 2002
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 =)
__________________
- LiQUiD_X -
Reply With Quote
  #12  
Old 20 Jul 2007, 05:22
TheMilkCarton TheMilkCarton is offline
 
Join Date: Jan 2007
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.
Reply With Quote
  #13  
Old 16 Oct 2007, 14:50
Ian Cunningham Ian Cunningham is offline
 
Join Date: Feb 2002
I'm really stuck on this too, could you explain a little about what the script does pleaseand I'll do it manually?

Thankyou
Reply With Quote
  #14  
Old 25 Oct 2007, 12:07
Ventrixius Ventrixius is offline
 
Join Date: Jul 2007
Real name: Jo
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?
Reply With Quote
  #15  
Old 29 Oct 2007, 06:59
Michael Morris's Avatar
Michael Morris Michael Morris is offline
 
Join Date: Nov 2003
Real name: Michael Morris
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).
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 18:56.

Layout Options | Width: Wide Color: