Sha256: 44a41ae25783388ad8cf59df371797137964f1abaff3677968750ecd09d00b09
Contents?: true
Size: 1.25 KB
Versions: 7
Compression:
Stored size: 1.25 KB
Contents
function getSingleUse(id) { var rurl = window.location.protocol+"//"+window.location.host; var resp = $.ajax({ headers: { Accept: "application/javascript" }, type: 'get', url: rurl + "/single_use_link/generate_show/" + id.slice(10), async: false }); return rurl + resp.responseText; } Blacklight.onLoad(function() { ZeroClipboard.setDefaults({ moviePath: "/assets/ZeroClipboard.swf" }); $.each($(".copypaste"), function(idx, item) { var clip = new ZeroClipboard(); clip.on("dataRequested", function(client, args) { clip.setText(getSingleUse(this.id)); }) clip.on("complete", function(client, args) { alert("A single use link to " + args.text + " was copied to your clipboard.") }) clip.on("noflash", function(client, args) { $(item).bind('click', function(e) { alert("Your single-use link (please copy): " + getSingleUse(item.id)); } ); }) clip.on("wrongflash", function(client, args) { $(item).bind('click', function(e) { alert("Your single-use link (please copy): " + getSingleUse(item.id)); } ); }) clip.glue($("#" + this.id)) }) });
Version data entries
7 entries across 7 versions & 1 rubygems