Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-30-2010, 03:33 PM   PM User | #1
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,604
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
JavaScript twitter widget: how to format tweet source text?

OK, this is the first time I have to set up a customized twitter widget on a website and I’ve found a couple of JavaScript/jQuery plugins, one of which I’m using and have got running fine except one thing: When I want to return the tweet source it returns an anchor with the text of the source inside but it returns the anchor as literal string, i. e. instead of “about 19 hours ago from TweetDeck” I get “about 19 hours ago from <a href="http://www.tweetdeck.com/" rel="nofollow">TweetDeck</a>”. How do I remove that anchor completely, only showing the text? Or if that ain’t possible, how to I convert the &lt; and &gt; entities in which the tag brackets are encoded back to actual <> characters so the link is parsed and not displayed as text? I’ve searched for hours but didn’t find anything helpful so far. And the twitter API hasn’t been of any help for me.

Edit: Ah well, I ended up with two nasty replace functions using regular expressions (after playing around in trial and error manner) like this.source.replace(/.+&quot;&gt;/,'').replace(/&lt;\/.&gt;/,''); to remove the anchor stuff and only show the source name. I’m not feeling too good with it but it seems to work.
__________________
Don’t click this link!

Last edited by VIPStephan; 03-30-2010 at 05:14 PM..
VIPStephan is offline   Reply With Quote
Reply

Bookmarks

Tags
encode, format, tweet source, twitter

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:58 AM.


Advertisement
Log in to turn off these ads.