Sha256: 1d21b57303393b9b955d26da59b776c0635ac8b8ba5df432aa502dffc83432e5

Contents?: true

Size: 1.33 KB

Versions: 20

Compression:

Stored size: 1.33 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 id = document.createElement('input'); id.setAttribute('type', 'hidden');
      id.setAttribute('name', 'search_id'); id.setAttribute('value', $(this).data('search_id')); f.appendChild(id);
      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;
      });

    };  
Blacklight.onLoad(function() {
  Blacklight.do_search_context_behavior();  
});
})(jQuery);

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
blacklight-4.9.0 app/assets/javascripts/blacklight/search_context.js
blacklight-4.8.0 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.3 app/assets/javascripts/blacklight/search_context.js
blacklight-5.1.1 app/assets/javascripts/blacklight/search_context.js
blacklight-5.1.0 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.2 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.1 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.0 app/assets/javascripts/blacklight/search_context.js
blacklight-4.7.0 app/assets/javascripts/blacklight/search_context.js
blacklight-4.7.0.pre1 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.0.pre4 app/assets/javascripts/blacklight/search_context.js
blacklight-4.6.3 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.0.pre3 app/assets/javascripts/blacklight/search_context.js
blacklight-4.6.2 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.0.pre2 app/assets/javascripts/blacklight/search_context.js
blacklight-4.6.1 app/assets/javascripts/blacklight/search_context.js
blacklight-5.0.0.pre1 app/assets/javascripts/blacklight/search_context.js
blacklight-4.6.0 app/assets/javascripts/blacklight/search_context.js
blacklight-4.5.0 app/assets/javascripts/blacklight/search_context.js
blacklight-4.5.0.rc1 app/assets/javascripts/blacklight/search_context.js