Skip to content

Commit

Permalink
Potential stylistic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Oct 17, 2015
1 parent f9d2f6b commit 6394d13
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions app/assets/javascripts/blacklight/facet_load.js
@@ -1,20 +1,23 @@
/*global Blacklight */

(function($) {
Blacklight.do_resize_facet_labels_and_counts = function() {
'use strict';

Blacklight.doResizeFacetLabelsAndCounts = function() {
// adjust width of facet columns to fit their contents
function longer (a,b){ return b.textContent.length - a.textContent.length; }

$('ul.facet-values, ul.pivot-facet').map(function(){
$('ul.facet-values, ul.pivot-facet').each(function(){
var longest = $(this).find('span.facet-count').sort(longer).first();
var clone = longest.clone().css('visibility','hidden').css('width', 'auto');
var clone = longest.clone()
.css('visibility','hidden').css('width', 'auto');
$('body').append(clone);
$(this).find('.facet-count').first().width(clone.width());
clone.remove();
});
};

Blacklight.onLoad(function() {
Blacklight.do_resize_facet_labels_and_counts();
Blacklight.doResizeFacetLabelsAndCounts();
});
})(jQuery);

0 comments on commit 6394d13

Please sign in to comment.