Mercurial > urweb
comparison lib/js/urweb.js @ 1491:b2ca3e1e5b40
Fixes for detecting pastes and autocompletes for dynamic textboxes
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Fri, 15 Jul 2011 10:02:54 -0400 |
parents | 290de2dcecf6 |
children | 3c0803c1acd7 |
comparison
equal
deleted
inserted
replaced
1490:a77fa7e7bb7b | 1491:b2ca3e1e5b40 |
---|---|
275 | 275 |
276 function sc(v) { | 276 function sc(v) { |
277 return {data : v, dyns : null}; | 277 return {data : v, dyns : null}; |
278 } | 278 } |
279 function sv(s, v) { | 279 function sv(s, v) { |
280 s.data = v; | 280 if (s.data != v) { |
281 | 281 s.data = v; |
282 for (var ls = s.dyns; ls; ls = ls.next) | 282 |
283 if (!ls.dead) | 283 for (var ls = s.dyns; ls; ls = ls.next) |
284 populate(ls.data); | 284 if (!ls.dead) |
285 populate(ls.data); | |
286 } | |
285 } | 287 } |
286 function sg(s) { | 288 function sg(s) { |
287 return s.data; | 289 return s.data; |
288 } | 290 } |
289 | 291 |
489 | 491 |
490 function inp(s, name) { | 492 function inp(s, name) { |
491 var x = input(document.createElement("input"), s, | 493 var x = input(document.createElement("input"), s, |
492 function(x) { return function(v) { if (x.value != v) x.value = v; }; }, null, name); | 494 function(x) { return function(v) { if (x.value != v) x.value = v; }; }, null, name); |
493 x.value = s.data; | 495 x.value = s.data; |
494 x.onkeyup = function() { sv(s, x.value) }; | 496 x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.value) }; |
495 | 497 |
496 return x; | 498 return x; |
497 } | 499 } |
498 | 500 |
499 function selectValue(x) { | 501 function selectValue(x) { |
543 | 545 |
544 function tbx(s) { | 546 function tbx(s) { |
545 var x = input(document.createElement("textarea"), s, | 547 var x = input(document.createElement("textarea"), s, |
546 function(x) { return function(v) { if (x.innerHTML != v) x.innerHTML = v; }; }); | 548 function(x) { return function(v) { if (x.innerHTML != v) x.innerHTML = v; }; }); |
547 x.innerHTML = s.data; | 549 x.innerHTML = s.data; |
548 x.onkeyup = function() { sv(s, x.value) }; | 550 x.onkeyup = x.oninput = x.onchange = x.onpropertychange = function() { sv(s, x.value) }; |
549 | 551 |
550 return x; | 552 return x; |
551 } | 553 } |
552 | 554 |
553 function addOnChange(x, f) { | 555 function addOnChange(x, f) { |