From c241f7de18529c3b6f75acc4b190c6341b2ef3ef Mon Sep 17 00:00:00 2001 From: mattn Date: Tue, 24 Jun 2008 04:27:26 +0000 Subject: added faves.com git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@14516 d0d07461-0603-4401-acd4-de1884942a52 --- direct_bookmark.js | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) (limited to 'direct_bookmark.js') diff --git a/direct_bookmark.js b/direct_bookmark.js index 1e63fad..23aaee6 100644 --- a/direct_bookmark.js +++ b/direct_bookmark.js @@ -1,6 +1,6 @@ // Vimperator plugin: 'Direct Post to Social Bookmarks' -// Version: 0.11 -// Last Change: 20-Jun-2008. Jan 2008 +// Version: 0.12 +// Last Change: 24-Jun-2008. Jan 2008 // License: Creative Commons // Maintainer: Trapezoid - http://unsigned.g.hatena.ne.jp/Trapezoid // Parts: @@ -473,6 +473,38 @@ }, tags:function(user,password) [], }, + 'f': { + description:'foves', + account:['https://secure.faves.com', 'https://secure.faves.com', null], + loginPrompt:{ user:'', password:'', description:'Enter username and password.' }, + entryPage:'%URL%', + poster:function(user,password,url,title,comment,tags){ + var request_url = 'https://secure.faves.com/v1/posts/add?' + [ + ['url', url], ['description', title], ['extended', comment], ['tags', tags.join(' ')] + ].map(function(p) p[0] + '=' + encodeURIComponent(p[1])).join('&'); + return Deferred.http({ + method: "get", + url: request_url, + user: user, + password: password, + }).next(function(xhr){ + if(xhr.status != 200) throw "foves: faild"; + }); + }, + tags:function(user,password){ + const feed_url = 'https://secure.faves.com/v1/tags/get'; + var returnValue = []; + var xhr = new XMLHttpRequest(); + xhr.open("GET", feed_url, false, user, password); + xhr.send(null); + + var tags = xhr.responseXML.getElementsByTagName('tag'); + for(var n = 0; n < tags.length; n++) + returnValue.push(tags[n].getAttribute('tag')); + liberator.echo("foves: Tag parsing is finished. Taglist length: " + returnValue.length); + return returnValue; + }, + }, 'p': { description:'Places', account:null, -- cgit v1.2.3