annotate NCBI Blast reference example_files/blast.js @ 107:ee2b105d772a

minor fix
author Jan Kanis <jan.code@jankanis.nl>
date Mon, 07 Jul 2014 12:20:28 +0200
parents 344cd76f6fd2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
1
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
2 function printfire()
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
3 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
4 // Firefox
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
5 if (document.createEvent && window.dispatchEvent) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
6 printfire.args = arguments;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
7 var ev = document.createEvent("Events");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
8 ev.initEvent("printfire", false, true);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
9 window.dispatchEvent(ev);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
10 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
11 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
12 //This functions handle setting defaults for protein or nulcleotide suite search page when
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
13 //one of blast program radio buttons is clicked - not used now
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
14 function AdjustMoreOptionsStyle()
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
15 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
16 var optsEl = document.getElementById("moreopts");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
17 if(optsEl && optsEl.style.height != "0px") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
18 optsEl.style.height = optsEl.scrollHeight + "px";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
19 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
20 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
21
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
22 //Strip (taxid:XXX) from organism list selection
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
23 //sgRunFunc="AdjustOrganism();"
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
24 function AdjustOrganism()
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
25 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
26 var words = $("qorganism").value.split(" (taxid");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
27 $("qorganism").value = words[0];
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
28 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
29
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
30
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
31 /* JS Common to all BLAST pages */
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
32
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
33
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
34 function setResultsTarget()
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
35 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
36 //var newWin = $("newwin");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
37 var newWin = this;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
38 var searchFrm = $(newWin.getAttribute("form"));
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
39 if(newWin && newWin.checked == true) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
40 if(newWin.getAttribute("winType") == "random") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
41 searchFrm.target = "Blast_Results_for_" + Math.floor(Math.pow(10,10) *Math.random());
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
42 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
43 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
44 searchFrm.target = $("resPageTarget").value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
45 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
46 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
47 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
48 searchFrm.target = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
49 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
50 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
51
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
52 function diffFromDefault(elem)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
53 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
54 var currentVal = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
55 var ret = 0;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
56
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
57 if (!(elem)) return;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
58 var defVal = elem.getAttribute("defVal"); //Default value
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
59 var elShowDiff = utils.getParent(elem);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
60 if(!elem.type) {//div element for example
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
61 //Check if parent elem has "hide" class
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
62 if(utils.hasClass(utils.getParent(elem), "hide")) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
63 currentVal = "hide";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
64 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
65 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
66 currentVal = "show";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
67 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
68 elShowDiff = elem;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
69 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
70 else if(elem.type == "select-one") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
71 if(elem[elem.selectedIndex].value) currentVal = elem[elem.selectedIndex].value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
72 //If Default value is not specified - the first one in the selection list is the default
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
73 if (!defVal && elem[0].value) defVal = elem[0].value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
74 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
75 else if(elem.type == "select-multiple") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
76 currentVal = "";//for now
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
77 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
78 else if(elem.type == "checkbox") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
79 //alert("defVal1=" + elem.id + " " + defVal);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
80 //var defVal = elem.defVal; //Default value
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
81 //alert("defVal2=" + defVal);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
82 if(elem.checked == true) currentVal = "checked"
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
83 else currentVal = "unchecked";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
84 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
85 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
86 currentVal = elem.value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
87 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
88
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
89
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
90 var numdiff = parseInt($("NUM_DIFFS").value,10);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
91 var optsNumDiff = parseInt($("NUM_OPTS_DIFFS").value,10);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
92 if(defVal != currentVal) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
93 if(!utils.hasClass(elShowDiff, "nondef")) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
94 utils.addClass(elShowDiff, "nondef");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
95 numdiff++;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
96 if(utils.hasClass(elem,"opts")) optsNumDiff++;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
97 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
98 ret = 1;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
99 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
100 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
101 if(utils.hasClass(elShowDiff, "nondef")) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
102 utils.removeClass(elShowDiff, "nondef");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
103 //alert("noDiff-" + elem.id);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
104 if(numdiff != 0) numdiff--;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
105 if(utils.hasClass(elem,"opts")) optsNumDiff--;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
106 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
107 ret=0;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
108 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
109 $("NUM_DIFFS").value = numdiff;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
110 $("NUM_OPTS_DIFFS").value = optsNumDiff;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
111 if(numdiff > 0) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
112 $("diffMes").style.display = "inline";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
113 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
114 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
115 $("diffMes").style.display = "none";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
116 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
117 //alert(elem.id + " " + $("NUM_DIFFS").value);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
118 return ret;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
119 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
120
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
121 function setDefalValue(elem)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
122 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
123 var currentVal;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
124 var defVal = elem.getAttribute("defVal"); //Default value
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
125 if(elem.type == "select-one") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
126 //If Default value is not specified - the first one in the selection list is the default
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
127 if(!defVal) defVal = elem[0].value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
128 for(j=0; j < elem.options.length; j++) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
129 if(elem.options[j].value == defVal) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
130 elem.options[j].selected = true;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
131 break;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
132 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
133 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
134 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
135 else if(elem.type == "checkbox" || elem.type == "radio") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
136 if(!defVal) defVal = "checked";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
137 if(defVal == "checked") elem.checked = true
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
138 else elem.checked = false;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
139 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
140 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
141 if(!defVal) defVal = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
142 elem.value = defVal;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
143 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
144
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
145 var elShowDiff = utils.getParent(elem);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
146 if(utils.hasClass(elShowDiff, "nondef")) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
147 utils.removeClass(elShowDiff, "nondef");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
148 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
149 //alert(elem.id + " " + $("NUM_DIFFS").value);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
150 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
151
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
152 function newResultsWinInit() {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
153 jQuery("[class='newwin']").each(function(index) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
154 utils.addEvent(this, "click", setResultsTarget, false);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
155 });
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
156 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
157
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
158 function resetOrganismSuggest(orgEntryElem)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
159 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
160 //suggestHint is in the hidden field used for SRA
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
161 var defaultMessage = ($("suggestHint")) ? $("suggestHint").value : "Enter organism name or id--completions will be suggested";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
162 var suggestHint = $("qorganism").getAttribute("suggestHint");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
163 if(suggestHint) defaultMessage = suggestHint;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
164 if(orgEntryElem.value == "") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
165 orgEntryElem.value = defaultMessage;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
166 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
167 if(orgEntryElem.value == defaultMessage) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
168 utils.addClass(orgEntryElem,"orgHint");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
169 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
170 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
171
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
172 function setupOrganismSuggest(orgEntryElem)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
173 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
174 resetOrganismSuggest(orgEntryElem);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
175 utils.addEvent(orgEntryElem, "focus", function() {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
176 clearOrgSuggest(orgEntryElem);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
177 }, false);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
178 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
179
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
180 function clearOrgSuggest(orgEntryElem)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
181 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
182 if(utils.hasClass(orgEntryElem,"orgHint")) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
183 orgEntryElem.value="";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
184 utils.removeClass(orgEntryElem,"orgHint");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
185 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
186 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
187
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
188 function InitCustomButton(bn)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
189 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
190 utils.addEvent(bn, "mouseover", function() {this.src = this.getAttribute("mouseovImg");}, false);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
191 utils.addEvent(bn, "mouseout", function() {this.src = this.getAttribute("mouseoutImg");}, false);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
192 utils.addEvent(bn, "mousedown", function() {this.src = this.getAttribute("mousedownImg");}, false);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
193 utils.addEvent(bn, "mouseup", function() {this.src = this.getAttribute("mouseupImg");}, false);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
194 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
195
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
196 function showHideElem(id,hide)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
197 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
198 if($(id)) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
199 if(hide) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
200 if(!utils.hasClass($(id),"hidden")) utils.addClass($(id), "hidden");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
201 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
202 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
203 if(utils.hasClass($(id),"hidden")) utils.removeClass($(id), "hidden");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
204 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
205 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
206 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
207
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
208 function resetOrganismControls(orgEntryElem) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
209 resetOrganismSuggest(orgEntryElem);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
210 if ($("orgExcl")) $("orgExcl").checked = false;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
211 utils.replaceInHtml("", $("orgs"));
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
212 if ($("frOrgs")) utils.replaceInHtml("", $("frOrgs"));
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
213 if ($("numOrg")) $("numOrg").value = 1;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
214 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
215
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
216 function AddOrgRow(e,orgName,exclName) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
217 e = e || window.event;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
218 utils.preventDefault(e);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
219 var checkedExclude = new Array();
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
220 var orgDict = jQuery($($("qorganism"))).ncbiautocomplete("option","dictionary");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
221 orgDict = (!orgDict || orgDict == "") ? "taxids_sg" : orgDict;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
222 var len = $("qorganism").getAttribute("size");
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
223
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
224 var newOrgFieldID = "qorganism" + $("numOrg").value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
225 var newOrgField = " <div><input name=\"" + orgName + $("numOrg").value + "\" size=\"" + len + "\" id=\"" + newOrgFieldID +
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
226 "\" type=\"text\" data-jigconfig=\"dictionary:'" + orgDict + "'\" autocomplete=\"off\" class=\"jig-ncbiautocomplete multiOrg\" />";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
227 if (exclName != "") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
228 newOrgField += "<span class=\"orgExcl\">" +
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
229 "<input type=\"checkbox\" name=\"" + exclName + $("numOrg").value + "\" class=\"oExcl cb\" id=\"orgExcl" + $("numOrg").value + "\" />" +
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
230 "<label for=\"orgExcl" + $("numOrg").value + "\" class=\"right oExclRl\">Exclude</label></span>";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
231 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
232 newOrgField += "</div>";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
233 if (navigator.userAgent.match(/ie/i)) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
234 for (i = 1; i < $("numOrg").value; i++) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
235 if ($("orgExcl" + i)) checkedExclude[i] = $("orgExcl" + i).checked;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
236 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
237 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
238 if (!navigator.userAgent.match(/firefox/i)) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
239 jQuery($($(orgs))).append(newOrgField,true);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
240 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
241 else {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
242 utils.insertInHtml(newOrgField, $("orgs"));
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
243 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
244
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
245 if (navigator.userAgent.match(/ie/i)) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
246 for (i = 1; i < $("numOrg").value; i++) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
247 if ($("orgExcl" + i)) $("orgExcl" + i).checked = checkedExclude[i];
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
248 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
249 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
250 setupOrganismSuggest($(newOrgFieldID));
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
251 jQuery($($(newOrgFieldID))).ncbiautocomplete();
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
252 $("numOrg").value++;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
253 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
254
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
255 function adjustOrgVal(orgEntryElem)
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
256 {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
257 //if (utils.hasClass($("searchForm").EQ_MENU, "orgHint")) $("searchForm").EQ_MENU.value = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
258 clearOrgSuggest(orgEntryElem);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
259 if ($("numOrg")) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
260 for (i = 1; i < $("numOrg").value; i++) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
261 if ($("qorganism" + i)) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
262 clearOrgSuggest($("qorganism" + i));
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
263 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
264 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
265 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
266 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
267
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
268 function getUrlCompForEntryField(elem) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
269 var url = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
270 if (elem && elem.value != "") {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
271 url = "&" + elem.name + "=" + escape(elem.value);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
272 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
273 return url;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
274 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
275
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
276
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
277 function getUrlCompForCheckedField(elem) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
278 var url = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
279 if (elem && elem.checked) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
280 url = "&" + elem.name + "=" + elem.value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
281 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
282 return url;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
283
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
284 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
285
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
286 function getUrlCompForOptionsField(elem) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
287 var url = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
288 if (elem) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
289 url = "&" + elem.name + "=" + elem[elem.selectedIndex].value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
290 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
291 return url;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
292 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
293
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
294 function getUrlCompForMultiOptionsField(elem) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
295 var url = "";
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
296 if (elem) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
297 for (i = 0; i < elem.options.length; i++) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
298 if (elem.options[i].selected) {
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
299 url += "&" + elem.name + "=" + elem.options[i].value;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
300 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
301 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
302 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
303 return url;
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
304 }
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
305
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
306
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
307 utils.addEvent(window, 'load', newResultsWinInit, false);
bad241dc701f add example input blast xml and output html page
Jan Kanis <jan.code@jankanis.nl>
parents:
diff changeset
308