Last active
March 20, 2016 19:51
-
-
Save saitamanodoruji/911469 to your computer and use it in GitHub Desktop.
Tumblr Dashboard Tab Open to Continue to Dig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Tumblr Dashboard Tab Open to Continue to Dig | |
// @namespace http://saitamanodoruji.tumblr.com/ | |
// @description Press "c", and you can continue to dig dsbd in new tab. | |
// @include http://www.tumblr.com/dashboard* | |
// ==/UserScript== | |
(function() { | |
const KEY_TO_OPEN_TAB = 'c'; | |
var boot = function() { | |
with (window.Minibuffer) { | |
addShortcutkey({ | |
key: KEY_TO_OPEN_TAB, | |
description: 'TumblrDSBDTabOpenToContinue', | |
command: function() { | |
try { execute( 'TumblrDSBDTabOpenToContinue', execute('current-node')); } catch(e) { } | |
}, | |
}); | |
addCommand({ | |
name: 'TumblrDSBDTabOpenToContinue', | |
command: function(stdin) { | |
try { | |
var url = execute('current-link').toString(); | |
var postId = parseInt(url.match(/^http:\/\/[^\/]+\/post\/(\d+)/)[1]) + 1; | |
GM_openInTab('http://www.tumblr.com/dashboard/1/' + postId); | |
} catch (e) { } | |
}, | |
}); | |
} | |
} | |
if (window.Minibuffer) { | |
boot(); | |
} else { | |
window.addEventListener('GM_MinibufferLoaded', boot, false); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment