Jump to content

MBS - Web search keybind support


jamesplay

Recommended Posts

jamesplay

Would it be feasible to add search keybind support to the web client?

I've personally added some code to my server running on the dev branch 3.0.5506, so that users can type 's' on the webpage to focus on the search input, and use the escape key to close the search overlay and remove input focus. 

 

I have just put this inside the function bindSearchEvents() in search.js. I was trying to make use of the bindKeys in mediacontroller.js but I thought it would have been too much of a headache with working around the bypass function.

 

Anyways this is really just an idea for you guys.

$(document).on("keyup", function (e) {
	var elem = document.activeElement
	if (e.keyCode == 83 && !$('.headerSearchInput').is(':focus') && !($(elem).is('input') || $(elem).is('textarea') || $(elem).is('select') || $(elem).is('password') || $('.itemVideo').length)) {
		$('.headerSearchInput').focus();
	} else if (e.keyCode == 27 && $('.headerSearchInput').is(':focus') && !$('.itemVideo').length) {
		$(elem).blur();
		closeSearchOverlay()
	}
})
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...