From fee5d5a36f373f6d1f02bbddfbfa960f3af2f9dd Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Wed, 3 Feb 2016 15:33:02 +0100 Subject: css, tablesorter scientific notation --- js/debug.js | 17 ++++++++++++----- js/interface.js | 15 ++++++++------- 2 files changed, 20 insertions(+), 12 deletions(-) (limited to 'js') diff --git a/js/debug.js b/js/debug.js index b139ef9..3fab4c7 100644 --- a/js/debug.js +++ b/js/debug.js @@ -1,6 +1,5 @@ $().ready(function() { - // send commands using ajax $(".ajax").each(function(x) { $(this).click(function() { @@ -41,17 +40,26 @@ $().ready(function() }); // sortable tables + // src: http://stackoverflow.com/questions/4126206/javascript-parsefloat-1-23e-7-gives-1-23e-7-when-need-0-000000123 + $.tablesorter.addParser({ + id: 'scinot', + is: function(s) { + return /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/.test(s); + }, + format: function(s) { + return $.tablesorter.formatFloat(s); + }, + type: 'numeric' + }); $("table.sortable").each(function(x) { $(this).tablesorter({widgets: ['zebra']}); }); - - // k-best list feature tables $(".toggle").each(function(x) { $(this).click(function() { $(this).next().toggle(); }) }); - $("table.kbest_features tr:odd").css("background-color", "#eee"); + $("table.kbest_features tr:odd").css("background-color", "#87cefa"); $("table.kbest_features tr:even").css("background-color", "#fff"); // display svg @@ -65,6 +73,5 @@ $().ready(function() $(''+d+'') ); $("#original_svg").width($("#original_svg").children()[0].getBBox().width+"px"); - }); diff --git a/js/interface.js b/js/interface.js index 77a94bb..dbdba4e 100644 --- a/js/interface.js +++ b/js/interface.js @@ -89,7 +89,7 @@ var catch_return = function (e) { if (e.keyCode == 13) { e.preventDefault(); - Next(); + next(); } return false; @@ -281,10 +281,10 @@ var next = function () } // confirm to server - if (document.getElementById("init").value != "") { + /*if (document.getElementById("init").value != "") { var xhr_confirm = create_cors_req('get', base_url+":"+port+"/confirm"); xhr_confirm.send(); // FIXME handle errors - } + }*/ // build request var xhr = create_cors_req('post', next_url); @@ -293,8 +293,9 @@ var next = function () } xhr.onerror = function (e) { alert("XHR ERRROR 1x " + e.target.status); } xhr.send(JSON.stringify(send_data)); // send 'next' request - - poll(base_url+":"+port); + xhr.onload = function() { + poll(base_url+":"+port); + } } var request_and_process_next = function () @@ -473,7 +474,7 @@ var init_text_editor = function () * init site * */ -window.onload = function () +$().ready(function() { // reset vars document.getElementById("source").value = ""; @@ -498,5 +499,5 @@ window.onload = function () document.getElementById("textboxes").style.display = "block"; } -}; +}); -- cgit v1.2.3