How can I modify the tumblr bookmarklet to post to a specific tumblr blog?

k107 picture k107 · Nov 10, 2011 · Viewed 7.9k times · Source

I have a couple blogs linked to my Tumblr account, but the bookmarklet always selects my "primary" blog (the first one in the list).

How can I modify the bookmarklet so that it will auto-select a specific blog? I would like to have multiple bookmarklet links, e.g. "Share on blog1", "Share on blog2" so that I don't have to manually select which blog to create the post in.

Default Tumblr bookmarklet looks like this:

javascript: var d = document,
    w = window,
    e = w.getSelection,
    k = d.getSelection,
    x = d.selection,
    s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)),
    f = 'http://www.tumblr.com/share',
    l = d.location,
    e = encodeURIComponent,
    p = '?v=3&u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s),
    u = f + p;
try {
    if (!/^(.*\.)?tumblr[^.]*$/.test(l.host)) throw (0);
    tstbklt();
} catch (z) {
    a = function () {
        if (!w.open(u, 't', 'toolbar=0,resizable=0,status=1,width=450,height=430')) l.href = u;
    };
    if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);
    else a();
}
void(0)

Answer

KyleWpppd picture KyleWpppd · Dec 10, 2011

Give the bookmarklet a 'channel_id' post parameter which is 'example_blog_name' in example_blog_name.tumblr.com

javascript: var d = document,
    w = window,
    e = w.getSelection,
    k = d.getSelection,
    x = d.selection,
    s = (e ? e() : (k) ? k() : (x ? x.createRange().text : 0)),
    f = 'http://www.tumblr.com/share',
    l = d.location,
    e = encodeURIComponent,
    c = 'example_blog_name',
    p = '?v=3&u=' + e(l.href) + '&t=' + e(d.title) + '&s=' + e(s) + '&channel_id=' + e(c),
    u = f + p;