Created
December 6, 2008 06:37
-
-
Save zaknak/32636 to your computer and use it in GitHub Desktop.
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
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