From e3c84aaea84d0999b1c864427856a666075cc66a Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Thu, 16 Jun 2016 06:46:53 +0000 Subject: Menu: refactoring scoped vars --- .../static/new/javascript/dataset_select_menu.js | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'wqflask') diff --git a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js index 8c04b4cb..88a91ed2 100644 --- a/wqflask/wqflask/static/new/javascript/dataset_select_menu.js +++ b/wqflask/wqflask/static/new/javascript/dataset_select_menu.js @@ -1,14 +1,14 @@ // Generated by CoffeeScript 1.8.0 $(function() { - var apply_default, check_search_term, dataset_info, group_info, make_default, open_window, populate_dataset, populate_group, populate_species, populate_type, process_json, redo_dropdown, gndata; - process_json = function(data) { - populate_species(); - return apply_default(); - }; - $.ajax('/static/new/javascript/dataset_menu_structure.json', { - dataType: 'json', - success: process_json - }); + var gndata; // loaded once for all to use + process_json = function(data) { + populate_species(); + return apply_default(); + }; + // $.ajax('/static/new/javascript/dataset_menu_structure.json', { + // dataType: 'json', + // success: process_json + // }); $.getJSON("http://localhost:8880/int/menu/main.json", function(data) { gndata = data; @@ -20,7 +20,7 @@ $(function() { alert("ERROR: GN_SERVER internal REST API is not responding"); }); - populate_species = function() { + var populate_species = function() { var species = gndata.species.map(function(item) { return item.slice(1,3); }); @@ -29,7 +29,7 @@ $(function() { }; window.populate_species = populate_species; - populate_group = function() { + var populate_group = function() { var species = $('#species').val(); var groups = gndata.groups[species].map(function(item) { return item.slice(1,3); @@ -39,7 +39,7 @@ $(function() { }; window.populate_group = populate_group; - populate_type = function() { + var populate_type = function() { var species = $('#species').val(); var group = $('#group').val(); var type_list = gndata.types[species][group].map(function(item) { @@ -50,7 +50,7 @@ $(function() { }; window.populate_type = populate_type; - populate_dataset = function() { + var populate_dataset = function() { var species = $('#species').val(); var group = $('#group').val(); var type = $('#type').val(); @@ -62,7 +62,7 @@ $(function() { }; window.populate_dataset = populate_dataset; - redo_dropdown = function(dropdown, items) { + var redo_dropdown = function(dropdown, items) { var item, _i, _len, _results; console.log("in redo:", dropdown, items); dropdown.empty(); @@ -97,7 +97,7 @@ $(function() { options = "menubar=1,toolbar=1,location=1,resizable=1,status=1,scrollbars=1,directories=1,width=900"; return open(url, name, options).focus(); }; - group_info = function() { + var group_info = function() { var group, species, url; species = $('#species').val(); group = $('#group').val(); @@ -105,14 +105,14 @@ $(function() { return open_window(url, "Group Info"); }; $('#group_info').click(group_info); - dataset_info = function() { + var dataset_info = function() { var dataset, url; accession_id = $('#dataset option:selected').data("id"); url = "http://genenetwork.org/webqtl/main.py?FormID=sharinginfo&GN_AccessionId=" + accession_id; return open_window(url, "Dataset Info"); }; $('#dataset_info').click(dataset_info); - make_default = function() { + var make_default = function() { var holder, item, jholder, _i, _len, _ref; alert("The current settings are now your default.") holder = {}; @@ -126,7 +126,7 @@ $(function() { expires: 365 }); }; - apply_default = function() { + var apply_default = function() { var defaults, item, populate_function, _i, _len, _ref, _results; defaults = $.cookie('search_defaults'); if (defaults) { @@ -154,7 +154,7 @@ $(function() { } return _results; }; - check_search_term = function() { + var check_search_term = function() { var or_search_term, and_search_term; or_search_term = $('#or_search').val(); and_search_term = $('#and_search').val(); -- cgit v1.2.3