Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.6 > vBulletin 3.6 Add-ons

Reply
 
Thread Tools
Fix vBulletin JS to work with prototype/scriptaculous Details »»
Fix vBulletin JS to work with prototype/scriptaculous
Version: 1.00, by YogiTW YogiTW is offline
Developer Last Online: Dec 2011 Show Printable Version Email this Page

Category: Integration with vBulletin - Version: 3.6.4 Rating:
Released: 02-11-2007 Last Update: 02-11-2007 Installs: 11
Code Changes  
No support by the author.

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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 02-12-2007, 02:12 PM
MaTraX MaTraX is offline
 
Join Date: Jan 2005
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you. Will try this fix soon
Reply With Quote
  #3  
Old 02-12-2007, 07:05 PM
HOST-KSA.COM HOST-KSA.COM is offline
 
Join Date: Jul 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Has the server enable the Pl to do it ?
Reply With Quote
  #4  
Old 02-12-2007, 11:24 PM
YogiTW YogiTW is offline
 
Join Date: Jan 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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 02-20-2007, 03:45 PM
SimplyBen SimplyBen is offline
 
Join Date: Aug 2006
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

[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 02-22-2007, 08:02 PM
YogiTW YogiTW is offline
 
Join Date: Jan 2004
Posts: 11
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You don't run it over the web, you run it at the command line.
Reply With Quote
  #7  
Old 02-22-2007, 08:41 PM
nexialys
Guest
 
Posts: n/a
Default

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 03-01-2007, 07:53 AM
nevetS nevetS is offline
 
Join Date: May 2005
Location: Sunny California
Posts: 97
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #9  
Old 04-19-2007, 03:33 AM
RoughJunk RoughJunk is offline
 
Join Date: Jul 2006
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
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 05-16-2007, 10:08 AM
ROTPAR ROTPAR is offline
 
Join Date: May 2004
Posts: 140
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply

Thread Tools

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

Forum Jump


All times are GMT. The time now is 03:02 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
  • Page Generation 0.04439 seconds
  • Memory Usage 2,286KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete