Created
May 27, 2013 18:46
-
-
Save saitamanodoruji/5658502 to your computer and use it in GitHub Desktop.
https://twitter.com/, https://twitter.com/{username} から Quote するための Tombloo パッチ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tombloo.Service.extractors.register([ | |
{ | |
name : 'Quote - Twitter Stream Item', | |
ICON : models.Twitter.ICON, | |
getItem: function(target){ | |
return $x('ancestor-or-self::li[starts-with(@id, "stream-item-tweet-")]', target); | |
}, | |
check : function(ctx){ | |
return this.getItem(ctx.target); | |
}, | |
extract : function(ctx){ | |
var tw = this.getItem(ctx.target); | |
return { | |
type : 'quote', | |
item : 'Twitter / ' + tw.querySelector('.fullname').textContent, | |
itemUrl : tw.querySelector('a.tweet-timestamp, a.js-permalink').href, | |
pageUrl : tw.querySelector('a.tweet-timestamp, a.js-permalink').href, | |
body : tw.querySelector('.js-tweet-text, .tweet-text').textContent, | |
} | |
} | |
}, | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment