<?php
/**
 * FW Food Menu Categories Module 4.0.0
 * @copyright (C) 2020 Fastw3b
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.fastw3b.net/ Official website
 **/
defined( '_JEXEC' ) or die( 'Restricted access' );

?>
<div id="fwfm-mod-categories" class="fwfm-mod-categories fwcss <?php echo $moduleclass_sfx; ?>">
	<ul class="list-group">
<?php
if ($tree) {
	fwre_print_navigation_menu_nodes($tree, $params, $cids, $level = 0);
}
?>
	</ul>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
	(function($) {
	$('#fwfm-mod-categories li.list-group-item a').click(function() {
		var $row = $(this).parent();
		if ($row.hasClass('active')) return;
		$row.parent().find('.active').removeClass('active');
		$row.addClass('active');
	});

	if (location.hash != '') {
		$('#fwfm-mod-categories li.list-group-item a').each(function() {
			var $link = $(this);
			if ($link.attr('href') == location.hash) {
				$link.click();
				return;
			}
		});
	}
	})(jQuery);
});
</script>
