// snip_viz_HTML_config_loader.js // This gets the configuration data from the HTML attributes. // does initial HTML creation and then calls // getDataCreateSNPViewer in the file snip_viz_get_fasta_newick_data_external_file.js // to build the SNP viewer // JavaScript directive: all variables have to be declared with "var", maybe other things "use strict"; $(document).ready(function(){ var snpViewerRootDivCounter = 0; var snpViewerCounter = 0; ///////////////////////////////////////////////////// // var createSnpViewersForARootDiv = function( rootElement ) { snpViewerRootDivCounter++; var $rootElement = $(rootElement); var haveDNAFastaFile = false; var haveProteinFastaFile = false; //
var snp_viewer_dna_fasta_file = $rootElement.attr("snp-viewer-dna-fasta-file"); var snp_viewer_dna_newick_file = $rootElement.attr("snp-viewer-dna-newick-file"); var snp_viewer_protein_fasta_file = $rootElement.attr("snp-viewer-protein-fasta-file"); var snp_viewer_protein_newick_file = $rootElement.attr("snp-viewer-protein-newick-file"); // Create the needed internal HTML var htmlMainBlock = ''; var $htmlMainBlock = $( htmlMainBlock ).appendTo( $rootElement ); if ( snp_viewer_dna_fasta_file !== undefined && snp_viewer_dna_fasta_file !== '' ) { haveDNAFastaFile = true; } if ( snp_viewer_protein_fasta_file !== undefined && snp_viewer_protein_fasta_file !== '' ) { haveProteinFastaFile = true; } if ( ! haveDNAFastaFile && ! haveProteinFastaFile ) { $rootElement.html("Neither SNP viewer attribute ('snp-viewer-dna-fasta-file' and 'snp-viewer-protein-fasta-file') found on this div. Unable to create SNP viewer."); return; // EXITTING FUNCTION } // for divs var snpViewerRootBlockDNA_Id = "snp-viewer-root-block-dna-" + snpViewerRootDivCounter; var snpViewerRootBlockProtein_Id = "snp-viewer-root-block-protein-" + snpViewerRootDivCounter; // for links var snpViewerSelectRootBlockDNA_Id = "snp-viewer-select-root-block-dna-" + snpViewerRootDivCounter; var snpViewerSelectRootBlockProtein_Id = "snp-viewer-select-root-block-protein-" + snpViewerRootDivCounter; if ( haveDNAFastaFile && haveProteinFastaFile ) { } // '