$(function(){ if( $("#phrase_and_go").size() == 0 && $("#query_line").size() == 0 ){ return; // ignore this js file if no query area } // find button setup $("#stopBtn").hide().bind("click", function(){ $("#loading_line").css("visibility", "hidden"); if( window.stop ){ window.stop(); } else if( $.browser.msie ){ document.execCommand("Stop"); } $("#findBtn").show(); $("#stopBtn").hide(); }); $("#findBtn").click(function(){ // console.log("--\n find button clicked"); if( isSubmittable() ){ $("#loading_line").css("visibility", "visible"); // disable stop button for now // $("#findBtn").hide(); // $("#stopBtn").show(); // console.log("find button in submittable state"); // console.log("remove networks for other organisms"); $(".query_networks[organism!=" + $("#species_select").val() + "]").remove(); $(".query_network_group[organism!=" + $("#species_select").val() + "]").remove(); $("#relatedGenes").submit(); } else { // console.log("find button in NON submitable state"); $("#loading_line").css("visibility", "hidden"); function show_tooltip(msg, type){ $("#findBtn").qtip({ content: { text: msg, title: { text: 'Warning', button: '
Please enter at least one gene, or try this example gene list.
', "empty"); } else if( inGeneErrorState() ){ show_tooltip('Please enter at least one valid gene, and then try again.
', "no_valid_genes"); } else if( areNetworksReloading() ) { $("#loading_line").css("visibility", "visible"); // console.log("find button validation waiting for networks to reload"); var interval = setInterval(function(){ if( !areNetworksReloading() ){ clearInterval(interval); if( isSubmittable() ){ // console.log("submit after waiting for submit button"); $("#relatedGenes").submit(); } else { // console.log("try again after waiting for submit button"); $("#findBtn").click(); } } }, 100); } else if( uploadingNetwork() ) { $("#loading_line").css("visibility", "visible"); // console.log("find button validation waiting for networks to reload"); var interval = setInterval(function(){ if( !uploadingNetwork() ){ clearInterval(interval); if( isSubmittable() ){ // console.log("submit after waiting for submit button"); $("#relatedGenes").submit(); } else { // console.log("try again after waiting for submit button"); $("#findBtn").click(); } } }, 100); } else if( noNetworksSelected() ) { // console.log("no networks selected for find button"); show_tooltip('Please enable at least one network in the advanced options, or use the default networks.
', "no_networks_selected"); } else { // console.log("something else is wrong for submitting the find button"); } } }); });