HTML to BBCode JavaScript Help

Здраво

Client
Регистрация
11.07.2011
Сообщения
99
Благодарностей
45
Баллы
18
I'm trying to figure out how to make this but with no luck so far, I'm not that good with JS anyway.

Basically it should work like this http://www.seabreezecomputers.com/html2bbcode/ you just insert your html links and it auto convert it to bb code. At the moment I'm doing this with macro replace, but it require to many steps, I figure it would be better to do it in only one step. I would really appreciate someone good with JS to look at in the script provided at that page and convert it to fit JS in Zenno Poster all community would benefit of this, I'm sure of it.

THanks
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
Why don't you just use this form?)
Paste code there and convert :huh:
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
Yeah, looks quite simple to automate without JS
 

Здраво

Client
Регистрация
11.07.2011
Сообщения
99
Благодарностей
45
Баллы
18
you guys are joking right?

2012-08-09_1636.png

Not to mention its equal amount of steps require to use that web site vs use replace. Using JS withing ZP its one step, and no need for calling third party resource. Thanks for trying to help though!
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
Simplicity and result.
Are the only things I care when I create projects :-)
I don't mind about count of steps personally :-)
I care about the time I spend on recording them)

We are all different :-)
 

archel

Client
Регистрация
02.05.2011
Сообщения
175
Благодарностей
22
Баллы
18
Dunno if this is what you mean, but if so...it shouldn't be difficult, even when you don't know js that good.
You only have to use the replace function...

HTML:
var html='<a href="http://www.test.com">test</a>';
var convert1=html.replace('<a href="','[url=');
var convert2=convert1.replace('">',']');
var bbcode=convert2.replace('</a>','[/url]');
The reason I would use JS instead of the form on that site, is that otherwise your backlinking template would be dependent on that conversion site to be online. Depending on a third party can be simple, but the result is not guaranteed.
 

Здраво

Client
Регистрация
11.07.2011
Сообщения
99
Благодарностей
45
Баллы
18
That's exactly what I was looking for, thanks you man you're awesome!
Dunno if this is what you mean, but if so...it shouldn't be difficult, even when you don't know js that good.
You only have to use the replace function...

HTML:
var html='<a href="http://www.test.com">test</a>';
var convert1=html.replace('<a href="','[url=');
var convert2=convert1.replace('">',']');
var bbcode=convert2.replace('</a>','[/url]');
The reason I would use JS instead of the form on that site, is that otherwise your backlinking template would be dependent on that conversion site to be online. Depending on a third party can be simple, but the result is not guaranteed.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)