diff options
Diffstat (limited to 'js')
-rw-r--r-- | js/app.ui.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/js/app.ui.js b/js/app.ui.js index c86b55a..230aa8f 100644 --- a/js/app.ui.js +++ b/js/app.ui.js @@ -87,6 +87,14 @@ function Ui() { $("#customDuration").addClass('ui-disabled'); } }); + + $('#customDuration').on('blur', function () { + var value = Math.abs(parseInt($(this).val())); + if (isNaN(value)) { + value = 0; + } + $(this).val(value); + }); }); $(".customDuration, #customDuration").on("tap change", function (e) { $("#yes_1").attr('checked', true).checkboxradio('refresh'); @@ -490,8 +498,11 @@ function Ui() { var value = parseInt($("#new_alarm input[type=radio]:checked").val(), 10); if(isNaN(value)) { - value = parseInt($("#customDuration").val(), 10); - }else{ + value = Math.abs(parseInt($("#customDuration").val())); + if (isNaN(value)) { + value = 0; + } + } else { $("#customDuration").val("").addClass('ui-disabled'); } return value; @@ -664,6 +675,7 @@ function Ui() { addEvent: function Ui_newEvent_addEvent(e) { e.preventDefault(); e.stopPropagation(); + app.switchAlarm(); var button = $('#add-event-btn'); if (!button.hasClass('disabled')) { button.addClass('disabled'); @@ -692,4 +704,4 @@ function Ui() { } }; -}());
\ No newline at end of file +}()); |