Permalink
Browse files

Deliciousポストフォーム変更対応(taberarelooから移植)

  • Loading branch information...
1 parent 4b7c1dc commit deda57f410f46d8d06aed94d008ae48671482408 @to committed Dec 22, 2011
Showing with 13 additions and 1 deletion.
  1. +13 −1 xpi/chrome/content/library/20_model.js
@@ -1241,15 +1241,27 @@ models.register(update({}, AbstractSessionService, {
})
}).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://www.delicious.com/save', {
- sendContent : update(formContents(doc), {
+ 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);
});
},

0 comments on commit deda57f

Please sign in to comment.