mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-12-04 12:09:30 +00:00
ca0401789d
- Can now use const/let - No need for feature detection for things like fetch and closest as we can assume they exist if ES6 support is available Change-Id: I85b01add13fd74e1514119498815403e42a09af0
24 lines
728 B
JavaScript
24 lines
728 B
JavaScript
// Enable Vector features limited to ES6 browse
|
|
const stickyHeader = require( './stickyHeader.js' ),
|
|
searchToggle = require( './searchToggle.js' );
|
|
|
|
/**
|
|
* @return {void}
|
|
*/
|
|
const main = () => {
|
|
// Initialize the search toggle for the main header only. The sticky header
|
|
// toggle is initialized after wvui search loads.
|
|
const searchToggleElement = document.querySelector( '.mw-header .search-toggle' );
|
|
if ( searchToggleElement ) {
|
|
searchToggle( searchToggleElement );
|
|
}
|
|
stickyHeader();
|
|
};
|
|
|
|
if ( document.readyState === 'interactive' || document.readyState === 'complete' ) {
|
|
main();
|
|
} else {
|
|
// This is needed when document.readyState === 'loading'.
|
|
document.addEventListener( 'DOMContentLoaded', () => main );
|
|
}
|