Sindbad~EG File Manager

Current Path : /home/numerotech/conf-badge.numerotech.com/conference_badge/core/static/js/
Upload File :
Current File : //home/numerotech/conf-badge.numerotech.com/conference_badge/core/static/js/drop_down_1.js

document.addEventListener("DOMContentLoaded", function(){
        
    	/////// Prevent closing from click inside dropdown
		document.querySelectorAll('.dropdown-menu').forEach(function(element){
			element.addEventListener('click', function (e) {
			  e.stopPropagation();
			});
		})

		if (window.innerWidth < 992) {

			// close all inner dropdowns when parent is closed
			document.querySelectorAll('.navbar .dropdown').forEach(function(everydropdown){
				everydropdown.addEventListener('hidden.bs.dropdown', function () {
					// after dropdown is hidden, then find all submenus
					  this.querySelectorAll('.submenu').forEach(function(everysubmenu){
					  	// hide every submenu as well
					  	everysubmenu.style.display = 'none';
					  });
				})
			});
			
			document.querySelectorAll('.dropdown-menu a').forEach(function(element){
				element.addEventListener('click', function (e) {
		
				  	let nextEl = this.nextElementSibling;
				  	if(nextEl && nextEl.classList.contains('submenu')) {	
				  		// prevent opening link if link needs to open dropdown
				  		e.preventDefault();
				  		console.log(nextEl);
				  		if(nextEl.style.display == 'block'){
				  			nextEl.style.display = 'none';
				  		} else {
				  			nextEl.style.display = 'block';
				  		}

				  	}
				});
			})
		}

	}); 


$(document).on("input propertychange paste change", '.FilterSearch', function(e) {
  var value = $(this).val().toLowerCase();
  // var $ul = $(this).closest('ul');
  var $ul = $(this).parent().children('ul');
  //get all lis but not the one having search input
  var $li = $ul.find('li');
  //hide all lis
  $li.hide();
  $li.filter(function() {
    var text = $(this).text().toLowerCase();
    return text.indexOf(value)>=0;
  }).show();

});

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists