From 7b7b6459802db7726fc70e4a9e8ab0781b5a34b3 Mon Sep 17 00:00:00 2001 From: Janis Hutz Date: Fri, 3 Feb 2023 12:17:44 +0100 Subject: [PATCH] fixed title of getting started & nav highlighting --- website/docs/gettingStarted.html | 2 +- website/docs/nav.html | 2 +- website/docs/src/build.js | 7 ++++--- website/js/docs/loader.js | 1 + website/js/docs/nav.js | 13 +++++++------ 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/website/docs/gettingStarted.html b/website/docs/gettingStarted.html index b818309..e8bb46d 100644 --- a/website/docs/gettingStarted.html +++ b/website/docs/gettingStarted.html @@ -1,7 +1,7 @@ - /gettingStarted :: | DOCS - impress.js + gettingStarted :: | DOCS - impress.js diff --git a/website/docs/nav.html b/website/docs/nav.html index fa8df4d..bf64cbc 100644 --- a/website/docs/nav.html +++ b/website/docs/nav.html @@ -13,7 +13,7 @@ Getting Started API reference + HomeCSSHTMLJavaScriptPlugins Plugins diff --git a/website/docs/src/build.js b/website/docs/src/build.js index 238733f..cc0c77a 100644 --- a/website/docs/src/build.js +++ b/website/docs/src/build.js @@ -44,9 +44,10 @@ if ( prompt( 'Do you want to regenerate the API reference? (y/n) ' ).toLowerCase if ( prompt( 'Do you want to regenerate the Getting Started Guide? (y/n) ' ).toLowerCase() == 'y' ) { console.log( 'Regenerating Getting Started Guide' ); - storeHTML( md2html.render( '' + fs.readFileSync( path.join( __dirname + '/../../../GettingStarted.md' ) ) ), '/gettingStarted', '' ); + storeHTML( md2html.render( '' + fs.readFileSync( path.join( __dirname + '/../../../GettingStarted.md' ) ) ), 'gettingStarted', '' ); } +console.log( 'regenerating plugins documentation' ); let docPages = fs.readdirSync( __dirname + '/../../../website/docs/reference' ); for ( let obj in docPages ) { if ( docPages[obj] == 'index.html' ) { @@ -54,6 +55,7 @@ for ( let obj in docPages ) { }; } +console.log( 'regenerating Nav' ); generateNav (); /* @@ -179,7 +181,7 @@ function generateNav () { Plugins @@ -252,7 +254,6 @@ function parseDocumentationMD () { } else { updatedLink = 'https://github.com/impress/impress.js/' + link; }; - console.log( updatedLink + ' at: ' + posArray[item] ); updatedPage = page.slice( 0, parseInt( letter ) + 9 ) + updatedLink + page.slice( parseInt( letter ) + i + 2, parseInt( page.length ) ); } } else if ( page.slice( parseInt( letter ), parseInt( letter ) + 4 ) === '

' ) { diff --git a/website/js/docs/loader.js b/website/js/docs/loader.js index 9366e98..9ee0026 100644 --- a/website/js/docs/loader.js +++ b/website/js/docs/loader.js @@ -63,4 +63,5 @@ function toggleDarkMode () { document.getElementById( 'darkToggle' ).innerHTML = '☽'; setPreferredTheme( 'light' ); } + setTimeout( highlightPath, 1000 ); } diff --git a/website/js/docs/nav.js b/website/js/docs/nav.js index 7b86a5b..bfa5145 100644 --- a/website/js/docs/nav.js +++ b/website/js/docs/nav.js @@ -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 )}` ); }; }