-
-
Save whym/317217 to your computer and use it in GitHub Desktop.
Type "Shiflt + L" to Like/Unlike & Fav/Unfav on Tumblr Dashboard. Click the label "raw" below to install.
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 love on tumblr | |
// @namespace http://www.tumblr.com/ | |
// @description love current post on tumblr dsbd with 'Shift + l'key. if won't work, pray on tumblr! | |
// @include http://www.tumblr.com/dashboard* | |
// @include http://www.tumblr.com/show/* | |
// @include http://www.tumblr.com/tagged/* | |
// @version 0.0.2 | |
// ==/UserScript== | |
if(!window.Minibuffer) return; | |
var $X = window.Minibuffer.$X; | |
//var submit_like = function(id,t){ unsefeWindow.submit_like(id,t); }; | |
window.Minibuffer.addCommand({ | |
name: 'tumblr.Like', | |
command: function(stdin){ | |
stdin.forEach(function(obj){ | |
var id; | |
if ( (obj.className.match(/not_mine/) && (id = obj.id.match(/post_([\d]+)/)[1]) ) || (id = obj.id.match(/(tweet_[\d]+)/)[1]) ){ | |
$X('.//form[starts-with(@id, "unlike_form_")]', obj).forEach(function(e){ | |
var t = (e.style.display != 'none').toString(); | |
location.href = 'javascript:submit_like("' + id + '",' + t + ');' | |
// submit_like(id, t); | |
}); | |
} | |
}); | |
return stdin; | |
}, | |
}); | |
window.Minibuffer.addShortcutkey({ | |
key: 'L', | |
description: 'tumblr.Like', | |
command: function(){ | |
var stdin = []; | |
try{ | |
stdin = window.Minibuffer.execute('pinned-or-current-node'); | |
} catch (e){} | |
window.Minibuffer.execute('tumblr.Like', stdin); | |
window.Minibuffer.execute('clear-pin'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment