summaryrefslogtreecommitdiff
path: root/js/debug.js
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2016-02-17 18:05:27 +0100
committerPatrick Simianer <p@simianer.de>2016-02-17 18:05:27 +0100
commit53e8b1106a1ebaf13a5482477b67e04aacd4405d (patch)
treeabc62f03d0306a780a9f9cbf1a869925fdfc235f /js/debug.js
parentaa2832b55b1b9825ad626aa0483a97c5ba9c991c (diff)
prep/notes for beta test, get feature weights/rates
Diffstat (limited to 'js/debug.js')
-rw-r--r--js/debug.js40
1 files changed, 38 insertions, 2 deletions
diff --git a/js/debug.js b/js/debug.js
index 3fab4c7..cd5882b 100644
--- a/js/debug.js
+++ b/js/debug.js
@@ -1,5 +1,15 @@
-$().ready(function()
+var poll = function (url_prefix)
{
+ setTimeout(function(){
+ $.get(url_prefix+"/status_debug").done(function(response){
+ $("#status").text(response);
+ poll(url_prefix);
+ });
+ }, 3000);
+}
+
+$().ready(function() {
+
// send commands using ajax
$(".ajax").each(function(x) {
$(this).click(function() {
@@ -10,15 +20,19 @@ $().ready(function()
})
$("#features").click(function() { if (this.value=="Feature") this.value = ""; });
$("#features").focusout(function() { if (this.value == "") this.value = "Feature"; });
+ $("#features_get").click(function() { if (this.value=="Feature") this.value = ""; });
+ $("#features_get").focusout(function() { if (this.value == "") this.value = "Feature"; });
$("#features_value").click(function() { this.value = ""; });
$("#features_value").focusout(function() { if (this.value == "") this.value = "1e-05"; });
+ $("#features_value_get").click(function() { this.value = ""; });
+ $("#features_value_get").focusout(function() { if (this.value == "") this.value = "1e-05"; });
$("#feature_groups_value").click(function() { this.value = ""; });
$("#feature_groups_value").focusout(function() { if (this.value == "") this.value = "1e-05"; });
// set all sorts of learning rates
$("#set_features").click(function() {
k = $("#features").val();
v = $("#features_value").val();
- if (k=="Feature" || k=="" || v=="" || !parseFloat(v)) {
+ if (k=="Feature" || k=="" || v=="" || isNaN(parseFloat(v))) {
alert("Malformed request.");
} else {
url_prefix = $("#features_type").val();
@@ -73,5 +87,27 @@ $().ready(function()
$('<svg width="100%">'+d+'</svg>')
);
$("#original_svg").width($("#original_svg").children()[0].getBBox().width+"px");
+
+ // mark stale content
+ if ($("#up_val").text() != "true") {
+ $(".updated").each(function(i,el){$(el).addClass("stale")})
+ }
+
+ poll("http://"+document.URL.split("/")[2]);
+
+ $("#get_features").click(function () {
+ $.get("http://"+document.URL.split("/")[2]+$("#features_type_get").val()+"/"+$("#features_get").val(),
+ function (data) {
+ $("#features_value_get").val(data);
+ });
+ });
+
+ $("#get_feature_groups").click(function () {
+ $.get("http://"+document.URL.split("/")[2]+"/get_rate/"+$("#feature_groups_get").val(),
+ function (data) {
+ $("#feature_groups_value_get").val(data);
+ });
+ });
+
});