Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Vector.js: Difference between revisions

MediaWiki interface page
m Fix: Check altKey instead of ctrlKey
Make it flash to draw attention
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
var searchInput = document.getElementById('home-search');
var searchInput = document.getElementById('home-search');
searchInput.onclick = function() {
searchInput.onclick = function() {
document.dispatchEvent(new KeyboardEvent('keydown', {
var realSearch = document.querySelector('.cdx-text-input__input');
'key': 'F',
// Set focus
'altKey': true,
realSearch.focus();
'shiftKey': true
// Make it flash to draw attention
}));
realSearch.style.backgroundColor = '#FEF184'
setTimeout(function() {
  realSearch.style.backgroundColor = '';
}, 500);
};
};

Latest revision as of 14:04, 5 June 2025

/* All JavaScript here will be loaded for users of the Vector skin */
// Make the search bar on Template:Home/nav activate search.
var searchInput = document.getElementById('home-search');
searchInput.onclick = function() {
	var realSearch = document.querySelector('.cdx-text-input__input');
	// Set focus
	realSearch.focus();
	// Make it flash to draw attention
	realSearch.style.backgroundColor = '#FEF184'
	setTimeout(function() {
	  realSearch.style.backgroundColor = '';
	}, 500);
};
Cookies help us deliver our services. By using our services, you agree to our use of cookies.