[TW5] Loading and displaying Embedded Tweets correctly

108 views
Skip to first unread message

Tully Hansen

unread,
Jul 12, 2014, 2:34:52 AM7/12/14
to tiddl...@googlegroups.com
Hi all, long-time Tiddlylurker, first time poster with what I think is a pretty straightforward question that I hope the community might help with… I'm more tinkerer than developer, and I've been trying to get embedded Tweets and Twitter profiles to display properly formatted within individual Tiddlers, using vanilla TW 5.0.13 and Twitter's embed code:

<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

Apologies for not better documenting my attempts to date, but I note that if I try taking the embed quote from an individual Tweet and copying this into a Tiddler, it appears that the <script> tags are being converted to <safe-script> and not functioning - changing these tags back by live-editing page source in Safari Web Inspector works almost as expected (excessive whitespace shown at base of tweet, but I can live with this).

I've also been able to manually insert the code quoted above at the end of (I think) the boot shadow Tiddler, and have tweets display as anticipated on first open, but not subsequent opening of Tiddlers.

I've lastly attempted (per a combination of the info here and here) to setup the above as a macro and have it called and loaded with every ViewTemplate, but I have next to no Javascript knowledge and can't tell if I'm merely missing a brace or attempting something impossible.

Any suggestions greatly appreciated! Thanks.

BJ

unread,
Jul 12, 2014, 9:49:39 AM7/12/14
to tiddl...@googlegroups.com
Hi Tully,
the "embed code" only works with static html pages it is not compatible with tiddlywiki. One possibility is to rap tweets in a text/html type block within a tiddler:

$$$text/html

tweet

$$$

however this will put it in an iframe which may not  be what you want.

really a "Tweet" widget  (or a 'raw' html widget) needs to be written

cheers

BJ

Tully Hansen

unread,
Jul 13, 2014, 10:04:50 PM7/13/14
to tiddl...@googlegroups.com
Thanks BJ – your answer is close enough to desired functionality (for now), though the iframe is somewhat oversize for a single tweet… not sure there's any solution to this. I'll keep tinkering… thanks again.

SteveSchneider DesignWriteX

unread,
Jul 29, 2016, 2:59:08 PM7/29/16
to TiddlyWiki
Hello all, has anyone perfected embedding a single tweet? What is the current state-of-the-art?

Thanks,

//steve.
Reply all
Reply to author
Forward
0 new messages