vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   How can I parse Javascript? (https://vborg.vbsupport.ru/showthread.php?t=205290)

idslamyou 02-13-2009 10:29 PM

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?

TigerC10 02-13-2009 11:34 PM

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.

Dismounted 02-14-2009 11:24 AM

You'll definitely want to restrict that BB code down to admins only (if you use it). It could be very dangerous.

idslamyou 02-14-2009 07:23 PM

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.

Dismounted 02-15-2009 03:50 AM

The replacement should be:
Code:

<script type="text/javascript" src="{param}"></script>
You should use it like this:
Quote:

[javascript]URL[/javascript]

TigerC10 02-15-2009 05:14 AM

Quote:

Originally Posted by idslamyou (Post 1744147)
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]

idslamyou 02-15-2009 03:22 PM

Perfect. Thank you both.


All times are GMT. The time now is 10:29 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.01251 seconds
  • Memory Usage 1,727KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete