From: Marek VavruĊĦa Date: Thu, 22 Oct 2015 10:06:51 +0000 (+0200) Subject: modules/tinyweb: added easing on the map contrast X-Git-Tag: v1.0.0-beta2~68 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bf9dcfbdcc84f0e9d4cd7bdd82e6ad2ff7656f13;p=thirdparty%2Fknot-resolver.git modules/tinyweb: added easing on the map contrast --- diff --git a/modules/tinyweb/tinyweb.go b/modules/tinyweb/tinyweb.go index 8a3277959..cbcd2bbcf 100644 --- a/modules/tinyweb/tinyweb.go +++ b/modules/tinyweb/tinyweb.go @@ -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 } diff --git a/modules/tinyweb/tinyweb/tinyweb.js b/modules/tinyweb/tinyweb/tinyweb.js index 2b7b60a57..40f1c20a6 100644 --- a/modules/tinyweb/tinyweb/tinyweb.js +++ b/modules/tinyweb/tinyweb/tinyweb.js @@ -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 +}