Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fix Tumblr.getTumblelogs 2017.06
// ==Taberareloo==
// {
// "name" : "Fix Tumblr.getTumblelogs 2017.06"
// , "description" : "Fix Tumblr.getTumblelogs 2017.06"
// , "include" : ["background"]
// , "version" : "0.4.0"
// , "downloadURL" : "https://gist.githubusercontent.com/ailispaw/3aef8857c274e22f2b41/raw/patch.fix.tumblr.getTumblelogs.tbrl.js"
// }
// ==/Taberareloo==
(function() {
addAround(Tumblr, 'getTumblelogs', function (proceed, args, target, methodName) {
var self = target;
return request(Tumblr.LINK + 'dashboard', { responseType: 'document' }).then(function (res) {
var doc = res.response;
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] || $X('//meta[@id="tumblr_form_key"]/@content', doc)[0];
Tumblr.channel_id = $X('//input[@name="t"]/@value', doc)[0];
Tumblr.blogs = [Tumblr.channel_id];
var bootloader = $X('id("bootloader")/@data-bootstrap', doc)[0];
var json = JSON.parse(bootloader);
return json.Context.userinfo.channels.filter(function (channel) {
return !channel.is_current
}).reverse().map(function (channel) {
Tumblr.blogs.push(channel.name);
return {
id : channel.name,
name : channel.directory_safe_title
};
});
});
});
setTimeout(function() {
Models.getMultiTumblelogs();
}, 1000);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.