From 8f045dcbe8d0beecbb1be1f4b420347d6c73c1ce Mon Sep 17 00:00:00 2001 From: Piotr Dabrowski Date: Thu, 29 Aug 2013 11:44:49 +0200 Subject: [PATCH] [ExercisePlanner] updated ExercisePlanner sources Change-Id: I1e1f3c9514ea17946def879085113db22015a532 --- js/UI.js | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/js/UI.js b/js/UI.js index e91c02d..d3fb667 100644 --- a/js/UI.js +++ b/js/UI.js @@ -50,7 +50,10 @@ function UI() { UI.prototype.popup = function (text, callback) { var i, popup = $("#popup"), buttons = {'Cancel': function () { $("#popup").popup('close') }}; - // to hide default button give {'Close': false} in callback + // to hide default button give {'Cancel': false} in callback + + // N_SE-49979 workaround to lock forbidden keys + this.lockTabKey(); for (i in callback) { if (callback.hasOwnProperty(i)) { @@ -74,6 +77,21 @@ function UI() { popup.trigger("create"); popup.popup('open', {positionTo: 'window'}); + + // N_SE-49979 workaround to unlock forbidden keys + popup.one("popupafterclose", function () { + $(document).off('keydown'); + }); + }; + + UI.prototype.lockTabKey = function () { + var key; + $(document).on('keydown', function(event) { + key = event.keyCode; + if (key === 9 || key === 38 || key === 40) { + event.preventDefault(); + } + }); }; UI.prototype.clearTabbars = function () { -- 2.7.4