Skip to content

Instantly share code, notes, and snippets.

@taizooo
Created November 13, 2008 06:49
Show Gist options
  • Save taizooo/24387 to your computer and use it in GitHub Desktop.
Save taizooo/24387 to your computer and use it in GitHub Desktop.
love current post on tumblr dsbd with 'Shift + l'key. if won't work, pray on tumblr!
// ==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/*
// @version 0.0.1
// ==/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){
if (obj.className.match(/not_mine/)){
var id = obj.id.match(/post([\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