Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery regex link from text - adds unwanted domain to link
    primarykey
    data
    text
    <p>So, my script is ok apart the link part. Its a jquery twitter feed script that pulls in my tweets. The links its generates through regex should be - <a href="http://twitter.com" rel="nofollow">http://twitter.com</a> - Instead it come out as <a href="http://www.mydomain.com/http://twitter.com" rel="nofollow">http://www.mydomain.com/http://twitter.com</a> - which obv doesnt work.</p> <p>To clarify - When a twitter feed comes through that has a text link in it - the regex turns it into a proper link but puts the pages current url in front of it.</p> <pre><code>&lt;script language="JavaScript"&gt; $.getJSON("https://twitter.com/statuses/user_timeline.json screen_name=twitternamehere&amp;count=2&amp;callback=?", function(data){ $.each(data, function(i,item){ ct = item.text; mytime = item.created_at; var strtime = mytime.replace(/(\+\S+) (.*)/, '$2 $1') var mydate = new Date(Date.parse(strtime)).toLocaleDateString(); var mytime = new Date(Date.parse(strtime)).toLocaleTimeString(); ct = ct.replace(/http:\/\/\S+/g, '&lt;a href="$&amp;" target="_blank"&gt;$&amp;&lt;/a&gt;'); ct = ct.replace(/\s(@)(\w+)/g, ' @&lt;a href="http://twitter.com/$2" target="_blank"&gt;$2&lt;/a&gt;'); ct = ct.replace(/\s(#)(\w+)/g, ' #&lt;a href="http://search.twitter.com/search?q=%23$2" target="_blank"&gt;$2&lt;/a&gt;'); $("#tweetRow").append("&lt;div class='container'&gt;&lt;div class='date'&gt; "+mydate+" "+mytime+" &lt;/div&gt;&lt;div class='tweet'&gt; "+ct+" &lt;/div&gt;&lt;/div&gt;"); }); $('.container:last').addClass('container2'); }); &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload