Copy & open script for couponsites (zeroclipboard)
ZeroClipboard snippet
HTML
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script type="text/javascript" src="http://shopsheep.com/js/jquery.zclip.min.js"></script>
</head>
<body>
<h1>Coupon</h1>
<div>
<a id="first" class="copy" href="http://gan.doubleclick.net/gan_click?lid=41000000035320131&pubid=21000000000358705">LIGHT3</a>
<p>Save an Extra 15% off Lighting and Lamps with code:LIGHT3</p>
<p>Start date: 2011-03-29</p>
<p>End date: 2011-03-30</p>
</div>
<div>
<a id="second" class="copy" href="http://gan.doubleclick.net/gan_click?lid=41000000035272548&pubid=21000000000358705">3DAYSALE</a>
<p>3-Days Online Only Exclusive Savings! EXTRA 5-10% off Almost Everything with 3DAYSALE</p>
<p>Start date: 2011-03-30</p>
<p>End date: 2011-04-01</p>
</div>
</body>
</html>
JavaScript
ZeroClipboard.setMoviePath('http://shopsheep.com/js/ZeroClipboard.swf');
$(document).ready(function() {
$(".copy").each(function(i) {
var clip = new ZeroClipboard.Client();
var myTextToCopy = $(this).text();
var myTextUrl = $(this).attr('href');
clip.setText(myTextToCopy);
clip.addEventListener('complete', function(client, text) {
//window.open(myTextUrl);
});
clip.glue($(this).attr("id"));
});
});