diff options
author | Alexander_Kabui | 2024-09-23 11:38:36 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-09-23 11:38:36 +0300 |
commit | 7613298d6c427f4f3cfd3bd843e6d41099cba125 (patch) | |
tree | eed21d816fc8be0ea407b96226850850854a88fd /gn2/wqflask/templates/index_page.html | |
parent | 0b357115d88a38a4c0f128671636a37e2b5287c0 (diff) | |
download | genenetwork2-7613298d6c427f4f3cfd3bd843e6d41099cba125.tar.gz |
Refactor: move global search js to index file.
Diffstat (limited to 'gn2/wqflask/templates/index_page.html')
-rwxr-xr-x | gn2/wqflask/templates/index_page.html | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/gn2/wqflask/templates/index_page.html b/gn2/wqflask/templates/index_page.html index b836cbb1..216e1c38 100755 --- a/gn2/wqflask/templates/index_page.html +++ b/gn2/wqflask/templates/index_page.html @@ -418,11 +418,51 @@ {%endblock%} {% block js %} - - <script src="/static/new/javascript/dataset_select_menu_orig.js"></script> - - - <script type="text/javascript"> + +<script src="/static/new/javascript/search_autocomplete.js"></script> +<script src="/static/new/javascript/dataset_select_menu_orig.js"></script> + + <script type="text/javascript"> + $(document).ready(function() { + + const urlParams = new URLSearchParams(window.location.search) + let term = urlParams.get("terms") + + //should web scrap + var global_search_hint = [ + "cytochrome", + "cytochrome AND P450", + "cytochrome NEAR P450", + "cytochrome -P450", + "cytochrome NOT P450", + "species:human", + "group:BXD", + "Hs:chr4:9930021 species:mouse", + "Hs:chr4:9130000..9980000 species:mouse", + "mean:5..7", + "mean:7..", + "Hs:chr4:9930021", + "Hs:chr4:9930021 species:mouse", + "Hs:chr4:9130000..9980000 species:mouse", + "bx*", + "*" + ] + autocomplete(document.getElementById("term"), global_search_hint); + $("#term").keyup(function(event) { + if (event.keyCode === 13) { + event.preventDefault(); + $('#globalsearchform').attr('action', "/gsearch").submit(); + if ($("#term").val().trim() != "") { + saveBeforeSubmit($("#term").val().trim()) + $("#globalsearchform")[0].submit(); + } + + } + }) + + }); +</script> + <script type="text/javascript"> $(document).on('submit', '#searchform', function(event){ |