Script based on the original pinmarklet for Pinterst allows to share custom images on Pinterest
The script uses jQuery.
##Usage:
<script type="text/javascript" src="proxy.php?url=https%3A%2F%2Fajax.googleapis.com%2Fajax%2Flibs%2Fjquery%2F1.8.3%2Fjquery.min.js"></script>
<script type="text/javascript" src="proxy.php?url=https%3A%2F%2Fwww.github.com%2Fpinmarklet.js"></script>
<a id="pinterest" href="#"><img src="proxy.php?url=https%3A%2F%2Fwww.github.com%2Fimages%2FPinExt.png"></a>
<script type="text/javascript">
$("#pinterest").click(function(){
var imgArray = {
images: [
{
src: "https://lh6.ggpht.com/oJ-bWH2rXcm4OozwnAxatnyBMIjbNDGtZtmvvzTgwzz7gYUI4Rm1_U7uUS0Q5xCMOj8=w124",
alt: "Image from Google Images"
},
{
src: "https://lh6.ggpht.com/_lTfuXOfXmr6ltzuSnKKMJ7sgTYcxAAsrRZOXUHnm3-ANUTIPvYoEo2De04LV95jDqc=h230",
alt: "Image from Google Images"
}
]
};
UTIL.pinterest.addPinMarklet({
images : imgArray.images
});
return false;
});
If requires execute a function when the image is clicked for share with pinterest add a function onPin
UTIL.pinterest.addPinMarklet({
images : imgArray.images,
onPin : function(){
console.log("onPin event you can execute whatever you need");
}
});
There are a simple example on
index.html