Created
January 11, 2013 07:08
-
-
Save serian/4508601 to your computer and use it in GitHub Desktop.
firefox tomblooのパッチ。deliciousのポストURLの変更に対応。あとアイコン。
This file contains hidden or 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
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