Skip to content

Instantly share code, notes, and snippets.

@mduvall
Created December 8, 2011 18:06
Show Gist options
  • Save mduvall/1447866 to your computer and use it in GitHub Desktop.
Save mduvall/1447866 to your computer and use it in GitHub Desktop.
animates boards on pinterest that have gifs, SUCCESS. and a userscript for chrome
$(document).ready(function() {
// grab urls for all the images
var pin_elems = $("a.PinImage");
$.each(pin_elems, function(i,v) {
$.get(v.href, {}, function(data) {
$("img", v).attr("src", $("div#PinImage a", $(data)).attr("href"));
});
});
});
// ==UserScript==
// @match http://pinterest.com/maskact/animated-gifs/
// @match http://www.pinterest.com/maskact/animated-gifs/
// @match https://www.pinterest.com/maskact/animated-gifs/*
// ==/UserScript==
function addJQuery(callback) {
var script = document.createElement("script");
script.setAttribute("src", "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js");
script.addEventListener('load', function() {
var script = document.createElement("script");
script.textContent = "(" + callback.toString() + ")();";
document.body.appendChild(script);
}, false);
document.body.appendChild(script);
}
function animate() {
var pin_elems = $("a.PinImage");
$.each(pin_elems, function(i,v) {
$.get(v.href, {}, function(data) {
$("img", v).attr("src", $("div#PinImage a", $(data)).attr("href"));
});
});
}
addJQuery(animate);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment