adds an animation to upvote/downvote
目前為
// ==UserScript==
// @name imgur animated upvote/downvote fireworks
// @namespace http://porath.org/
// @version 0.15
// @description adds an animation to upvote/downvote
// @author porath
// @match http://imgur.com/*
// @match https://imgur.com/*
// @grant none
// ==/UserScript==
$('#mainUpArrow').append('<div id="upvote_firework" style="display: none; position: absolute"><img src="//i.imgur.com/YEzlDPG.png" /></div>');
$('#mainDownArrow').append('<div id="downvote_firework" style="display: none; position: absolute"><img src="//i.imgur.com/5WTwxi9.png" /></div>');
$('#mainUpArrow').on('click', function () {
if ($('#mainUpArrow').hasClass('pushed')) {
return;
}
$('#upvote_firework').css("top", -39);
$('#upvote_firework').css("left", -80);
$('#upvote_firework').show();
window.setTimeout(function() { // wait, then hide the animation
$('#upvote_firework').hide();
}, 1000);
});
$('#mainDownArrow').on('click', function () {
if ($('#mainDownArrow').hasClass('pushed')) {
return;
}
$('#downvote_firework').css("top", -39);
$('#downvote_firework').css("left", -39);
$('#downvote_firework').show();
window.setTimeout(function() { // wait, then hide the animation
$('#downvote_firework').hide();
}, 1000);
});