From 9043754b69c64419c285a703daf203b87af70506 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 22 Sep 2015 09:40:29 +0200 Subject: Implement codeq.wait() that takes a promise and grays the screen until the promise is resolved. --- js/codeq.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/js/codeq.js b/js/codeq.js index 0ff78b2..702ccfa 100644 --- a/js/codeq.js +++ b/js/codeq.js @@ -736,4 +736,14 @@ window.phandler = null; // TODO: this is for debug only return n; }; + var jqDisabled = $('#disabled'), + waitCssEnter = {'cursor': 'wait', 'display': ''}; + + codeq.wait = function (promise) { + jqDisabled.css(waitCssEnter); + return promise.fin(function () { + jqDisabled.css('display', 'none'); + }); + }; + })(); -- cgit v1.2.1