From b325bae3528fe9f2dcc86809a77a2e9cf5876d1b Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Sat, 19 Nov 2016 15:34:37 +0800 Subject: webui: configs: Add pixel resolution note for "common/nside" * Calculate pixel resolution note on pressing "Enter" in "common/nside" * Update the pixel resolution note as well as "common/lmax" when "common/nside" changed. --- fg21sim/webui/static/js/configs.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'fg21sim/webui/static/js') diff --git a/fg21sim/webui/static/js/configs.js b/fg21sim/webui/static/js/configs.js index e1e9a93..f7e3731 100644 --- a/fg21sim/webui/static/js/configs.js +++ b/fg21sim/webui/static/js/configs.js @@ -597,4 +597,28 @@ $(document).ready(function () { .then(function () { return validateServerConfigs(ajax_url); }) .done(function () { updateFormConfigStatus(); }); }); + + // When field "common/nside" changed, update the resolution note, as well + // as the maximum multiple "common/lmax" + $("#conf-form input[name='common/nside']").on("change", function (e) { + var nside = parseInt($(this).val()); + // Update the resolution note (unit: arcmin) + var resolution = Math.sqrt(3/Math.PI) * 3600 / nside; + $(this).closest(".form-group").find(".note > .value") + .text(resolution.toFixed(2)); + // Also update the maximum multipole "common/lmax" + if (! isNaN(nside)) { + var lmax = 3 * nside - 1; + $("#conf-form input[name='common/lmax']").val(lmax).trigger("change"); + } + }); + $("#conf-form input[name='common/nside']").keypress(function (e) { + if (e.which === 13) { + var nside = parseInt($(this).val()); + // Update the resolution note (unit: arcmin) + var resolution = Math.sqrt(3/Math.PI) * 3600 / nside; + $(this).closest(".form-group").find(".note > .value") + .text(resolution.toFixed(2)); + } + }); }); -- cgit v1.2.2