-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|761|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Website Development


 
Jayenkai
Created : 24 June 2017
Edited : 24 June 2017

Twitter BBCode



I'm not going to get too indepth, and am just going to plop a test.html's contents here.
If you're working on BBCode for your site, you should be able to work out most of the stuff from the contents of the html.


 

Comments


Saturday, 24 June 2017, 20:25
Pakz
I am not that into html but I do find it a powefull thing.

The code above. Do you need to install a api on your website to use it? I have a website from my isp with no features so I can not install anything or save cookies ect.

And what does this code above do?
Sunday, 25 June 2017, 02:44
Jayenkai
No extra stuff required, the whole thing runs in JavaScript on the user's end.
First the bottom sections happens.
Each of the three <script> lines simply make a request to twitter's server, asking for the contents of "TweetID"
There's a "Callback" parameter, so that when JavaScript gets a response, it knows to jump to that function in the upper script.

The upper script takes the returned file from Twitter.
It searches for the URL, strips out the ID, and uses that to find where the associated <div> is that it should be replacing.

Next it takes the HTML content of the tweet, and strips out the extra script from the end of it, since I can't figure out how to use that, yet!!
It pastes the contents of the tweet, and places it inside the required div.

Job done.