fixed title of getting started & nav highlighting

This commit is contained in:
2023-02-03 12:17:44 +01:00
parent 8b173ff6cd
commit 7b7b645980
5 changed files with 14 additions and 11 deletions

View File

@@ -63,4 +63,5 @@ function toggleDarkMode () {
document.getElementById( 'darkToggle' ).innerHTML = '☽';
setPreferredTheme( 'light' );
}
setTimeout( highlightPath, 1000 );
}

View File

@@ -1,19 +1,20 @@
let bannedIDs = [];
function highlightPath () {
console.log( 'highlighting' );
if ( $( location ).attr( 'pathname' ).slice( 6, location.pathname.length ) === '' ) {
$( '#home' ).css( 'background-color', 'black' );
$( '#home' ).animate( { 'background-color': 'black' }, 200 );
bannedIDs.push( 'home' );
} else if ( $( location ).attr( 'pathname' ).slice( 6, location.pathname.length ) === 'gettingStarted.html' ) {
$( '#gettingStarted' ).css( 'background-color', 'black' );
$( '#gettingStarted' ).animate( { 'background-color': 'black' }, 200 );
bannedIDs.push( 'gettingStarted' );
} else if ( $( location ).attr( 'pathname' ).slice( 6, 16 ) === 'reference/' ) {
$( '#referenceNav' ).css( 'background-color', 'black' );
$( '#referenceNav' ).animate( { 'background-color': 'black' }, 200 );
$( '#reference' ).slideDown();
bannedIDs.push( 'referenceNav' );
setTimeout( highlightSubPath( 16 ), 300 );
} else if ( $( location ).attr( 'pathname' ).slice( 6, 14 ) === 'plugins/' ) {
$( '#pluginsNav' ).css( 'background-color', 'black' );
$( '#pluginsNav' ).animate( { 'background-color': 'black' }, 200 );
$( '#plugins' ).slideDown();
bannedIDs.push( 'pluginsNav' );
setTimeout( highlightSubPath( 14 ), 300 );
@@ -23,10 +24,10 @@ function highlightPath () {
function highlightSubPath ( sliceStart ) {
console.log( $( location ).attr( 'pathname' ).slice( sliceStart, parseInt( location.pathname.length ) - 5 ) );
if ( $( location ).attr( 'pathname' ).slice( sliceStart, parseInt( location.pathname.length ) - 5 ) === '' ) {
$( '#root' ).css( 'background-color', 'black' );
$( '#root' ).animate( { 'background-color': 'black' }, 200 );
bannedIDs.push( 'root' );
} else {
$( `#${location.pathname.slice( sliceStart, parseInt( location.pathname.length ) - 5 )}` ).css( 'background-color', 'rgb(43, 43, 43)' );
$( `#${location.pathname.slice( sliceStart, parseInt( location.pathname.length ) - 5 )}` ).animate( { 'background-color': 'rgb(43, 43, 43)' }, 200 );
bannedIDs.push( `${location.pathname.slice( sliceStart, parseInt( location.pathname.length ) - 5 )}` );
};
}