Skip to content
Browse files

Various Fixes

  • Loading branch information...
2 parents 41561c4 + d4f0ed6 commit c18e3c7acdfa88b4f18e8058c050c95038fce1ce @christianvuerings committed
Showing with 54 additions and 4 deletions.
  1. +1 −0 README.md
  2. +49 −0 src/services/atom.js
  3. +2 −2 src/services/stackoverflow.js
  4. +2 −2 src/services/twitter.js
View
1 README.md
@@ -270,6 +270,7 @@ A list of sites that use the jQuery Lifestream plug-in:
[Sam Tardif](http://www.codeandstuff.com/),
[Sebastix](http://www.sebastix.nl/),
[Simon Gaeremynck](http://gaeremynck.com/),
+[Song Gao](https://song.gao.io/),
[Sunny Walker](http://miraclesalad.com/)
## Special Thanks
View
49 src/services/atom.js
@@ -0,0 +1,49 @@
+(function($) {
+$.fn.lifestream.feeds.atom = function( config, callback ) {
+
+ var template = $.extend({},
+ {
+ posted: 'posted <a href="${link.href}">${title.content}</a>'
+ },
+ config.template),
+
+ /**
+ * Parse the input from atom feed
+ */
+ parseAtom = function( input ) {
+ var output = [], list = [], i = 0, j = 0, url = '';
+ if(input.query && input.query.count && input.query.count > 0) {
+ list = input.query.results.feed.entry;
+ j = list.length;
+
+ for( ; i<j; i++) {
+ var item = list[i];
+
+ output.push({
+ url: item.link.href,
+ date: new Date( item.updated ),
+ config: config,
+ html: $.tmpl( template.posted, item )
+ });
+ }
+ }
+ return output;
+ };
+
+ $.ajax({
+ url: $.fn.lifestream.createYqlUrl('select * from xml where url="' +
+ config.user + '"'),
+ dataType: 'jsonp',
+ success: function( data ) {
+ callback(parseAtom(data));
+ }
+ });
+
+ // Expose the template.
+ // We use this to check which templates are available
+ return {
+ "template" : template
+ };
+
+};
+})(jQuery);
View
4 src/services/stackoverflow.js
@@ -41,7 +41,7 @@ $.fn.lifestream.feeds.stackoverflow = function( config, callback ) {
};
$.ajax({
- url: "http://api.stackoverflow.com/1.1/users/" + config.user +
+ url: "https://api.stackoverflow.com/1.1/users/" + config.user +
"/timeline?jsonp",
dataType: "jsonp",
jsonp: 'jsonp',
@@ -71,4 +71,4 @@ $.fn.lifestream.feeds.stackoverflow = function( config, callback ) {
};
};
-})(jQuery);
+})(jQuery);
View
4 src/services/twitter.js
@@ -21,7 +21,7 @@
var link = function( t ) {
return t.replace(
- /[a-z]+:\/\/[a-z0-9\-_]+\.[a-z0-9\-_:~%&\?\/.=]+[^:\.,\)\s*$]/ig,
+ /([a-z]+:\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
function( m ) {
return '<a href="' + m + '">' +
( ( m.length > 25 ) ? m.substr( 0, 24 ) + '...' : m ) +
@@ -67,7 +67,7 @@
"date": new Date(status.created_at * 1000), // unix time
"config": config,
"html": $.tmpl( template.posted, {
- "tweet": linkify(status.text),
+ "tweet": linkify($('<div/>').html(status.text).text()),
"complete_url": 'http://twitter.com/' + config.user +
"/status/" + status.id_str
} ),

0 comments on commit c18e3c7

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