Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Correctly determine https avatar URL (when available). Fixes #170, fi…

…xes #157
  • Loading branch information...
commit e89365b62623c8cca33b8e991db77eeb171be88d 1 parent 05a3ac8
Steve Purcell purcell authored

Showing 1 changed file with 11 additions and 5 deletions. Show diff stats Hide diff stats

  1. +11 5 tweet/jquery.tweet.js
16 tweet/jquery.tweet.js
@@ -118,10 +118,6 @@
118 118 }
119 119 }
120 120
121   - function maybe_https(url) {
122   - return ('https:' == document.location.protocol) ? url.replace(/^http:/, 'https:') : url;
123   - }
124   -
125 121 function build_api_url() {
126 122 var proto = ('https:' == document.location.protocol ? 'https:' : 'http:');
127 123 var count = (s.fetch === null) ? s.count : s.fetch;
@@ -137,6 +133,16 @@
137 133 }
138 134 }
139 135
  136 + function extract_avatar_url(item, secure) {
  137 + if (secure) {
  138 + return ('user' in item) ?
  139 + item.user.profile_image_url_https :
  140 + extract_avatar_url(item, false);
  141 + } else {
  142 + return item.profile_image_url || item.user.profile_image_url;
  143 + }
  144 + }
  145 +
140 146 // Convert twitter API objects into data available for
141 147 // constructing each tweet <li> using a template
142 148 function extract_template_data(item){
@@ -145,7 +151,7 @@
145 151 o.source = item.source;
146 152 o.screen_name = item.from_user || item.user.screen_name;
147 153 o.avatar_size = s.avatar_size;
148   - o.avatar_url = maybe_https(item.profile_image_url || item.user.profile_image_url);
  154 + o.avatar_url = extract_avatar_url(item, (document.location.protocol === 'https:'));
149 155 o.retweet = typeof(item.retweeted_status) != 'undefined';
150 156 o.tweet_time = parse_date(item.created_at);
151 157 o.join_text = s.join_text == "auto" ? build_auto_join_text(item.text) : s.join_text;

0 comments on commit e89365b

Please sign in to comment.
Something went wrong with that request. Please try again.