X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/eae9e1cbfa56861ba9023f9f452786c369258fd4..f42e40712e1a20d9e6ca1e497123a0c16c83be82:/website/js/nominatim-ui.js diff --git a/website/js/nominatim-ui.js b/website/js/nominatim-ui.js index e96ebd25..32e7cbda 100644 --- a/website/js/nominatim-ui.js +++ b/website/js/nominatim-ui.js @@ -273,6 +273,30 @@ jQuery(document).ready(function(){ }); +jQuery(document).ready(function(){ + + if ( !$('#details-index-page').length ){ return; } + + $('#form-by-type-and-id,#form-by-osm-url').on('submit', function(e){ + e.preventDefault(); + + var val = $(this).find('input[type=edit]').val(); + var matches = val.match(/^\s*([NWR])(\d+)\s*$/i); + + if (!matches) { + matches = val.match(/\/(relation|way|node)\/(\d+)\s*$/); + } + + if (matches) { + $(this).find('input[name=osmtype]').val(matches[1].charAt(0).toUpperCase()); + $(this).find('input[name=osmid]').val(matches[2]); + $(this).get(0).submit(); + } else { + alert('invalid input'); + } + }); +}); + jQuery(document).ready(function(){ if ( !$('#details-page').length ){ return; }