Sha256: 30d74d82070e35989b7220d6c9d292560ba92cd1b6da5c3520c7d01c7491b115
Contents?: true
Size: 1.26 KB
Versions: 20
Compression:
Stored size: 1.26 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: "<%= asset_path '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
20 entries across 20 versions & 1 rubygems