From 4e6800f06759329f892ca8f40fcf50186b3785e1 Mon Sep 17 00:00:00 2001 From: Ziv Scully Date: Sun, 10 Aug 2014 13:40:53 -0400 Subject: Adds AJAX-oriented widget cpassword. --- lib/js/urweb.js | 12 ++++++++++++ lib/ur/basis.urs | 2 ++ 2 files changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/js/urweb.js b/lib/js/urweb.js index 76a900f7..5cc49fec 100644 --- a/lib/js/urweb.js +++ b/lib/js/urweb.js @@ -1050,6 +1050,18 @@ function inp(s, name) { return x; } +function password(s, name) { + if (suspendScripts) + return; + + var x = input(document.createElement("input"), s, + function(x) { return function(v) { if (x.value != v) x.value = v; }; }, "password", name); + x.value = s.data; + x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.value) }; + + return x; +} + function selectValue(x) { if (x.options.length == 0) return ""; diff --git a/lib/ur/basis.urs b/lib/ur/basis.urs index 8efed25b..39487aef 100644 --- a/lib/ur/basis.urs +++ b/lib/ur/basis.urs @@ -1013,6 +1013,8 @@ con cformTag = fn (attrs :: {Type}) (inner :: {Unit}) => val ctextbox : cformTag ([Value = string, Size = int, Source = source string, Placeholder = string, Onchange = transaction unit, Ontext = transaction unit] ++ boxAttrs) [] +val cpassword : cformTag ([Value = string, Size = int, Source = source string, Placeholder = string, Onchange = transaction unit, + Ontext = transaction unit] ++ boxAttrs) [] val button : cformTag ([Value = string] ++ boxAttrs) [] val ccheckbox : cformTag ([Value = bool, Size = int, Source = source bool, Onchange = transaction unit] ++ boxAttrs) [] -- cgit v1.2.3