@@ -5,8 +5,12 @@ const fileName = document.getElementById('file-name')
55const btnPreviewData = document . getElementById ( 'btn-preview-data' )
66const previewData = document . getElementById ( 'preview-data-container' )
77
8- const btnPrev = document . getElementById ( 'btn-prev' )
8+ const btnBackContainer = document . getElementById ( 'btn-back-container' )
9+ const btnBack = document . getElementById ( 'btn-back' )
10+ const btnBackSupportText = document . getElementById ( 'btn-back-support-text' )
11+ const btnNextContainer = document . getElementById ( 'btn-next-container' )
912const btnNext = document . getElementById ( 'btn-next' )
13+ const btnNextSupportText = document . getElementById ( 'btn-next-support-text' )
1014
1115const sections = document . querySelectorAll ( 'section' )
1216
@@ -34,29 +38,53 @@ const btnCopy = document.getElementById('btn-copy')
3438let equation = null
3539
3640// Global data
37- let currentSection = 1
41+ let currentSection = 0
42+ const sectionsArray = [
43+ 'Input data' ,
44+ 'Model selection' ,
45+ 'Model visualization' ,
46+ 'Model testing'
47+ ]
3848let fileData = null
3949
4050
4151
42- btnPrev . addEventListener ( 'click' , ( ) => {
43- sections [ currentSection - 1 ] . classList . toggle ( 'hidden' )
52+ btnBack . addEventListener ( 'click' , ( ) => {
53+ sections [ currentSection ] . classList . toggle ( 'hidden' )
4454 currentSection --
45- sections [ currentSection - 1 ] . classList . toggle ( 'hidden' )
46- if ( currentSection == 1 ) {
47- btnPrev . classList . toggle ( 'invisible' )
55+ sections [ currentSection ] . classList . toggle ( 'hidden' )
56+
57+ if ( currentSection == 0 ) {
58+ btnBackContainer . classList . toggle ( 'invisible' )
59+ }
60+
61+ if ( currentSection < sectionsArray . length ) {
62+ if ( btnNextContainer . classList . contains ( 'invisible' ) ) {
63+ btnNextContainer . classList . remove ( 'invisible' )
64+ }
4865 }
66+
67+ btnBackSupportText . textContent = sectionsArray [ currentSection - 1 ] || ''
68+ btnNextSupportText . textContent = sectionsArray [ currentSection + 1 ] || ''
4969} )
5070
5171btnNext . addEventListener ( 'click' , ( ) => {
52- sections [ currentSection - 1 ] . classList . toggle ( 'hidden' )
72+ sections [ currentSection ] . classList . toggle ( 'hidden' )
5373 currentSection ++
54- sections [ currentSection - 1 ] . classList . toggle ( 'hidden' )
55- if ( currentSection > 1 ) {
56- if ( btnPrev . classList . contains ( 'invisible' ) ) {
57- btnPrev . classList . remove ( 'invisible' )
74+ sections [ currentSection ] . classList . toggle ( 'hidden' )
75+
76+ if ( currentSection == sectionsArray . length - 1 ) {
77+ btnNextContainer . classList . toggle ( 'invisible' )
78+ }
79+
80+ if ( currentSection > 0 ) {
81+ if ( btnBackContainer . classList . contains ( 'invisible' ) ) {
82+ btnBackContainer . classList . remove ( 'invisible' )
5883 }
5984 }
85+
86+ btnBackSupportText . textContent = sectionsArray [ currentSection - 1 ] || ''
87+ btnNextSupportText . textContent = sectionsArray [ currentSection + 1 ] || ''
6088} )
6189
6290
0 commit comments