67 lines
No EOL
1.9 KiB
HTML
67 lines
No EOL
1.9 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no"/>
|
|
<title>Ticketfinder</title>
|
|
<link rel="stylesheet" href="/auer/static/inline.min.css"/>
|
|
<script src="/auer/static/jquery-3.6.0.min.js"></script>
|
|
<script src="/auer/static/jquery.autocomplete.min.js"></script>
|
|
</head>
|
|
<body class="loading">
|
|
|
|
<header>
|
|
<h1 class="link search">Ticketfinder</h1>
|
|
</header>
|
|
|
|
<div id="bps">
|
|
<form method="post">
|
|
<p><input type="search" placeholder="Starthaltestelle" id="from" autocomplete="off" autofocus></p>
|
|
<p><input type="search" placeholder="Zielhaltestelle" id="to" autocomplete="off" autofocus></p>
|
|
<input type="hidden" name="from"/>
|
|
<input type="hidden" name="to"/>
|
|
<p><input type="submit" vaue="Los!"/></p>
|
|
</form>
|
|
</div>
|
|
|
|
<script>
|
|
$('input[type=search]').autocomplete({
|
|
minChars: 2,
|
|
autoSelectFirst: true,
|
|
paramName: 'name_sf',
|
|
dataType: 'json',
|
|
serviceUrl: 'https://www3.vvs.de/mngvvs/XML_STOPFINDER_REQUEST?SpEncId=0&coordOutputFormat=EPSG:4326&serverInfo=1&suggestApp=vvs&type_sf=any&version=10.2.10.139&suggest_macro=vvs',
|
|
transformResult: transform,
|
|
onSelect: function (suggestion) {
|
|
console.log(suggestion.data);
|
|
$("input[name="+$(this).attr('id')+"]").val(suggestion.data);
|
|
}
|
|
});
|
|
|
|
function transform (data) {
|
|
var result = [];
|
|
$.each(data.stopFinder.points, function( index, val ) {
|
|
if (val.ref.gid) {
|
|
result.push({data: val.ref.gid, value: val.name});
|
|
}
|
|
});
|
|
|
|
console.log({query: 'test', suggestions: result});
|
|
return {query: 'test', suggestions: result};
|
|
}
|
|
|
|
function func(data){
|
|
var result = [];
|
|
$.each(data.stopFinder.points, function( index, val ) {
|
|
if (val.ref.gid) {
|
|
result.push({data: val.ref.gid, value: val.name});
|
|
}
|
|
});
|
|
|
|
console.log({query: 'test', suggestions: result});
|
|
return {query: 'test', suggestions: result};
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html> |