+<script>
+ function handleFormSubmit(event) {
+
+ let form_el = event.target;
+ let val = form_el.querySelector('input[type=edit]').value;
+ let matches = val.match(/^\s*([NWR])(\d+)\s*$/i);
+
+ if (!matches) {
+ matches = val.match(/\/(relation|way|node)\/(\d+)\s*$/);
+ }
+
+ if (!matches) {
+ alert('invalid input');
+ return;
+ }
+
+ form_el.querySelector('input[name=osmtype]').setAttribute('value', matches[1].charAt(0).toUpperCase());
+ form_el.querySelector('input[name=osmid]').setAttribute('value', matches[2]);
+ form_el.submit();
+ }
+</script>