PDA

View Full Version : How can I parse Javascript?


idslamyou
02-13-2009, 10:29 PM
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...

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 (https://vborg.vbsupport.ru/showthread.php?t=122942) 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 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

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:
<script type="text/javascript" src="{param}"></script>
You should use it like this:
URL

TigerC10
02-15-2009, 05:14 AM
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 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. text here and url

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...

[javascript="whatever.js"]



The one that Dismounted gave you will let you use it like this
whatever.js

idslamyou
02-15-2009, 03:22 PM
Perfect. Thank you both.