//Checks (or unchecks) all the checkbox of the document function checkAll(state) { var boxes = new Array(); boxes = document.getElementsByTagName('input'); for (var i=0; i'; grey(true); } } //The callback of the preprocessing request function processing_callback(s) { var a = s.success; if(a == "false") { alert("Computation in progress, please wait."); } else { alert("Computation done"); } } //A common callback for list update function list_callback(s, id) { var listHTML = document.getElementById(id); listHTML.innerHTML = ""; var dv = document.createElement("div"); for (i in s) { var file = s[i].name; var dv = document.createElement("div"); dv.className = "checkbox-inline no_indent"; var options = ""; if(s[i].gt) options = 'class="blue" data-toggle="tooltip" title="This graph has a ground-truth"'; else { if(s[i].hasOwnProperty("description") && tooltips) { options += ' data-toggle="tooltip" title="' + s[i].description + '"'; //alert(options); } } dv.innerHTML = ''; listHTML.appendChild(dv); } } function raw_list_callback(s) { list_callback(s, "raw_list"); } function inputs_list_callback(s) { list_callback(s, "inputs_list"); } function methods_list_callback(s) { list_callback(s, "methods_list"); } function quality_list_callback(s) { list_callback(s, "quality_list"); } function comparison_list_callback(s) { list_callback(s, "comparison_list"); } //A tool that loops over the children and find the selected ones. It outputs an array of their value function list_selected_options(id) { var listHTML = document.getElementById(id); var listInputs = listHTML.getElementsByTagName("INPUT"); var res = []; for (var i = 0; i < listInputs.length; i++) { var e = listInputs[i]; if(e.checked) { res.push(e.value); } } return res; } //Outputs a JSON string of the selected whitelists //The object has 5 keys : //raw, inputs, methods, comparison and quality function json_whitelists() { return { raw: list_selected_options("raw_list"), inputs: list_selected_options("inputs_list"), methods: list_selected_options("methods_list"), comparison: list_selected_options("comparison_list"), quality: list_selected_options("quality_list") }; } function request_preprocessing() { var whitelist = JSON.stringify(json_whitelists()); request('preprocessing', whitelist, processing_callback); } function request_methods() { var whitelist = JSON.stringify(json_whitelists()); request('methods', whitelist, processing_callback); } function request_postprocessing(name) { var json = json_whitelists(); json.subproc = name; var whitelist = JSON.stringify(json); request('postprocess', whitelist, processing_callback); } /* Automatically shows the selected files from the file input */ function write_selected_files(list_id, button_id) { var list = document.getElementById(list_id); var files = document.getElementById(button_id).files; list.innerHTML = ""; var str = ""; if (typeof files !== "undefined") { for (var i=0, l=files.length; i'; list.appendChild(dv); } } else { alert("Your browser does not accept multiple file selection"); } }