comparison lib/js/urweb.js @ 1290:6791454653c5

Confirm boxes; proper event handler setting for ctags
author Adam Chlipala <adam@chlipala.net>
date Sun, 22 Aug 2010 19:45:07 -0400
parents 003df929ee08
children 0d8bd8ae8417
comparison
equal deleted inserted replaced
1289:3b22c3c67f35 1290:6791454653c5
510 return x; 510 return x;
511 } 511 }
512 512
513 function addOnChange(x, f) { 513 function addOnChange(x, f) {
514 var old = x.onchange; 514 var old = x.onchange;
515 x.onchange = function() { old(); f (); }; 515 if (old == null)
516 x.onchange = f;
517 else
518 x.onchange = function() { old(); f(); };
519 }
520
521 function addOnKeyUp(x, f) {
522 var old = x.onkeyup;
523 if (old == null)
524 x.onkeyup = f;
525 else
526 x.onkeyup = function(x) { old(x); f(x); };
516 } 527 }
517 528
518 529
519 // Basic string operations 530 // Basic string operations
520 531
891 // Key events 902 // Key events
892 903
893 var uw_event = null; 904 var uw_event = null;
894 905
895 function kc() { 906 function kc() {
896 return window.event ? uw_event.keyCode : uw_event.which; 907 return window.event ? event.keyCode : (uw_event ? uw_event.keyCode : 0);
897 } 908 }
898 909
899 910
900 // The Ur interpreter 911 // The Ur interpreter
901 912
1162 function execF(f, x) { 1173 function execF(f, x) {
1163 return exec0(cons(x, f.env), f.body); 1174 return exec0(cons(x, f.env), f.body);
1164 } 1175 }
1165 1176
1166 1177
1178 // Wrappers
1179
1180 function confrm(s) {
1181 return confirm(s) ? true : false;
1182 }
1183
1184
1167 // App-specific code 1185 // App-specific code
1168 1186