Skip to content

Instantly share code, notes, and snippets.

@animist
Last active November 28, 2018 06:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save animist/d9e11ad8fc2922cde66fd5118141593e to your computer and use it in GitHub Desktop.
patch.fix.hatena.addbookmark.tbrl.js
// ==Taberareloo==
// {
// "name" : "Fix Hatena.addBookmark 2018.11"
// , "description" : "Fix Hatena.addBookmark 2018.11"
// , "include" : ["background"]
// , "version" : "0.0.1"
// , "downloadURL" : "https://gist.githubusercontent.com/animist/d9e11ad8fc2922cde66fd5118141593e/raw/4efa6ad9c6f06e483fc08c9fe97c0674cd0066a1/patch.fix.hatena.addbookmark.tbrl.js"
// }
// ==/Taberareloo==
(function() {
addAround(HatenaBookmark, 'addBookmark', function (proceed, args, target, methodName) {
var self = target;
var url = args[0];
var title = args[1];
var tags = args[2];
var description = args[3];
return HatenaBlog.getUserName().then(function(userName) {
return self.getToken().then(function (data) {
return request('http://b.hatena.ne.jp/' + userName + '/add.edit.json', {
//denyRedirection: true,
method: 'POST',
sendContent : {
rks : data['rks'],
url : url.replace(/%[0-9a-f]{2}/g, function (s) {
return s.toUpperCase();
}),
title : title,
comment : Hatena.reprTags(tags) + description.replace(/[\n\r]+/g, ' ')
}
});
});
});
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment