Sha256: 8ea74d20a76a8a0ce46d36c32265a61e7f2280ff3bf1912f8d94fc4ef745e861

Contents?: true

Size: 978 Bytes

Versions: 3

Compression:

Stored size: 978 Bytes

Contents

$(document).ready(function() {
  Blacklight.do_hierarchical_facet_expand_contract_behavior();
});

(function($) {
  Blacklight.do_hierarchical_facet_expand_contract_behavior = function() {
    $( Blacklight.do_hierarchical_facet_expand_contract_behavior.selector ).each (
        Blacklight.hierarchical_facet_expand_contract
     );
  }
  Blacklight.do_hierarchical_facet_expand_contract_behavior.selector = 'li.h-node';

  Blacklight.hierarchical_facet_expand_contract = function() {
    var li = $(this);
    
    $('ul', this).each(function() {
      li.addClass('twiddle');
      if($('span.selected', this).length == 0){
        $(this).hide();
      } else {
        li.addClass('twiddle-open');
      }
    });

    // attach the toggle behavior to the li tag
    li.click(function(e){
      if (e.target == this) {
        // toggle the content
        $(this).toggleClass('twiddle-open');
        $(this).children('ul').slideToggle();
      }
    });
  };
})(jQuery);

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
blacklight-hierarchy-0.0.3 app/assets/javascripts/blacklight/hierarchy/hierarchy.js
blacklight-hierarchy-0.0.2 app/assets/javascripts/blacklight/hierarchy/hierarchy.js
blacklight-hierarchy-0.0.1 app/assets/javascripts/blacklight/hierarchy/hierarchy.js