Sha256: 50cd830572c90775afdc142589db56903322fd1beb9b1d15f1f0abb2736546f2
Contents?: true
Size: 1.25 KB
Versions: 96
Compression:
Stored size: 1.25 KB
Contents
(function( $ ){ $.fn.singleUseLinks = function( options ) { var clipboard = new Clipboard('.copy-single-use-link'); var manager = { reload_table: function() { var url = $("table.single-use-links tbody").data('url') $.get(url).done(function(data) { $('table.single-use-links tbody').html(data); }); }, create_link: function(caller) { $.post(caller.attr('href')).done(function(data) { manager.reload_table() }) }, delete_link: function(caller) { $.ajax({ url: caller.attr('href'), type: 'DELETE', done: caller.parent('td').parent('tr').remove() }) } }; $('.generate-single-use-link').click(function(event) { event.preventDefault() manager.create_link($(this)) return false }); $("table.single-use-links tbody").on('click', '.delete-single-use-link', function(event) { event.preventDefault() manager.delete_link($(this)) return false; }); clipboard.on('success', function(e) { $(e.trigger).tooltip('show'); e.clearSelection(); }); return manager; }; })( jQuery ); Blacklight.onLoad(function () { $('.single-use-links').singleUseLinks(); });
Version data entries
96 entries across 96 versions & 3 rubygems