]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
modules/tinyweb: added easing on the map contrast
authorMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 22 Oct 2015 10:06:51 +0000 (12:06 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Thu, 22 Oct 2015 10:06:51 +0000 (12:06 +0200)
modules/tinyweb/tinyweb.go
modules/tinyweb/tinyweb/tinyweb.js

index 8a3277959f5165ab17c664cb2cb37cbaa4da4f27..cbcd2bbcfd4c8494a5db4a895827240497f7176b 100644 (file)
@@ -195,6 +195,7 @@ func tinyweb_config(module *C.struct_kr_module, conf *C.char) int {
        http.HandleFunc("/", serve_page)
        // @todo Not sure how to cancel this routine yet
        // wg.Add(1)
+       fmt.Printf("[tinyweb] listening on %s\n", addr)
        go http.ListenAndServe(addr, nil)
        return 0
 }
index 2b7b60a57c56928a566689c349918dcc705dc4be..40f1c20a64dba049aafb07fd6d9eb6bf8633aa4a 100644 (file)
@@ -22,14 +22,16 @@ window.onload = function() {
        });
        /* Realtime updates */ 
        function poller(feed, interval, cb) {
-               setInterval(function () {
+               var func = function() {
                        $.ajax({
                                url: feed,
                                type: 'get',
                                dataType: 'json',
                                success: cb
                        });
-               }, interval);
+               }
+               setInterval(func, interval);
+               func();
        }
        poller('stats', 1000, function(resp) {
                var now = Date.now();
@@ -81,8 +83,8 @@ window.onload = function() {
                /* Normalize, convert to HSL. */
                for (var key in update) {
                        var ratio = 1.0 - update[key]/max;
-                       update[key] = 'hsl(205,70%,' + Math.floor(20.0 + 70.0 * ratio) + '%)'
+                       update[key] = 'hsl(205,70%,' + Math.floor(10.0 + 70.0 * (ratio * ratio)) + '%)'
                }
                map.updateChoropleth(update);
        });
-}
\ No newline at end of file
+}