Skip to content

Instantly share code, notes, and snippets.

@rolandcrosby
Created May 25, 2015 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rolandcrosby/9da5e03d10f446b91959 to your computer and use it in GitHub Desktop.
Save rolandcrosby/9da5e03d10f446b91959 to your computer and use it in GitHub Desktop.
Bookmarklet to pin to Pinterest from an Instagram web page
(
function() {
function getSrcUri() {
return window.location;
}
function getSrc() {
return document.getElementsByClassName('lfFrame')[0].getAttribute('src');
}
function getPoster() {
var el = document.getElementsByClassName('lfFrame')[0];
return el.getAttribute('poster') || el.getAttribute('src');
}
function getDescription() {
return document.getElementsByTagName("h1")[0].innerText;
}
function getPinUrl() {
return "//www.pinterest.com/pin/create/button/?url=" + encodeURIComponent(getSrcUri())
+ "&media=" + encodeURIComponent(getPoster());
+ "&description=" + encodeURIComponent(getDescription());
}
window.location = getPinUrl();
}
)();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment