Skip to content

Commit

Permalink
Evernote追加(thanks to id:tell-k)
Browse files Browse the repository at this point in the history
  • Loading branch information
to committed Jan 4, 2010
1 parent 29eaf00 commit 97ee36c
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 6 deletions.
63 changes: 58 additions & 5 deletions xpi/chrome/content/library/20_model.js
Expand Up @@ -320,8 +320,8 @@ models.register(update({

models.register({
name : 'WeHeartIt',
ICON : 'http://weheartit.com/img/favicon.ico',
URL : 'http://weheartit.com/',
ICON : 'http://weheartit.com/favicon.ico',
URL : 'http://weheartit.com/',

check : function(ps){
return ps.type == 'photo' && !ps.file;
Expand Down Expand Up @@ -368,8 +368,7 @@ models.register({

models.register({
name : '4u',
ICON : 'http://www.straightline.jp/html/common/static/favicon.ico',

ICON : 'http://4u.straightline.jp/favicon.ico',
URL : 'http://4u.straightline.jp/',

check : function(ps){
Expand Down Expand Up @@ -636,7 +635,7 @@ models.register({
this.getCurrentUser();

return request(Jaiku.URL).addCallback(function(res){
var form = formContents(convertToHTMLDocument(res.responseText));
var form = formContents(convertToHTMLDocument(res.responseText));
return request(Jaiku.URL, {
redirectionLimit : 0,
sendContent : {
Expand Down Expand Up @@ -889,6 +888,60 @@ models.register({
},
});


models.register({
name : 'Evernote',
ICON : 'http://www.evernote.com/favicon.ico',
POST_URL : 'http://www.evernote.com/clip.action',

check : function(ps){
return (/(regular|quote|link|conversation|video)/).test(ps.type) && !ps.file;
},

post : function(ps){
var self = this;
if(!this.getAuthCookie())
throw new Error(getMessage('error.notLoggedin'));

return this.getToken().addCallback(function(token){
return request(self.POST_URL, {
redirectionLimit : 0,
sendContent : update(token, {
saveQuicknote : 'save',
format : 'microclip',

url : ps.itemUrl || 'no url',
title : ps.item || 'no title',
comment : ps.description,
body : ps.body,
tags : (ps.tags)? ps.tags.join(',') : '',
fullPage : (ps.body)? 'true' : 'false',
}),
});
});
},

getAuthCookie : function(){
return getCookieString('evernote.com', 'auth');
},

getToken : function(){
return request(this.POST_URL, {
sendContent: {
format : 'microclip',
quicknote : 'true'
}
}).addCallback(function(res){
var doc = convertToHTMLDocument(res.responseText);
return {
_sourcePage : $x('//input[@name="_sourcePage"]/@value', doc),
__fp : $x('//input[@name="__fp"]/@value', doc),
noteBookGuide : $x('//select[@name="notebookGuid"]//option[@selected="selected"]/@value', doc),
};
});
},
});

models.register({
name : 'Delicious',
ICON : 'http://delicious.com/favicon.ico',
Expand Down
3 changes: 2 additions & 1 deletion xpi/defaults/preferences/tombloo-prefs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 97ee36c

Please sign in to comment.