Mercurial > urweb
comparison lib/js/urweb.js @ 2220:794017f378de
Merge.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Mon, 24 Nov 2014 20:47:38 -0500 |
parents | f05fcb206571 |
children | 9272476e2a1c |
comparison
equal
deleted
inserted
replaced
2219:ff38b3e0cdfd | 2220:794017f378de |
---|---|
1036 populate(x); | 1036 populate(x); |
1037 | 1037 |
1038 return x; | 1038 return x; |
1039 } | 1039 } |
1040 | 1040 |
1041 function inp(s, name) { | 1041 function inpt(type, s, name) { |
1042 if (suspendScripts) | 1042 if (suspendScripts) |
1043 return; | 1043 return; |
1044 | 1044 |
1045 var x = input(document.createElement("input"), s, | 1045 var x = input(document.createElement("input"), s, |
1046 function(x) { return function(v) { if (x.value != v) x.value = v; }; }, "text", name); | 1046 function(x) { return function(v) { if (x.value != v) x.value = v; }; }, type, name); |
1047 x.value = s.data; | 1047 x.value = s.data; |
1048 x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.value) }; | 1048 x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.value) }; |
1049 | 1049 |
1050 return x; | 1050 return x; |
1051 } | 1051 } |
1052 | 1052 |
1053 function inp(s, name) { | |
1054 return inpt("text", s, name); | |
1055 } | |
1056 | |
1053 function password(s, name) { | 1057 function password(s, name) { |
1054 if (suspendScripts) | 1058 return inpt("password", s, name); |
1055 return; | 1059 } |
1056 | 1060 |
1057 var x = input(document.createElement("input"), s, | 1061 function email(s, name) { |
1058 function(x) { return function(v) { if (x.value != v) x.value = v; }; }, "password", name); | 1062 return inpt("email", s, name); |
1059 x.value = s.data; | 1063 } |
1060 x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.value) }; | 1064 |
1061 | 1065 function search(s, name) { |
1062 return x; | 1066 return inpt("search", s, name); |
1063 } | 1067 } |
1068 | |
1069 function url(s, name) { | |
1070 return inpt("url", s, name); | |
1071 } | |
1072 | |
1073 function tel(s, name) { | |
1074 return inpt("tel", s, name); | |
1075 } | |
1076 | |
1077 function color(s, name) { | |
1078 return inpt("color", s, name); | |
1079 } | |
1080 | |
1081 function number(s, name) { | |
1082 return inpt("number", s, name); | |
1083 } | |
1084 | |
1085 function range(s, name) { | |
1086 return inpt("range", s, name); | |
1087 } | |
1088 | |
1089 function date(s, name) { | |
1090 return inpt("date", s, name); | |
1091 } | |
1092 | |
1093 function datetime(s, name) { | |
1094 return inpt("datetime", s, name); | |
1095 } | |
1096 | |
1097 function datetime_local(s, name) { | |
1098 return inpt("datetime-local", s, name); | |
1099 } | |
1100 | |
1101 function month(s, name) { | |
1102 return inpt("month", s, name); | |
1103 } | |
1104 | |
1105 function week(s, name) { | |
1106 return inpt("week", s, name); | |
1107 } | |
1108 | |
1109 function time(s, name) { | |
1110 return inpt("time", s, name); | |
1111 } | |
1112 | |
1064 | 1113 |
1065 function selectValue(x) { | 1114 function selectValue(x) { |
1066 if (x.options.length == 0) | 1115 if (x.options.length == 0) |
1067 return ""; | 1116 return ""; |
1068 else | 1117 else |