diff --git a/build/tweetlight.min.js b/build/tweetlight.min.js
index dd1eeb8..4d1acd0 100644
--- a/build/tweetlight.min.js
+++ b/build/tweetlight.min.js
@@ -1,2 +1,2 @@
/*! tweetlight 4.1.2 | (c) 2015 Pedro Rogério | MIT License */
-!function(a,b){"use strict";"function"==typeof define&&define.amd?define("tweetlight",b):"object"==typeof exports?module.exports=b():a.Tweetlight=b()}(this,function(){"use strict";var a=function(b){return this&&this instanceof a?(this.username=b.username,this.hashtag=b.hashtag,this.container=b.container,this.counter=b.counter,this.endpoint="../request.php",this.onComplete=b.onComplete||function(){},void this.fetch()):new a(b)};return a.prototype={fetch:function(){var a=this.hashtag?"hashtag="+encodeURIComponent(this.hashtag):"username="+this.username,b=this.counter?"&count="+this.counter:"",c=this.endpoint+"?"+a+b;this.getJSON(c,this.loadTweets)},getJSON:function(a,b){var c=new XMLHttpRequest,d=this;c.open("GET",a,!0),c.onreadystatechange=function(){if(4===this.readyState){if(!(this.status>=200&&this.status<400))throw new Error(this.status+" - "+this.statusText);var a=JSON.parse(this.responseText);b.call(d,a)}},c.send(),c=null},loadTweets:function(a){var b=a.httpstatus;200===b?(a.statuses&&(a=a.statuses),this.displayTweets(a),this.onComplete()):this.displayError(a)},displayTweets:function(a){var b,c=document.querySelector(this.container),d="";for(b in a)a.hasOwnProperty(b)&&a[b].text&&(d+='
'+this.prettyDate(a[b].created_at)+"");c.innerHTML=d},displayError:function(a){var b=document.querySelector(this.container);b.innerHTML=''+a.errors.message+""},prettyDate:function(a){var b,c,d,e,f,g,h=new Date,i=new Date(a);return(-1!==navigator.userAgent.indexOf("MSIE")||navigator.appVersion.indexOf("Trident/")>0)&&(i=Date.parse(a.replace(/( \+)/," UTC$1"))),b=h-i,c=1e3,d=60*c,e=60*d,f=24*e,g=7*f,isNaN(b)||0>b?"":2*c>b?"just now":d>b?Math.floor(b/c)+" seconds ago":2*d>b?"1 minute ago":e>b?Math.floor(b/d)+" minutes ago":2*e>b?"1 hour ago":f>b?Math.floor(b/e)+" hours ago":b>f&&2*f>b?"yesterday":365*f>b?Math.floor(b/f)+" days ago":"over a year ago"},twitterLinks:function(a){return a=a.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi,'$2').replace(/(^|\W)@(\w+)/g,'$1@$2').replace(/(^|\W)#(\w+)/g,'$1#$2')}},a});
\ No newline at end of file
+!function(a,b){"use strict";"function"==typeof define&&define.amd?define("tweetlight",b):"object"==typeof exports?module.exports=b():a.Tweetlight=b()}(this,function(){"use strict";var a=function(b){return this&&this instanceof a?(this.username=b.username,this.hashtag=b.hashtag,this.container=b.container,this.counter=b.counter,this.showImageProfile=b.showImageProfile||!1,this.endpoint="../request.php",this.onComplete=b.onComplete||function(){},void this.fetch()):new a(b)};return a.prototype={fetch:function(){var a=this.hashtag?"hashtag="+encodeURIComponent(this.hashtag):"username="+this.username,b=this.counter?"&count="+this.counter:"",c=this.endpoint+"?"+a+b;this.getJSON(c,this.loadTweets)},getJSON:function(a,b){var c=new XMLHttpRequest,d=this;c.open("GET",a,!0),c.onreadystatechange=function(){if(4===this.readyState){if(!(this.status>=200&&this.status<400))throw new Error(this.status+" - "+this.statusText);var a=JSON.parse(this.responseText);b.call(d,a)}},c.send(),c=null},loadTweets:function(a){var b=a.httpstatus;200===b?(a.statuses&&(a=a.statuses),this.displayTweets(a),this.onComplete()):this.displayError(a)},displayTweets:function(a){var b,c,d=document.querySelector(this.container),e="";for(c in a)a.hasOwnProperty(c)&&a[c].text&&(b=this.showImageProfile?'':"",e+=""+b+''+this.prettyDate(a[c].created_at)+"");d.innerHTML=e},displayError:function(a){var b=document.querySelector(this.container);b.innerHTML=''+a.errors[0].message+""},prettyDate:function(a){var b,c,d,e,f,g,h=new Date,i=new Date(a);return(-1!==navigator.userAgent.indexOf("MSIE")||navigator.appVersion.indexOf("Trident/")>0)&&(i=Date.parse(a.replace(/( \+)/," UTC$1"))),b=h-i,c=1e3,d=60*c,e=60*d,f=24*e,g=7*f,isNaN(b)||0>b?"":2*c>b?"just now":d>b?Math.floor(b/c)+" seconds ago":2*d>b?"1 minute ago":e>b?Math.floor(b/d)+" minutes ago":2*e>b?"1 hour ago":f>b?Math.floor(b/e)+" hours ago":b>f&&2*f>b?"yesterday":365*f>b?Math.floor(b/f)+" days ago":"over a year ago"},twitterLinks:function(a){return a=a.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi,'$2').replace(/(^|\W)@(\w+)/g,'$1@$2').replace(/(^|\W)#(\w+)/g,'$1#$2')}},a});
\ No newline at end of file
diff --git a/src/tweetlight.js b/src/tweetlight.js
index 46edaaa..1eadd3d 100644
--- a/src/tweetlight.js
+++ b/src/tweetlight.js
@@ -18,12 +18,13 @@
return new Tweetlight(options);
}
- this.username = options.username;
- this.hashtag = options.hashtag;
- this.container = options.container;
- this.counter = options.counter;
- this.endpoint = '../request.php';
- this.onComplete = options.onComplete || function () {};
+ this.username = options.username;
+ this.hashtag = options.hashtag;
+ this.container = options.container;
+ this.counter = options.counter;
+ this.showImageProfile = options.showImageProfile || false;
+ this.endpoint = '../request.php';
+ this.onComplete = options.onComplete || function () {};
this.fetch();
};
@@ -70,12 +71,14 @@
}
},
displayTweets: function (tweets) {
- var timeline = document.querySelector(this.container), content = '', i;
+ var timeline = document.querySelector(this.container), content = '', imageProfile, i;
for (i in tweets) {
if (tweets.hasOwnProperty(i)) {
if (tweets[i].text) {
- content += '' + this.prettyDate(tweets[i].created_at) + '';
+ imageProfile = this.showImageProfile ? '' : '';
+
+ content += '' + imageProfile + '' + this.prettyDate(tweets[i].created_at) + '';
}
}
}
@@ -85,7 +88,7 @@
displayError: function (tweets) {
var timeline = document.querySelector(this.container);
- timeline.innerHTML = '' + tweets.errors.message + '';
+ timeline.innerHTML = '' + tweets.errors[0].message + '';
},
prettyDate: function (dateString) {
var rightNow = new Date(),