Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save saitamanodoruji/5658502 to your computer and use it in GitHub Desktop.
Save saitamanodoruji/5658502 to your computer and use it in GitHub Desktop.
https://twitter.com/, https://twitter.com/{username} から Quote するための Tombloo パッチ
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