$expandButton.click(function (event) {
var triggered = !event.originalEvent; // prevent the click bubbling up to the viewer, creating an infinite loop
event.stopPropagation();
var $currentGallery = $(event.target).parents('.wpdtrt-gallery').eq(0);
wpdtrtGalleryUi.toggleExpanded($, $currentGallery, triggered);
});
See https://github.com/MiniProfiler/rack-mini-profiler/issues/343