Skip to content

Instantly share code, notes, and snippets.

@serian
Created January 11, 2013 07:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save serian/4508601 to your computer and use it in GitHub Desktop.
Save serian/4508601 to your computer and use it in GitHub Desktop.
firefox tomblooのパッチ。deliciousのポストURLの変更に対応。あとアイコン。
Delicious.ICON="http://delicious.com/img/favicon.ico";
addAround(Delicious, 'post', function(proceed, args, self) {
var ps = args[0] = update({}, args[0]);
return self.getCurrentUser().addCallback(function(){
return request('http://previous.delicious.com/save', {
queryString : {
title : ps.item,
url : ps.itemUrl,
}
})
}).addCallback(function(res){
var doc = convertToHTMLDocument(res.responseText);
var form = {};
items(formContents(doc.documentElement)).forEach(function([key, value]){
form[key.replace(/[A-Z]/g, function(c){
return '_' + c.toLowerCase()
})] = value;
});
return request('http://previous.delicious.com/save', {
sendContent : update(form, {
title : ps.item,
url : ps.itemUrl,
note : joinText([ps.body, ps.description], ' ', true),
tags : joinText(ps.tags, ','),
private : ps.private,
}),
});
}).addCallback(function(res){
res = JSON.parse(res.responseText);
if(res.error)
throw new Error(res.error_msg);
});
});
addAround(Delicious, 'getInfo', function(proceed, args, self) {
return request('http://previous.delicious.com/save/quick', {method : 'POST'}).addCallback(function(res){
return evalInSandbox('(' + res.responseText + ')', 'http://previous.delicious.com/');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment