Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 02-13-2009, 10:29 PM
idslamyou idslamyou is offline
 
Join Date: Jan 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How can I parse Javascript?

I want to be able to parse javascript into a post. I have tried to enable HTML for admins, but when I post is just displays the html ,i.e. <script type="text/javascript" src="http://someurlhere.com"></script>
and doesn't get the contents from the javascript. Is there are way to do this?

If not, I also have and XML feed that I can work with, but it is not RSS. Is there a way to parse the XML and have it post into a new thread like the rss feed manager does?
Reply With Quote
  #2  
Old 02-13-2009, 11:34 PM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'll probably want to make a javascript bbCode...

Code:
Title: Javascript
Tag: javascript
Use {option}: Yes
Description:
The [JAVASCRIPT] tag allows you to place javascript in your post.
Replacement:
<script type="text/javascript" src="{option}">{param}</script>

You would want to duplicate this bbCode if you want to allow the use of javascript that's not in a .js file somewhere, but turn off the {option}. At least, the last time I made a bbCode that had an option, if the option wasn't specified the bbCode wasn't parsed.


Finally to top it all off, you'll want to use some Advanced bbCode Permissions to stop anyone else from using the javascript bbCode.
Reply With Quote
  #3  
Old 02-14-2009, 11:24 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You'll definitely want to restrict that BB code down to admins only (if you use it). It could be very dangerous.
Reply With Quote
  #4  
Old 02-14-2009, 07:23 PM
idslamyou idslamyou is offline
 
Join Date: Jan 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the replies. I tried exactly what you said and it doesn't seem to be working. I am using vb 3.6.4. What do i put in between the [javascript] tags? just the url or the whole code, i.e. <script. . . .> I tried both. When I put in the <script> code it doesn't seem to parse, just displays nothing. If I just put the url of the javascript, I just see the text, i.e. [javascript] text here and url[/javascript]

Any insight? I also duplicated the code and took the option out(just the radio button option). Was I supposed to remove the {option} in the bbcode?
The url I am trying to parse is not a .js file.
Reply With Quote
  #5  
Old 02-15-2009, 03:50 AM
Dismounted's Avatar
Dismounted Dismounted is offline
 
Join Date: Jun 2005
Location: Melbourne, Australia
Posts: 15,047
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The replacement should be:
Code:
<script type="text/javascript" src="{param}"></script>
You should use it like this:
Quote:
[javascript]URL[/javascript]
Reply With Quote
  #6  
Old 02-15-2009, 05:14 AM
TigerC10's Avatar
TigerC10 TigerC10 is offline
 
Join Date: Apr 2006
Location: Austin, TX
Posts: 616
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by idslamyou View Post
Thanks for the replies. I tried exactly what you said and it doesn't seem to be working. I am using vb 3.6.4. What do i put in between the [javascript] tags? just the url or the whole code, i.e. <script. . . .> I tried both. When I put in the <script> code it doesn't seem to parse, just displays nothing. If I just put the url of the javascript, I just see the text, i.e. [javascript] text here and url[/javascript]

Any insight? I also duplicated the code and took the option out(just the radio button option). Was I supposed to remove the {option} in the bbcode?
The url I am trying to parse is not a .js file.
The one that I made allows you to use it like so...

Code:
[javascript="whatever.js"][/javascript]


The one that Dismounted gave you will let you use it like this
Code:
[javascript]whatever.js[/javascript]
Reply With Quote
  #7  
Old 02-15-2009, 03:22 PM
idslamyou idslamyou is offline
 
Join Date: Jan 2004
Posts: 27
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Perfect. Thank you both.
Reply With Quote
Reply

Thread Tools
Display Modes

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 05:39 AM.


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.04061 seconds
  • Memory Usage 2,207KB
  • Queries Executed 13 (?)
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
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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_postinfo_query
  • fetch_postinfo
  • 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
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete