diff --git a/www/js/util.js b/www/js/util.js index 372d19ce..e9653971 100644 --- a/www/js/util.js +++ b/www/js/util.js @@ -753,6 +753,17 @@ function applyOpts() { } function showPollMenu() { + function parseTimeout(t) { + var m; + if (m = t.match(/^(\d+):(\d+)$/)) { + return parseInt(m[1], 10) * 60 + parseInt(m[2], 10); + } else if (t.match(/^(\d+)$/)) { + return parseInt(m[1], 10); + } else { + throw new Error("Invalid timeout value '" + t + "'"); + } + } + $("#pollwrap .poll-menu").remove(); var menu = $("
").addClass("well poll-menu") .prependTo($("#pollwrap")); @@ -771,12 +782,20 @@ function showPollMenu() { .appendTo(menu); $("").text("Timeout (optional)").appendTo(menu); + $("

").text("If you specify a timeout, the poll will automatically " + + "be closed after that amount of time. You can either " + + "specify the number of seconds or use the format " + + "minutes:seconds. Examples: 90 (90 seconds), 5:30 " + + "(5 minutes, 30 seconds)") + .addClass("text-muted") + .appendTo(menu); var timeout = $("").addClass("form-control") .attr("type", "text") .appendTo(menu); + var timeoutError = null; var checkboxOuter = $("

").addClass("checkbox").appendTo(menu); - var lbl = $("