diff options
author | Adam Chlipala <adam@chlipala.net> | 2010-08-22 19:45:07 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2010-08-22 19:45:07 -0400 |
commit | 746a9d987a0bfe2b3a4d8cd7c7bb4ace819beb2e (patch) | |
tree | 08a964618ad4f7fd569d5f7670fe5786ed4a878d /lib | |
parent | 7765b90d25f98bd9eb0cf2998121e51d4551f733 (diff) |
Confirm boxes; proper event handler setting for ctags
Diffstat (limited to 'lib')
-rw-r--r-- | lib/js/urweb.js | 22 | ||||
-rw-r--r-- | lib/ur/basis.urs | 1 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 6215a54c..8ca6b89c 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -512,7 +512,18 @@ function tbx(s) { function addOnChange(x, f) { var old = x.onchange; - x.onchange = function() { old(); f (); }; + if (old == null) + x.onchange = f; + else + x.onchange = function() { old(); f(); }; +} + +function addOnKeyUp(x, f) { + var old = x.onkeyup; + if (old == null) + x.onkeyup = f; + else + x.onkeyup = function(x) { old(x); f(x); }; } @@ -893,7 +904,7 @@ function sp(e) { var uw_event = null; function kc() { - return window.event ? uw_event.keyCode : uw_event.which; + return window.event ? event.keyCode : (uw_event ? uw_event.keyCode : 0); } @@ -1164,5 +1175,12 @@ function execF(f, x) { } +// Wrappers + +function confrm(s) { + return confirm(s) ? true : false; +} + + // App-specific code diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index d9967d12..5ed616a0 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -158,6 +158,7 @@ val clearCookie : t ::: Type -> http_cookie t -> transaction unit (** JavaScript-y gadgets *) val alert : string -> transaction unit +val confirm : string -> transaction bool val spawn : transaction unit -> transaction unit val sleep : int -> transaction unit |