/*
|
| Changes in other files
| inspinis.js > line: 163 > code commented to disable inspinia default slim scroll bar
|
*/


// to show/hide top links nav
$(document).on("click", "#cs-nav-top-links-btn", function(e)
{
	e.preventDefault();
	$('body').toggleClass('cs-top-visible');
});
// -------------------------------------
// -------------------------------------



// to show/hide sidebar
$(document).on("click", "#cs-nav-sidebar-btn", function(e)
{
	e.preventDefault();
	if($('body').hasClass('body-small'))
	{
		$('body').toggleClass('cs-menu-show');
	}
	else
	{
		$('body').toggleClass('cs-menu-minimized');
	}
});
// -------------------------------------
// -------------------------------------



// to hide top links bar nav when clicked somewhere else
$(document).on('click', function (e)
{
	if($(e.target).closest(".mbl-vw-nv-elem-top-nav").length > 0){ return false; }
	
	if($(e.target).closest(".navbar-header").length === 0)
	{
	    $("body").removeClass('cs-top-visible');
	}
});
// -------------------------------------
// -------------------------------------



// to hide sidebar nav when clicked somewhere else
$(document).on('click', function (e)
{
	if($(e.target).closest(".mbl-vw-nv-elem-sidebar").length > 0){ return false; }

	if($(e.target).closest(".navbar-static-side").length === 0)
	{
	    $("body").removeClass('cs-menu-show');
	}
});
// -------------------------------------
// -------------------------------------



// mini sidebar handling on large screen on hover
$(document).on('mouseenter', 'body.cs-menu-minimized #side-menu', function (e)
{
	console.log('hovered in');
	$('body').removeClass('cs-menu-minimized').addClass('cs-menu-minimized-hovered');
});
// -------------------------------------
$(document).on('mouseleave', 'body.cs-menu-minimized-hovered #side-menu', function (e)
{
	console.log('hovered out');
	$('body').removeClass('cs-menu-minimized-hovered').addClass('cs-menu-minimized');
});
// -------------------------------------
// -------------------------------------



// perfect scrollbar implimentation
$(document).ready(function(e)
{
	const ps = new PerfectScrollbar('.sidebar-collapse', {
	  swipeEasing: true,
	  wheelSpeed: 0.5,
	  wheelPropagation: true,
	  minScrollbarLength: 40,
	  maxScrollbarLength: 300,
	});
});
// -------------------------------------
// -------------------------------------