Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mactkg/d19a5421c55fa40f5799 to your computer and use it in GitHub Desktop.
Save mactkg/d19a5421c55fa40f5799 to your computer and use it in GitHub Desktop.
// ==Taberareloo==
// {
// "name" : "Fix Tumblr.getTumblelogs 2015.04"
// , "description" : "Fix Tumblr.getTumblelogs 2015.04"
// , "include" : ["background"]
// , "version" : "0.1.2"
// , "downloadURL" : "https://gist.github.com/mactkg/d19a5421c55fa40f5799/raw/ca2da60df200603d322cc7fcafb76eda1febc37f/patch.fix.tumblr.getTumblelogs.tbrl.js"
// }
// ==/Taberareloo==
(function() {
addAround(Tumblr, 'getTumblelogs', function (proceed, args, target, methodName) {
var self = target;
console.log('hi');
return request(Tumblr.LINK + 'settings', { responseType: 'document' }).then(function (res) {
var doc = res.response;
debugger;
if ($X('id("account_actions_login_and_register")', doc)[0]) {
throw new Error(chrome.i18n.getMessage('error_notLoggedin', self.name));
}
Tumblr.form_key = $X('//input[@name="form_key"]/@value', doc)[0];
Tumblr.channel_id = doc.querySelector('.is_primary .hide_overflow').textContent.trim();
Tumblr.blogs = [Tumblr.channel_id];
return Array.prototype.slice.call(doc.querySelectorAll(
'.controls_section .is_tumblelog ' +
'a[href^="/settings/blog/"]:not([href="/settings/blog/' + Tumblr.channel_id + '"])'
)).reverse().map(function (a) {
var id = a.querySelector('.hide_overflow').textContent.trim();
var name = a.querySelector('.small_text').textContent.trim();
Tumblr.blogs.push(id);
return {
id : id,
name: name
};
});
});
});
setTimeout(function() {
Models.getMultiTumblelogs();
}, 1000);
})();
@mactkg
Copy link
Author

mactkg commented Apr 12, 2015

これだと自分が管理してるのしか取得できない

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment