From 5b081146e17f60fa4946041f01890ee2e7323256 Mon Sep 17 00:00:00 2001 From: Git-Harshit Date: Sun, 1 Aug 2021 21:22:43 +0530 Subject: [PATCH 1/4] Update popover() method to prevent its untimely dismissal --- js/tree-edam-stand-alone.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/tree-edam-stand-alone.js b/js/tree-edam-stand-alone.js index f98aa64..2475be5 100644 --- a/js/tree-edam-stand-alone.js +++ b/js/tree-edam-stand-alone.js @@ -428,7 +428,7 @@ function interactive_edam_browser(){ }); } } - $('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]').popover(); + $('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ':scope [data-toggle="popover"]'}); }); } var caller_s=biosphere_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -441,7 +441,7 @@ function interactive_edam_browser(){ to_biosphere_href(c[0],caller_s.get_url(),data[0]) + ' by appliances, ' + to_biosphere_href(c[1],caller_s.get_url(),data[1]) + ' by tools.' + '').appendTo(elt); - $('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]').popover(); + $('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ":scope"}); }); } var caller_w=bioweb_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -451,7 +451,7 @@ function interactive_edam_browser(){ var elt=$('#details-'+identifier+' .'+id_w); elt.empty(); $(to_bioweb_href(c,caller_w.get_url(),data)).appendTo(elt); - $('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]').popover(); + $('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ":scope"}); }); } var caller_t=tess_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -461,7 +461,7 @@ function interactive_edam_browser(){ var elt=$('#details-'+identifier+' .'+id_t); elt.empty(); $(to_tess_href(c,caller_t.get_url(),data)).appendTo(elt); - $('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]').popover(); + $('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ":scope"}); }); } if(uri.startsWith("http://edamontology.org/")){ From 54b0abf72bb3b71813979f51c2d8900014735cf6 Mon Sep 17 00:00:00 2001 From: Git-Harshit Date: Mon, 2 Aug 2021 18:02:50 +0530 Subject: [PATCH 2/4] Update popver container with enhanced element selection --- js/tree-edam-stand-alone.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/tree-edam-stand-alone.js b/js/tree-edam-stand-alone.js index 2475be5..7980379 100644 --- a/js/tree-edam-stand-alone.js +++ b/js/tree-edam-stand-alone.js @@ -253,7 +253,7 @@ function interactive_edam_browser(){ var data_content=""; let msg; if(c>0){ - data_content = "title=\"Some associated elements\" data-toggle=\"popover\" data-placement=\"auto right\" data-trigger=\"hover\" data-html=\"true\" data-content=\""; + data_content = "title=\"Some associated elements\" data-toggle=\"popover\" data-placement=\"auto right\" data-trigger=\"hover focus\" data-html=\"true\" data-content=\"
"; var i=0; for(;i"; @@ -428,7 +428,7 @@ function interactive_edam_browser(){ }); } } - $('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ':scope [data-toggle="popover"]'}); + $('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_b+' [data-toggle="popover"]'}); }); } var caller_s=biosphere_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -441,7 +441,7 @@ function interactive_edam_browser(){ to_biosphere_href(c[0],caller_s.get_url(),data[0]) + ' by appliances, ' + to_biosphere_href(c[1],caller_s.get_url(),data[1]) + ' by tools.' + '').appendTo(elt); - $('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ":scope"}); + $('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_s+' [data-toggle="popover"]'}); }); } var caller_w=bioweb_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -451,7 +451,7 @@ function interactive_edam_browser(){ var elt=$('#details-'+identifier+' .'+id_w); elt.empty(); $(to_bioweb_href(c,caller_w.get_url(),data)).appendTo(elt); - $('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ":scope"}); + $('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_w+' [data-toggle="popover"]'}); }); } var caller_t=tess_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -461,7 +461,7 @@ function interactive_edam_browser(){ var elt=$('#details-'+identifier+' .'+id_t); elt.empty(); $(to_tess_href(c,caller_t.get_url(),data)).appendTo(elt); - $('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]').popover({trigger: 'hover focus', container: ":scope"}); + $('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_t+' [data-toggle="popover"]'}); }); } if(uri.startsWith("http://edamontology.org/")){ From 4d12490cd3f74efec9f48f4324b97cef6ea642ee Mon Sep 17 00:00:00 2001 From: Harshit Gupta Date: Thu, 11 Apr 2024 12:16:11 +0530 Subject: [PATCH 3/4] Add build_popover() for popover as suggested Uses a sub-function build_popover() that selects a given selector and initializes a popover for the given selector with its container binding to the same selector passed. Signed-off-by: Harshit Gupta --- js/tree-edam-stand-alone.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/tree-edam-stand-alone.js b/js/tree-edam-stand-alone.js index 9245d1f..223c4d7 100644 --- a/js/tree-edam-stand-alone.js +++ b/js/tree-edam-stand-alone.js @@ -303,6 +303,10 @@ function interactive_edam_browser(){ append_detail_panel_to_edam_accordion(d, uri, branch_of_term, identifier, details); } + function build_popover(selector){ + $(selector).popover({container: selector}); + } + function build_detail_panel (d, uri, branch_of_term, identifier, collapsed){ let details = ""; details += '
'; @@ -433,7 +437,7 @@ function interactive_edam_browser(){ }); } } - $('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_b+' [data-toggle="popover"]'}); + build_popover('#details-'+identifier+' .'+id_b+' [data-toggle="popover"]'); }); } var caller_s=biosphere_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -446,7 +450,7 @@ function interactive_edam_browser(){ to_biosphere_href(c[0],caller_s.get_url(),data[0]) + ' by appliances, ' + to_biosphere_href(c[1],caller_s.get_url(),data[1]) + ' by tools.' + '').appendTo(elt); - $('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_s+' [data-toggle="popover"]'}); + build_popover('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]'); }); } var caller_w=bioweb_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -456,7 +460,7 @@ function interactive_edam_browser(){ var elt=$('#details-'+identifier+' .'+id_w); elt.empty(); $(to_bioweb_href(c,caller_w.get_url(),data)).appendTo(elt); - $('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_w+' [data-toggle="popover"]'}); + build_popover('#details-'+identifier+' .'+id_w+' [data-toggle="popover"]'); }); } var caller_t=tess_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d); @@ -466,7 +470,7 @@ function interactive_edam_browser(){ var elt=$('#details-'+identifier+' .'+id_t); elt.empty(); $(to_tess_href(c,caller_t.get_url(),data)).appendTo(elt); - $('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]').popover({container: '#details-'+identifier+' .'+id_t+' [data-toggle="popover"]'}); + build_popover('#details-'+identifier+' .'+id_t+' [data-toggle="popover"]'); }); } if(uri.startsWith("http://edamontology.org/")){ From 913c68117fa097747a8d860203c3b5df24903a5a Mon Sep 17 00:00:00 2001 From: Harshit Gupta Date: Thu, 11 Apr 2024 12:56:03 +0530 Subject: [PATCH 4/4] Add classes to separate app and tool selection pop Uses css_classes to add class selector for generic_href as suggested to distinguish .app-liances and .tool-s for separate popover initialization to prevent unexpected popover switch on mouse hover. 'css_classes' has been carefully added as an optional parameter with default blank value on all callers of to_generic_href wrappers. Fix: #225 Signed-off-by: Harshit Gupta --- js/tree-edam-stand-alone.js | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/js/tree-edam-stand-alone.js b/js/tree-edam-stand-alone.js index 223c4d7..ae87d7c 100644 --- a/js/tree-edam-stand-alone.js +++ b/js/tree-edam-stand-alone.js @@ -213,8 +213,8 @@ function interactive_edam_browser(){ return data.next != null; } - function to_biotools_href(c,url,data){ - return to_generic_href(c,url,data,get_length_biotools,get_name_biotools,has_next_biotools); + function to_biotools_href(c,url,data,css_classes=""){ + return to_generic_href(c,url,data,css_classes,get_length_biotools,get_name_biotools,has_next_biotools); } function get_length_default(data){ @@ -233,23 +233,23 @@ function interactive_edam_browser(){ return false; } - function to_tess_href(c,url,data){ - return to_generic_href(c,url,data,get_length_default,get_name_tess,has_next_default); + function to_tess_href(c,url,data,css_classes=""){ + return to_generic_href(c,url,data,css_classes,get_length_default,get_name_tess,has_next_default); } - function to_biosphere_href(c,url,data){ - return to_generic_href(c,url,data,get_length_default,get_name_default,has_next_default); + function to_biosphere_href(c,url,data,css_classes=""){ + return to_generic_href(c,url,data,css_classes,get_length_default,get_name_default,has_next_default); } function get_name_bioweb(data, i){ return data[i].name; } - function to_bioweb_href(c,url,data){ - return to_generic_href(c,url,data,get_length_default,get_name_bioweb,has_next_default); + function to_bioweb_href(c,url,data,css_classes=""){ + return to_generic_href(c,url,data,css_classes,get_length_default,get_name_bioweb,has_next_default); } - function to_generic_href(c,url,data, get_length, get_name, has_next){ + function to_generic_href(c, url, data, css_classes, get_length, get_name, has_next){ var data_content=""; let msg; if(c>0){ @@ -258,6 +258,7 @@ function interactive_edam_browser(){ data_content += "data-placement=\"auto right\"" data_content += "data-trigger=\"hover focus\"" data_content += "data-html=\"true\"" + data_content += `class="${css_classes}"` data_content += "data-content=\"
"; var i=0; for(;i' + - to_biosphere_href(c[0],caller_s.get_url(),data[0]) + ' by appliances, ' + - to_biosphere_href(c[1],caller_s.get_url(),data[1]) + ' by tools.' + + to_biosphere_href(c[0],caller_s.get_url(),data[0],'app') + ' by appliances, ' + + to_biosphere_href(c[1],caller_s.get_url(),data[1],'tool') + ' by tools.' + '').appendTo(elt); - build_popover('#details-'+identifier+' .'+id_s+' [data-toggle="popover"]'); + build_popover('#details-'+identifier+' .'+id_s+' [data-toggle="popover"].app'); + build_popover('#details-'+identifier+' .'+id_s+' [data-toggle="popover"].tool'); }); } var caller_w=bioweb_api().get_for(current_branch, __my_interactive_tree.textAccessor()(d), uri, d);