File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 1818 < div id ="normal-content ">
1919 < main id ="content-body ">
2020 < section id ="section-contentHeader ">
21- < input id ="main-title " type ="text " placeholder ="Nome ">
21+ < input id ="main-title " type ="text " placeholder ="Titolo ">
2222 < div id ="main-data ">
23- < div id ="input-author-wrapper ">
23+ < div id ="input-author-wrapper " data-subjects =" csSUBJECT:art_history csSUBJECT:italian " >
2424 < img class ="main-data-icon icon-mono display-mode-dynamic-icon " src ="assets/artist.png ">
2525 < input id ="input-author " placeholder ="Autore " type ="text ">
2626 </ div >
27- < div id ="input-date-wrapper ">
27+ < div id ="input-date-wrapper " data-subjects =" csSUBJECT:art_history csSUBJECT:italian csSUBJECT:history " >
2828 < img class ="main-data-icon icon-mono display-mode-dynamic-icon " src ="assets/clock.png ">
2929 < label id ="date-label "> Data:</ label >
3030 < div id ="input-dateFrom-wrapper ">
3939 < input id ="input-dateTo-year " placeholder ="aaaa " type ="number " min ="-9999 " max ="9999 ">
4040 </ div >
4141 </ div >
42- < div id ="input-location-wrapper ">
42+ < div id ="input-location-wrapper " data-subjects =" csSUBJECT:art_history csSUBJECT:history " >
4343 < img class ="main-data-icon icon-mono display-mode-dynamic-icon " src ="assets/pin.png ">
44- < input id ="input-location " placeholder ="Ubicazione " type ="text ">
44+ < input id ="input-location " placeholder ="Luogo " type ="text ">
4545 </ div >
46- < div id ="input-subject-wrapper ">
46+ < div id ="input-subject-wrapper " data-subjects =" csSUBJECT:art_history csSUBJECT:italian " >
4747 < img class ="main-data-icon icon-mono display-mode-dynamic-icon " src ="assets/subject.png ">
4848 < input id ="input-subject " placeholder ="Soggetto " type ="text ">
4949 </ div >
Original file line number Diff line number Diff line change @@ -33,8 +33,19 @@ function addSubjectSelectionOptions(subjects) {
3333 } )
3434}
3535
36+ function updateMainDataSection ( subject ) {
37+ const mainDataSection = document . getElementById ( 'main-data' )
38+ const targets = mainDataSection . children
39+
40+ for ( const e of targets ) {
41+ if ( e . dataset . subjects . split ( ' ' ) . includes ( subject ) ) e . style . removeProperty ( 'display' )
42+ else e . style . display = 'none'
43+ }
44+ }
45+
3646
3747document . getElementById ( 'csSUBJECT-selector' ) . onchange = ev => {
3848 CONFIG . sheet . currentSubject = ev . currentTarget . value
3949 addItemGenerationButtons ( CONFIG . subjects [ CONFIG . sheet . currentSubject ] . item_types )
50+ updateMainDataSection ( CONFIG . sheet . currentSubject )
4051}
You can’t perform that action at this time.
0 commit comments