aboutsummaryrefslogtreecommitdiff
path: root/.themes/classic/source
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2012-09-29 22:42:47 -0500
committerBrandon Mathis <brandon@imathis.com>2012-09-29 22:42:47 -0500
commita010c99289a9dedd963fb2100d38fb80a80ae7ea (patch)
treee569e21998f6bafb4c12dde20315528eedeb0e7b /.themes/classic/source
parent6c26f907cc0cf4704aaf5377738721177ec048f3 (diff)
downloadmy_new_personal_website-a010c99289a9dedd963fb2100d38fb80a80ae7ea.tar.xz
my_new_personal_website-a010c99289a9dedd963fb2100d38fb80a80ae7ea.zip
Twitter API call and links are now protocol relative
Diffstat (limited to '.themes/classic/source')
-rw-r--r--.themes/classic/source/javascripts/twitter.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/.themes/classic/source/javascripts/twitter.js b/.themes/classic/source/javascripts/twitter.js
index c9b7519d..1a5c1548 100644
--- a/.themes/classic/source/javascripts/twitter.js
+++ b/.themes/classic/source/javascripts/twitter.js
@@ -41,9 +41,9 @@ function prettyDate(time) {
function linkifyTweet(text, url) {
// Linkify urls, usernames, hashtags
- text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
- .replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
- .replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
+ text = text.replace(/(https?:)(\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$2$3">$3</a>')
+ .replace(/(^|\W)@(\w+)/g, '$1<a href="//twitter.com/$2">@$2</a>')
+ .replace(/(^|\W)#(\w+)/g, '$1<a href="//search.twitter.com/search?q=%23$2">#$2</a>');
// Use twitter's api to replace t.co shortened urls with expanded ones.
for (var u in url) {
@@ -62,7 +62,7 @@ function showTwitterFeed(tweets, twitter_user) {
content = '';
for (var t in tweets) {
- content += '<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
+ content += '<li>'+'<p>'+'<a href="//twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
}
timeline.innerHTML = content;
}
@@ -70,7 +70,7 @@ function showTwitterFeed(tweets, twitter_user) {
function getTwitterFeed(user, count, replies) {
count = parseInt(count, 10);
$.ajax({
- url: "http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
+ url: "//api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
, type: 'jsonp'
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
, success: function(data) { showTwitterFeed(data.slice(0, count), user); }