fix some bug in js

This commit is contained in:
BOHUNG 2020-01-13 16:15:21 +08:00
parent 5962eed8a0
commit 52a197a68d
1 changed files with 11 additions and 11 deletions

View File

@ -89,9 +89,9 @@ $(document).ready(function(){
}); });
$('.cancer_help_btn').off("click").on('click',function(){ $('.cancer_help_btn').off("click").on('click',function(){
var modal_head = ""; var modal_head = "";
try{ modal_head = $(this).parent().find(">label").html()}catch{}; try{ modal_head = $(this).parent().find(">label").html()}catch(e){};
var modal_body = ""; var modal_body = "";
try{ modal_body = $(this).parent().find(">input.help_texts").attr('value')}catch{}; try{ modal_body = $(this).parent().find(">input.help_texts").attr('value')}catch(e){};
$('#show_help_modal').html("<div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' aria-hidden='true' class='close'>×</button><h4 class='modal-title'>"+modal_head+"</h4>"+ $('#show_help_modal').html("<div class='modal-dialog'><div class='modal-content'><div class='modal-header'><button type='button' aria-hidden='true' class='close'>×</button><h4 class='modal-title'>"+modal_head+"</h4>"+
"</div><div class='modal-body'>"+modal_body+"</div><div class='modal-footer'><button type='button' class='btn btn-default'>Close</button></div></div></div>") "</div><div class='modal-body'>"+modal_body+"</div><div class='modal-footer'><button type='button' class='btn btn-default'>Close</button></div></div></div>")
$('#show_help_modal').modal('show'); $('#show_help_modal').modal('show');
@ -141,7 +141,7 @@ $(document).ready(function(){
var input_value = $(this).parent().find('.num_only').data('range')[0]; var input_value = $(this).parent().find('.num_only').data('range')[0];
if(input_value != undefined) if(input_value != undefined)
$(this).parent().find('.num_only').val(input_value); $(this).parent().find('.num_only').val(input_value);
}catch{ }catch(e){
$(this).parent().find('.num_only').val(0); $(this).parent().find('.num_only').val(0);
}; };
if($(this).parent().find('.num_only').val() != ""){ if($(this).parent().find('.num_only').val() != ""){
@ -193,7 +193,7 @@ $(document).ready(function(){
if(input_value != undefined) if(input_value != undefined)
$(this).parent().find('.num_only').val(input_value); $(this).parent().find('.num_only').val(input_value);
} }
}catch{ }catch(e){
$(this).parent().find('.num_only').val(0); $(this).parent().find('.num_only').val(0);
}; };
if($(this).parent().find('.num_only').val() != ""){ if($(this).parent().find('.num_only').val() != ""){
@ -215,7 +215,7 @@ $(document).ready(function(){
if($('.cancertable_empty').length == 0){ if($('.cancertable_empty').length == 0){
$('#danger_texts').remove(); $('#danger_texts').remove();
}; };
}catch{}; }catch(e){};
$(this).addClass('active'); $(this).addClass('active');
}); });
$('#cancer_table_reset').click(function(){ $('#cancer_table_reset').click(function(){
@ -301,7 +301,7 @@ $(document).ready(function(){
$('#result_table_content .cancer_years').off('click').on('click',function(){ $('#result_table_content .cancer_years').off('click').on('click',function(){
try{ try{
$(this).parent().find('.cancer_years').removeClass('active'); $(this).parent().find('.cancer_years').removeClass('active');
}catch{}; }catch(e){};
$(this).addClass('active'); $(this).addClass('active');
$('#current_year').attr('index',$(this).attr('index')); $('#current_year').attr('index',$(this).attr('index'));
$('#current_year').attr('value',$(this).html()); $('#current_year').attr('value',$(this).html());
@ -319,7 +319,7 @@ $(document).ready(function(){
$('#result_text_content .cancer_years').click(function(){ $('#result_text_content .cancer_years').click(function(){
try{ try{
$(this).parent().find('.cancer_years').removeClass('active'); $(this).parent().find('.cancer_years').removeClass('active');
}catch{}; }catch(e){};
$(this).addClass('active'); $(this).addClass('active');
$('#current_year').attr('value',$(this).html()); $('#current_year').attr('value',$(this).html());
$('#current_year').attr('index',$(this).attr('index')); $('#current_year').attr('index',$(this).attr('index'));
@ -451,7 +451,7 @@ $(document).ready(function(){
if($('.cancertable_empty').length == 0){ if($('.cancertable_empty').length == 0){
$('#danger_texts').remove(); $('#danger_texts').remove();
}; };
}catch{}; }catch(e){};
$(this).addClass('active'); $(this).addClass('active');
if(!click_flag){ if(!click_flag){
if(!active_treatment.includes($(this).parent().attr('id'))){ if(!active_treatment.includes($(this).parent().attr('id'))){
@ -472,7 +472,7 @@ $(document).ready(function(){
if($('.cancertable_empty').length == 0){ if($('.cancertable_empty').length == 0){
$('#danger_texts').remove(); $('#danger_texts').remove();
}; };
}catch{}; }catch(e){};
$(this).addClass('active'); $(this).addClass('active');
if(!click_flag){ if(!click_flag){
if(active_treatment.includes($(this).parent().attr('id'))){ if(active_treatment.includes($(this).parent().attr('id'))){
@ -571,7 +571,7 @@ $(document).ready(function(){
result['age2'] = Math.pow((Number(result_json['age'])/100),0.5)*Math.log(result_json['age']/100); result['age2'] = Math.pow((Number(result_json['age'])/100),0.5)*Math.log(result_json['age']/100);
result['size1'] = Math.log(Number(result_json['size'])/10); result['size1'] = Math.log(Number(result_json['size'])/10);
if(Number(result_json['lymph_nodes_examined']) != 0) if(Number(result_json['lymph_nodes_examined']) != 0)
try{result['ratio'] = Number(result_json['lymph_nodes_positive'])/Number(result_json['lymph_nodes_examined'])}catch{result['ratio'] = 0} try{result['ratio'] = Number(result_json['lymph_nodes_positive'])/Number(result_json['lymph_nodes_examined'])}catch(e){result['ratio'] = 0}
else else
result['ratio'] = 0 result['ratio'] = 0
if(result['ratio'] > 1) if(result['ratio'] > 1)
@ -655,7 +655,7 @@ $(document).ready(function(){
result['lpv'] = ((result['age1']-0.7276655)*(-10.87)+(result['age2']+0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+ result['lpv'] = ((result['age1']-0.7276655)*(-10.87)+(result['age2']+0.4540707)*8.968+(result['size1']-0.643632)*0.7678+(result['nposit']-1.346932)*0.5339+
result['grade_2']*0.4795+result['grade_3']*0.818+result['subtype_HER2']*0.1806+result['subtype_triple']*0.6457+result['pstage_2']*0.5311+ result['grade_2']*0.4795+result['grade_3']*0.818+result['subtype_HER2']*0.1806+result['subtype_triple']*0.6457+result['pstage_2']*0.5311+
result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04); result['pstage_3']*1.134+result['pstage_4']*2.172+result['lvi_yes']*0.3321-0.04);
}catch{result['lpv'] = "error"}; }catch(e){result['lpv'] = "error"};
return result; return result;
}; };
function submit_fcn(){ function submit_fcn(){