Skip to content

Instantly share code, notes, and snippets.

@Ollo
Created September 19, 2012 05:09
Show Gist options
  • Save Ollo/3747785 to your computer and use it in GitHub Desktop.
Save Ollo/3747785 to your computer and use it in GitHub Desktop.
pinterest for Yahoo Stores
<script type="text/javascript">
$(document).ready(function(){
// get button vars
var site = encodeURI(window.location.href);
var img = $('#itemarea img').attr(encodeURI('src'));
var details = $('#caption #itemarea p').text();
// create pin button
var string1 = "<a class='pin-it-button' count-layout='horizontal' href='http://pinterest.com/pin/create/button/?url=";
var string2 = "&media=";
var string3 = "&description=" + details + "'>";
var string4 = "<img border='0' src='//assets.pinterest.com/images/PinExt.png' title='Pin It' /></a>";
var final = "<div class='pin'>" + string1 + site + string2 + img + string3 + string4 + "</div>";
// add it to the social widget
$('.some').prepend(final);
});
</script>
</head>
<body>
<div id="caption">
<div id="itemarea">
<img src="https://encrypted-tbn1.google.com/images?q=tbn:ANd9GcQyOIYqv-8EhIGRoUeEMN7tWiAdE_isOdsKxOE77ugqLzPjObbD" />
<p>This is a funny picture!</p>
<div class="some">
<div>P</div>
<div>T</div>
<div>F</div>
</div>
</div>
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
@Ollo
Copy link
Author

Ollo commented Sep 19, 2012

needs optimization and doesn't work in the editor yet but works on html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment