Sha256: 01d964d341b5b2060f894cd3b910414c6c22c51e8c02e92fafa1847bb9fa4b23
Contents?: true
Size: 1.13 KB
Versions: 20
Compression:
Stored size: 1.13 KB
Contents
//= require blacklight/core (function($) { Blacklight.do_search_context_behavior = function() { $('a[data-counter]').click(function(event) { var f = document.createElement('form'); f.style.display = 'none'; this.parentNode.appendChild(f); f.method = 'POST'; f.action = $(this).attr('href'); if(event.metaKey || event.ctrlKey){f.target = '_blank';}; var d = document.createElement('input'); d.setAttribute('type', 'hidden'); d.setAttribute('name', 'counter'); d.setAttribute('value', $(this).data('counter')); f.appendChild(d); var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', '_method'); m.setAttribute('value', 'put'); f.appendChild(m); var m = document.createElement('input'); m.setAttribute('type', 'hidden'); m.setAttribute('name', $('meta[name="csrf-param"]').attr('content')); m.setAttribute('value', $('meta[name="csrf-token"]').attr('content')); f.appendChild(m); f.submit(); return false; }); }; $(document).ready(function() { Blacklight.do_search_context_behavior(); }); })(jQuery);
Version data entries
20 entries across 20 versions & 1 rubygems