(function ($) { var setupTooltip = function () { $('[data-toggle="tooltip"]').tooltip({ 'placement': 'top', 'container': 'body', 'html': 'true', 'white-space': 'nowrap' }); }; var setupClick = function ($graphDiv) { $('a', $graphDiv).click(function (evt) { evt.preventDefault(); evt.stopPropagation(); window.location.hash = $(this).attr('href'); }); }; var setupResponsiveness = function ($queryDiv, $graphDiv, index, opts) { var currentWidth = $(window).width(); var debounced_draw = _.debounce(function () { if (currentWidth !== $(window).width()) { var shownHits = $queryDiv.find('.ghit > g').length; $.graphIt($queryDiv, $graphDiv, shownHits, index, opts); currentWidth = $(window).width(); } }, 125); $(window).resize(debounced_draw); }; var graphControls = function ($queryDiv, $graphDiv, isInit) { var MIN_HITS_TO_SHOW = 20; var totalHits, shownHits, lessButton, moreButton; var countHits = function () { totalHits = $queryDiv.data().hitCount; shownHits = $queryDiv.find('.ghit > g').length; }; var setupButtons = function($queryDiv, $graphDiv) { $graphDiv .append( $('