89a0fdc604f1c0f1a562519ac35a93bcb1cc06a7 kate Thu Nov 14 09:46:21 2013 -0800 Switch to relative URL for Ajax call (fixes http vs https access problem. Also remove server config, which was used during testing but unused (and causes cross-site access issues) diff --git src/hg/js/encodeProject.js src/hg/js/encodeProject.js index c34f627..258bc89 100644 --- src/hg/js/encodeProject.js +++ src/hg/js/encodeProject.js @@ -1,90 +1,81 @@ /* encodeProject - javascript utilities for ENCODE-specific things such as controlled vocabulary and experiment table Formatted: jsbeautify.py -j -k Syntax checked: jslint --indent=4 --plusplus=true --strict=false --browser=true */ /*global $ */ var encodeProject = (function () { // Configurable variables - change with setup function below - var server = "genome.ucsc.edu", - assembly = "hg19", + var assembly = "hg19", cgi = "/cgi-bin/hgEncodeApi?"; var accessionPrefix = 'wgEncodeE?'; var dataTypeLabelHash = {}, dataTypeTermHash = {}; var cellTypeTermHash = {}; var antibodyHash = {}, antibodyTargetHash = {}; // special handling for small RNA (next gen CV will have dataType for this) var smallRnaDataType = { "term": "SmallRnaSeq", "label": "Small RNA-seq", "dataGroup": "RNA Profiling", "description": "Small RNAs (<200 nt)" }; var smallRnaMatch = /rnaExtract=short/; var smallRnaSearchType = "RnaSeq"; var longRnaSearchType = "RnaSeq"; // Functions return { // Configuration setup: function (settings) { // Change defaults - if (settings.server) { - server = settings.server; - } if (settings.assembly) { assembly = settings.assembly; } }, getAssembly: function () { // Get currently set assembly return assembly; }, - getServer: function () { - // Get currently set server - return server; - }, - // Server interaction serverRequests: { // Requests for data from server API experiment: "cmd=experiments", dataType: "cmd=cv&type=dataType", cellType: "cmd=cv&type=cellType", antibody: "cmd=cv&type=antibody" }, loadAllFromServer: function (requests, handler) { // Execute requests to server via ajax var serverData = [], count = requests.length; $.each(requests, function (i, request) { - $.getJSON("http://" + server + cgi + request + "&" + "db=" + assembly, + $.getJSON(cgi + request + "&" + "db=" + assembly, function (data) { serverData[i] = data; if (--count === 0) { handler(serverData); } }); }); }, // Utility // Candidates for generic lib cmpNoCase: function (a, b) { // Case-insensitive sort. // Should be in a generic lib