diff options
author | trapezoid | 2008-09-14 09:16:24 +0000 |
---|---|---|
committer | trapezoid | 2008-09-14 09:16:24 +0000 |
commit | e8c5a3ba7ed45b1a92b677ba6abe47a0b8382e8e (patch) | |
tree | a28ee9f29dceb2ac3bfa9e9cd1b8b33e30ad2113 /twitter.js | |
parent | 0f5935645b5729d0adf4138961843e1fd7811bed (diff) | |
download | vimperator-plugins-e8c5a3ba7ed45b1a92b677ba6abe47a0b8382e8e.tar.bz2 |
browser_object.js: タブにpin操作ができるようにした
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@19285 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'twitter.js')
-rw-r--r-- | twitter.js | 51 |
1 files changed, 50 insertions, 1 deletions
@@ -1,5 +1,5 @@ // Vimperator plugin: "Update Twitter"
-// Last Change: 20-Jun-2008. Jan 2008
+// Last Change: 29-Aug-2008. Jan 2008
// License: Creative Commons
// Maintainer: Trapezoid <trapezoid.g@gmail.com> - http://unsigned.g.hatena.ne.jp/Trapezoid
//
@@ -137,6 +137,55 @@ .replace(/(?:\r?\n|\r)[ \t]*/g, " ");
liberator.echo(html, true);
}
+ var services = {
+ 'twitter': {
+ description:'Twitter',
+ account:['https://www.hatena.ne.jp', 'https://www.hatena.ne.jp', null],
+ loginPrompt:{ user:'', password:'', description:'Enter username and password.' },
+ entryPage:'http://b.hatena.ne.jp/entry/%URL%',
+ poster:function(user,password,url,title,comment,tags){
+ var tagString = tags.length > 0 ? '[' + tags.join('][') + ']' : "";
+ var request =
+ <entry xmlns="http://purl.org/atom/ns#">
+ <title>dummy</title>
+ <link rel="related" type="text/html" href={url}/>
+ <summary type="text/plain">{tagString + comment}</summary>
+ </entry>;
+ var wsse = new WSSEUtils(user,password);
+
+ return Deferred.http({
+ method: "post",
+ url: "http://b.hatena.ne.jp/atom/post",
+ data: request.toString(),
+ headers: {
+ "X-WSSE": wsse.getWSSEHeader(),
+ "Content-Type": "application/atom+xml",
+ },
+ }).next(function(xhr){
+ if(xhr.status != 201) throw "Hatena Bookmark: faild";
+ });
+ },
+ tags:function(user,password){
+ var xhr = new XMLHttpRequest();
+ var hatena_tags = [];
+
+ xhr.open("GET","http://b.hatena.ne.jp/my",false);
+ xhr.send(null);
+
+ var mypage_html = parseHTML(xhr.responseText, ['img', 'script']);
+ var tags = getElementsByXPath("//ul[@id=\"taglist\"]/li/a",mypage_html);
+
+ tags.forEach(function(tag){
+ hatena_tags.push(tag.innerHTML);
+ });
+ liberator.echo("Hatena Bookmark: Tag parsing is finished. Taglist length: " + tags.length);
+ return hatena_tags;
+ },
+ icon:function(url){
+ return '<img src="http://b.hatena.ne.jp/entry/image/' + url + '" style="vertical-align: middle;" />';
+ },
+ }
+ };
liberator.commands.addUserCommand(["twitter"], "Change Twitter status",
function(arg, special){
var password;
|