@@ -3,7 +3,7 @@ let headerLength = 0;
3
3
4
4
import config from "./config.js" ;
5
5
6
- export { update , updateFromText , mode } ;
6
+ export { update } ;
7
7
8
8
let sectionCount = 0 ;
9
9
@@ -40,8 +40,10 @@ $(document).ready(function () {
40
40
} ) ;
41
41
} ) ;
42
42
}
43
- $ ( '#FhirDropdown' ) . attr ( 'href' , "javascript:mode='Entries'; $('#mode').html('Displaying FHIR Entries'); updateFromText();" ) ;
44
- $ ( '#NarrativeDropdown' ) . attr ( 'href' , "javascript:mode='Text'; $('#mode').html('Displaying Narrative'); updateFromText();" ) ;
43
+
44
+ $ ( '#FhirDropdown' ) . on ( 'click' , ( ) => updateDisplayMode ( 'Entries' ) ) ;
45
+ $ ( '#NarrativeDropdown' ) . on ( 'click' , ( ) => updateDisplayMode ( 'Text' ) ) ;
46
+
45
47
if ( footerLength === 1 ) {
46
48
$ ( "#footer" ) . load ( config . html_dir + "footer.html" , function ( ) {
47
49
// no actions on footer currently
@@ -53,6 +55,21 @@ $(window).on('load', function () {
53
55
$ ( "#content" ) . show ( ) ;
54
56
} ) ;
55
57
58
+ const updateDisplayMode = function ( displayMode ) {
59
+ let dropdown = $ ( '#mode' ) ;
60
+
61
+ if ( displayMode == 'Entries' ) {
62
+ var newText = 'Displaying FHIR Entries' ;
63
+ } else if ( displayMode == 'Text' ) {
64
+ var newText = 'Displaying Narrative' ;
65
+ }
66
+ if ( newText ) {
67
+ mode = displayMode
68
+ dropdown . html ( newText ) ;
69
+ }
70
+ updateFromText ( ) ;
71
+ } ;
72
+
56
73
// Clear data button function. Should be called on all new data loads
57
74
const clearData = function ( ) {
58
75
// clear textbox
0 commit comments