Skip to content

Instantly share code, notes, and snippets.

@zaknak
Created December 6, 2008 06:37
Show Gist options
  • Save zaknak/32636 to your computer and use it in GitHub Desktop.
Save zaknak/32636 to your computer and use it in GitHub Desktop.
models.register({
name : 'HatenaHaiku',
ICON : 'http://h.hatena.ne.jp/favicon.ico',
check : function(ps){
return (/(regular|photo|quote|link|video)/).test(ps.type) && !ps.file;
},
post : function(ps){
if(ps.type != 'regular'){
var body = joinText([ps.item, ps.itemUrl, ps.body, ps.description], '\n\n', true);
}
return Hatena.getToken().addCallback(function(token){
return request('http://h.hatena.ne.jp/entry', {
redirectionLimit : 0,
sendContent : {
rkm : token,
//キーワード。空だと自分のユーザー名への投稿になる
source : 'tombloo',
word : body ? '' : ps.item,
body : body || ps.description,
},
});
});
},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment