Skip to content

Instantly share code, notes, and snippets.

@YungSang
Last active December 28, 2015 10:39
Show Gist options
  • Save YungSang/7487373 to your computer and use it in GitHub Desktop.
Save YungSang/7487373 to your computer and use it in GitHub Desktop.
[Deprecated] Taberareloo パッチ: 全てのサブブログ(招待された他のブログを含む)を投稿先に出来るようにするパッチ * Taberareloo v3.0.10 で対応済み
// ==Taberareloo==
// {
// "name" : "Fix getting multiple tumblelogs"
// , "description" : "Fix getting multiple tumblelogs"
// , "include" : ["background"]
// , "version" : "0.1.1"
// , "downloadURL" : "https://gist.github.com/YungSang/7487373/raw/patch.model.tumblr.getTumblelogs.tbrl.js"
// }
// ==/Taberareloo==
(function() {
update(Models['Tumblr'], {
getTumblelogs : function () {
var self = this;
return request(Tumblr.LINK + 'dashboard', { responseType: 'document' }).addCallback(function(res){
var doc = res.response;
if($X('id("logged_out_container")', 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 = $X('//input[@name="t"]/@value', doc)[0];
Tumblr.blogs = [Tumblr.channel_id];
return Array.prototype.slice.call(doc.querySelectorAll(
'#popover_blogs .popover_menu_item ' +
'a[href^="/blog/"]:not([href="/blog/' + Tumblr.channel_id + '"])'
)).reverse().map(function(a){
var id = a.getAttribute('href').replace(/^\/blog\//g, '');
Tumblr.blogs.push(id);
return {
id : id,
name: a.textContent.trim()
};
});
});
}
});
if (TBRL.Config.post.multi_tumblelogs) {
setTimeout(function () {
Models.getMultiTumblelogs();
}, 1000);
}
})();
@YungSang
Copy link
Author

Fix getting multiple tumblelogs by YungSang · Pull Request #240 · Constellation/taberareloo
taberareloo/taberareloo#240

マージされました。

@YungSang
Copy link
Author

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