@@ -83,18 +83,15 @@ var busy_editing = 0;
83
83
} ) ;
84
84
85
85
86
- // a lot of console logging has been added to show events the user presses
87
86
// this is needed to help check different browsers
88
87
for ( var i = 0 ; i < gloss_phonology . length ; i ++ ) {
89
88
var field = gloss_phonology [ i ] ;
90
89
var field_ref = '#' + gloss_phonology [ i ] ;
91
- // console.log('setup key listener '+field_ref);
92
90
$ ( field_ref ) . on ( "customEvent" , function ( e ) {
93
91
var target = $ ( e . target ) ;
94
92
var this_field_name = $ ( target ) . attr ( "id" ) ;
95
93
var classname = $ ( target ) . attr ( "class" ) ;
96
94
$ ( target ) . clearQueue ( ) ;
97
- // console.log('customEvent on '+this_field_name+' type '+e.type+' triggers select on '+this_field_name);
98
95
if ( phonology_list_kinds . includes ( this_field_name ) ) {
99
96
// for phonology pulldown lists do this to get list open
100
97
$ ( target ) . focus ( ) . click ( ) . click ( ) ;
@@ -112,8 +109,6 @@ var busy_editing = 0;
112
109
var targetNodeName = e . target . nodeName ;
113
110
var this_element = $ ( this ) ;
114
111
var this_value = $ ( this_element ) . attr ( "value" ) ;
115
-
116
- // console.log('field '+field+' key pressed '+e.keyCode+' nodeName '+targetNodeName+' value '+field_value+' option value '+this_value);
117
112
if ( e . keyCode === 13 ) { // 'return'
118
113
e . preventDefault ( ) ;
119
114
if ( targetNodeName != 'INPUT' ) {
@@ -143,7 +138,6 @@ var busy_editing = 0;
143
138
} ) ;
144
139
145
140
function disable_edit ( ) {
146
- //$('#affix-bar').show(); // The affix bar appears on top of the Delete modal popup window, so it is hidden during editting
147
141
$ ( '.edit' ) . editable ( 'disable' ) ;
148
142
$ ( '.edit' ) . css ( 'color' , 'black' ) ;
149
143
$ ( '#edit_message' ) . text ( '' ) ;
@@ -160,7 +154,6 @@ function disable_edit() {
160
154
$ ( '#idgloss' ) . html ( '<a href="' + original_lemma_group_url + '">' + original_lemma_group_value + '</a>' )
161
155
}
162
156
} else {
163
- // console.log('lemma group: ' + lemma_group)
164
157
if ( lemma_group == 'True' ) {
165
158
new_lemma_group_url = url + 'signs/search/?search_type=sign&view_type=lemma_groups&lemmaGloss=%5E' + new_lemma_group + '%24'
166
159
$ ( '#idgloss' ) . html ( '<a href="' + new_lemma_group_url + '">' + new_lemma_group + '</a>' )
@@ -169,23 +162,19 @@ function disable_edit() {
169
162
if ( strong_machine_value == undefined ) {
170
163
if ( original_strong_hand ) {
171
164
strong_hand_href = url + 'dictionary/handshape/' + original_strong_hand + '/' ;
172
- // console.log('strong hand ref: ' + strong_hand_href);
173
165
$ ( '#domhndsh' ) . html ( '<a id="strong_hand_link" style="color: inherit; display: visible;" href="' + strong_hand_href + '">' + strong_hand + '</a>' ) ;
174
166
}
175
167
} else {
176
168
strong_hand_href = url + 'dictionary/handshape/' + strong_machine_value + '/' ;
177
- // console.log('strong hand ref: ' + strong_hand_href);
178
169
$ ( '#domhndsh' ) . html ( '<a id="strong_hand_link" style="color: inherit; display: visible;" href="' + strong_hand_href + '">' + strong_hand + '</a>' ) ;
179
170
} ;
180
171
if ( weak_machine_value == undefined ) {
181
172
if ( original_weak_hand ) {
182
173
weak_hand_href = url + 'dictionary/handshape/' + original_weak_hand + '/' ;
183
- // console.log('weak hand ref: ' + weak_hand_href);
184
174
$ ( '#subhndsh' ) . html ( '<a id="weak_hand_link" style="color: inherit; display: visible;" href="' + weak_hand_href + '">' + weak_hand + '</a>' ) ;
185
175
}
186
176
} else {
187
177
weak_hand_href = url + 'dictionary/handshape/' + weak_machine_value + '/' ;
188
- // console.log('weak hand ref: ' + weak_hand_href);
189
178
$ ( '#subhndsh' ) . html ( '<a id="weak_hand_link" style="color: inherit; display: visible;" href="' + weak_hand_href + '">' + weak_hand + '</a>' ) ;
190
179
} ;
191
180
} ;
@@ -212,9 +201,6 @@ function disable_edit() {
212
201
213
202
$ ( '.empty_row' ) . hide ( ) ;
214
203
215
- // initial setup not in Edit mode
216
- // hideLemmaForm($("#lemma"));
217
- // $("#lemma a").show();
218
204
$ ( '#edit_lemma_form' ) . hide ( ) ;
219
205
$ ( "#set_lemma_form" ) . hide ( ) ;
220
206
$ ( "#add_lemma_form" ) . hide ( ) ;
@@ -248,17 +234,13 @@ function disable_edit() {
248
234
} ;
249
235
250
236
function enable_edit ( ) {
251
- //$('#affix-bar').hide(); // The affix bar appears on top of the Delete modal popup window, so it is hidden during editting
252
237
$ ( '.edit' ) . editable ( 'enable' ) ;
253
238
$ ( '.edit' ) . css ( 'color' , 'red' ) ;
254
239
$ ( '#edit_message' ) . text ( 'Click on red text to edit ' ) ;
255
240
$ ( '#edit_message' ) . css ( 'color' , 'black' ) ;
256
241
strong_hand = $ ( '#domhndsh' ) . text ( ) ;
257
242
weak_hand = $ ( '#subhndsh' ) . text ( ) ;
258
243
lemma_group_text = $ ( '#idgloss' ) . text ( ) ;
259
- // console.log('original lemma group: ' + lemma_group_text);
260
- // console.log("original strong hand: " + strong_hand);
261
- // console.log("original weak hand: " + weak_hand);
262
244
$ ( '#domhndsh' ) . children ( ) . remove ( ) ;
263
245
$ ( '#domhndsh' ) . html ( strong_hand ) ;
264
246
$ ( '#subhndsh' ) . children ( ) . remove ( ) ;
@@ -357,7 +339,7 @@ function configure_edit() {
357
339
$ . fn . editable . defaults [ 'indicator' ] = saving_str ;
358
340
$ . fn . editable . defaults [ 'tooltip' ] = 'Click to edit...' ;
359
341
$ . fn . editable . defaults [ 'placeholder' ] = '-' ;
360
- $ . fn . editable . defaults [ 'submit' ] = '<button class="btn btn-primary" type="submit">Ok </button>' ;
342
+ $ . fn . editable . defaults [ 'submit' ] = '<button class="btn btn-primary" type="submit">OK </button>' ;
361
343
$ . fn . editable . defaults [ 'cancel' ] = '<button class="btn btn-default" type="cancel">Cancel</button>' ;
362
344
$ . fn . editable . defaults [ 'cssclass' ] = 'preview' ;
363
345
$ . fn . editable . defaults [ 'width' ] = 'auto' ;
@@ -474,7 +456,6 @@ function configure_edit() {
474
456
var this_data = $ ( this ) . attr ( 'value' ) ;
475
457
var edit_list_choices = static_choice_lists [ $ ( this ) . attr ( 'id' ) ] ;
476
458
var edit_list_choice_colors = static_choice_list_colors [ $ ( this ) . attr ( 'id' ) ] ;
477
-
478
459
var index_of_modified_field = '_0' ;
479
460
for ( var key in edit_list_choices ) {
480
461
var value = edit_list_choices [ key ] ;
@@ -556,15 +537,14 @@ function update_view_and_remember_original_value(change_summary)
556
537
new_values_for_changes_made [ id ] = machine_value ;
557
538
if ( new_value == ' ' ) {
558
539
new_value = 'False' ;
559
- // console.log("new value changed from to False");
560
540
}
561
541
562
542
if ( original_values_for_changes_made [ id ] == undefined )
563
543
{
564
544
original_values_for_changes_made [ id ] = original_value ;
565
545
$ ( this ) . parent ( ) . removeClass ( 'empty_row' ) ;
566
546
if ( id == 'weakprop' || id == 'weakdrop' || id == 'domhndsh_letter' || id == 'domhndsh_number' || id == 'subhndsh_letter' || id == 'subhndsh_number' ) {
567
- $ ( this ) . attr ( "value" , new_value ) ;
547
+ $ ( this ) . attr ( "value" , machine_value ) ;
568
548
if ( new_value == ' ' ) {
569
549
$ ( this ) . html ( "------" ) ;
570
550
}
@@ -576,27 +556,25 @@ function update_view_and_remember_original_value(change_summary)
576
556
if ( new_value == '-' || new_value == ' ' || new_value == '' || new_value == 'None' ||
577
557
new_value == 'False' || new_value == 0 || new_value == ' ' )
578
558
{
579
- // console.log("new value is empty, new value is: ", new_value);
580
559
if ( id == 'weakprop' || id == 'weakdrop' || id == 'domhndsh_letter' || id == 'domhndsh_number' || id == 'subhndsh_letter' || id == 'subhndsh_number' ) {
581
- $ ( this ) . attr ( "value" , new_value ) ;
582
560
$ ( this ) . html ( "------" ) ;
583
561
}
584
562
else {
585
563
if ( id == 'idgloss' ) {
586
564
// the user tried to erase the Lemma ID Gloss field, reset it in the template to what it was
587
- // console.log('attempt to delete field idgloss');
588
565
$ ( this ) . html ( original_value ) ;
589
566
lemma_group = original_lemma_group ;
590
567
} else {
591
568
$ ( this ) . parent ( ) . addClass ( 'empty_row' ) ;
592
- $ ( this ) . attr ( "value" , new_value ) ;
569
+ $ ( this ) . attr ( "value" , machine_value ) ;
593
570
$ ( this ) . html ( "------" ) ;
594
571
}
595
572
}
596
573
}
597
574
if ( category_value == 'phonology' ) {
598
- // console.log('phonology modified');
599
- $ ( this ) . attr ( "value" , new_value ) ;
575
+ if ( id != 'weakprop' && id != 'weakdrop' ) {
576
+ $ ( this ) . attr ( "value" , new_value ) ;
577
+ }
600
578
var index_of_modified_field = gloss_phonology . indexOf ( id ) ;
601
579
var next_field_index = index_of_modified_field + 1 ;
602
580
if ( next_field_index < gloss_phonology . length ) {
@@ -605,10 +583,8 @@ function update_view_and_remember_original_value(change_summary)
605
583
$ ( next_field_ref ) . clearQueue ( ) ;
606
584
if ( phonology_list_kinds . includes ( next_field ) ) {
607
585
// for lists, do custom event instead of click
608
- // console.log('customEvent on '+next_field_ref);
609
586
$ ( next_field_ref ) . triggerHandler ( "customEvent" ) ; //.focus().click().click();
610
587
} else {
611
- // console.log('click event on '+next_field_ref);
612
588
$ ( next_field_ref ) . click ( ) ;
613
589
} ;
614
590
}
@@ -789,7 +765,6 @@ function update_foreign_delete(change_summary)
789
765
var deleted_relation = deleted_relation_for_gloss . split ( '_' ) ;
790
766
var deleted_relation_id = deleted_relation [ 1 ] ;
791
767
$ ( this ) . css ( "color" , "black" ) ;
792
- // console.log("Delete foreign relation: ", deleted_relation_id);
793
768
var search_id = 'foreign_' + deleted_relation_id ;
794
769
$ ( document . getElementById ( search_id ) ) . replaceWith ( "<tr id='" + search_id + "' class='empty_row' style='display: none;'>" + "</tr>" ) ;
795
770
$ ( this ) . html ( '' ) ;
@@ -802,7 +777,6 @@ function update_relation_delete(change_summary)
802
777
var deleted_relation = deleted_relation_for_gloss . split ( '_' ) ;
803
778
var deleted_relation_id = deleted_relation [ 1 ] ;
804
779
$ ( this ) . css ( "color" , "black" ) ;
805
- // console.log("Delete relation: ", deleted_relation_id);
806
780
var search_id = 'row_' + deleted_relation_id ;
807
781
$ ( document . getElementById ( search_id ) ) . replaceWith ( "<tr id='" + search_id + "' class='empty_row' style='display: none;'>" + "</tr>" ) ;
808
782
$ ( this ) . html ( '' ) ;
0 commit comments