Created
October 15, 2017 23:19
-
-
Save brlafreniere/01af6b8a30d80f3943257d64be5b6710 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reload_post_grid_items(url) { | |
if (!url) { | |
var url = window.location.pathname + '?' + jQuery('#bwp-post-grid-form').serialize(); | |
} | |
jQuery('#bwp-post-grid-items > *').fadeOut('slow'); | |
jQuery('#bwp-post-grid-items').load(url + ' ' + '#bwp-post-grid-items > *', function () { | |
register_event_handlers(); | |
jQuery('#bwp-post-grid-items > *').fadeIn('slow'); | |
}); | |
} | |
function register_event_handlers() { | |
jQuery(document).click(function(event) { | |
if(!jQuery(event.target).closest('.bwp-post-grid-filter-dropdown').length) { | |
jQuery('.bwp-post-grid-filter-dropdown').hide(); | |
} | |
}); | |
jQuery('.bwp-post-grid-filter-button').click(function (event) { | |
jQuery(this).closest('td').siblings().find('.bwp-post-grid-filter-dropdown').hide(); | |
jQuery(this).parent().find('.bwp-post-grid-filter-dropdown').toggle(); | |
return false; | |
}); | |
jQuery('#bwp-post-grid-display-format').change(function (event) { | |
reload_post_grid_items(); | |
}); | |
jQuery('#bwp-post-grid-search-terms').keypress(function (event) { | |
if (event.which == 13) { | |
reload_post_grid_items(); | |
} | |
event.stopPropagation(); | |
}); | |
jQuery('.bwp-post-grid-pagination a').click(function (event) { | |
var url = jQuery(this).attr('href'); | |
reload_post_grid_items(url); | |
return false; | |
}); | |
} | |
jQuery(document).ready(function () { | |
register_event_handlers(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment