Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,485
    Thanks
    6
    Thanked 981 Times in 954 Posts

    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.
    Last edited by VIPStephan; 03-30-2010 at 05:14 PM.


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •