Normalize stop names (add space after period)
| | |
| | | * PARSING * |
| | | ***********/ |
| | | |
| | | function normalizeName(string) { |
| | | return string.replace('.', '. ').replace(' ', ' '); |
| | | } |
| | | |
| | | function parseStatus(status) { |
| | | switch(status.status) { |
| | | case 'STOPPING': |
| | |
| | | </div> |
| | | <script src="https://polyfill.io/v3/polyfill.min.js?features=Promise,XMLHttpRequest"></script> |
| | | <script type="text/javascript" src="lang_pl.js?v8" id="lang_script"></script> |
| | | <script type="text/javascript" src="common.js?v8"></script> |
| | | <script type="text/javascript" src="index.js?v7"></script> |
| | | <script type="text/javascript" src="common.js?v9"></script> |
| | | <script type="text/javascript" src="index.js?v8"></script> |
| | | </body> |
| | | </html> |
| | |
| | | + '&mode=departure' |
| | | ).done(function(data) { |
| | | setText(times_stop_type, lang.types['s' + prefix]); |
| | | setText(times_stop_name, data.stopName); |
| | | setText(page_title, lang.page_title_stop_name.replace('$stop', data.stopName)); |
| | | setText(times_stop_name, normalizeName(data.stopName)); |
| | | setText(page_title, lang.page_title_stop_name.replace('$stop', normalizeName(data.stopName))); |
| | | deleteChildren(times_alerts); |
| | | deleteChildren(times_table); |
| | | //deleteChildren(times_lines); |
| | |
| | | <script src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.forEach,Array.prototype.includes,Array.prototype.map,Element.prototype.classList,Promise,String.prototype.startsWith,XMLHttpRequest,requestAnimationFrame"></script> |
| | | <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js" integrity="sha384-iQkGyyH4ioz3m+maM3s9MX1Oq67mACa4B9Z3ovUv3Sv37LJ96fx3WnZfLoiC3Wfl" crossorigin="anonymous"></script> |
| | | <script tyle="text/javascript" src="lang_pl.js?v8" id="lang_script"></script> |
| | | <script tyle="text/javascript" src="common.js?v8"></script> |
| | | <script tyle="text/javascript" src="map.js?v20"></script> |
| | | <script tyle="text/javascript" src="common.js?v9"></script> |
| | | <script tyle="text/javascript" src="map.js?v21"></script> |
| | | </body> |
| | | </html> |
| | |
| | | |
| | | var vehicle_name_space = vehicle.name.indexOf(' '); |
| | | vehicle.line = vehicle.name.substr(0, vehicle_name_space); |
| | | vehicle.direction = vehicle.name.substr(vehicle_name_space+1); |
| | | vehicle.direction = normalizeName(vehicle.name.substr(vehicle_name_space+1)); |
| | | if(special_directions[vehicle.direction]) { |
| | | vehicle.line = special_directions[vehicle.direction]; |
| | | } |
| | |
| | | for(var i = 0, il = all_departures.length; i < il; i++) { |
| | | tr = document.createElement('tr'); |
| | | addCellWithText(tr, all_departures[i].actualTime || all_departures[i].plannedTime); |
| | | addCellWithText(tr, all_departures[i].stop_seq_num + '. ' + all_departures[i].stop.name); |
| | | addCellWithText(tr, all_departures[i].stop_seq_num + '. ' + normalizeName(all_departures[i].stop.name)); |
| | | |
| | | if(i >= data.old.length) { |
| | | stopsToMark.push('s' + ttss_type + all_departures[i].stop.id); |
| | |
| | | for(var i = 0, il = all_departures.length; i < il; i++) { |
| | | tr = document.createElement('tr'); |
| | | addCellWithText(tr, all_departures[i].patternText); |
| | | dir_cell = addCellWithText(tr, all_departures[i].direction); |
| | | dir_cell = addCellWithText(tr, normalizeName(all_departures[i].direction)); |
| | | vehicle = parseVehicle(all_departures[i].vehicleId); |
| | | dir_cell.appendChild(displayVehicle(vehicle)); |
| | | status = parseStatus(all_departures[i]); |
| | |
| | | var div = document.createElement('div'); |
| | | |
| | | var typeName; |
| | | var name = feature.get('name'); |
| | | var name = normalizeName(feature.get('name')); |
| | | var additional; |
| | | var table = document.createElement('table'); |
| | | var thead = document.createElement('thead'); |
| | |
| | | |
| | | addElementWithText(a, 'span', typeName).className = 'small'; |
| | | a.appendChild(document.createTextNode(' ')); |
| | | addElementWithText(a, 'span', feature.get('name')); |
| | | addElementWithText(a, 'span', normalizeName(feature.get('name'))); |
| | | |
| | | div.appendChild(p); |
| | | } |
| | |
| | | |
| | | return array_values($words); |
| | | } |
| | | |
| | | function normalize_name($string) { |
| | | return strtr(strtr($string, ['.' => '. ']), [' ' => ' ']); |
| | | } |
| | | |
| | | function normalize_name_cmp($string) { |
| | | return normalize_name(mb_strtolower($string, 'UTF-8')); |
| | | } |
| | |
| | | |
| | | // Build a structure for the UI |
| | | $stop_list = []; |
| | | $query_lower = mb_strtolower($_GET['query'], 'UTF-8'); |
| | | $query_lower = normalize_name_cmp($_GET['query']); |
| | | foreach($ids as $id) { |
| | | similar_text( |
| | | $query_lower, |
| | | mb_strtolower($stops[$id], 'UTF-8'), |
| | | normalize_name_cmp($stops[$id]), |
| | | $percent |
| | | ); |
| | | // -5 due to UTF-8 |
| | |
| | | } |
| | | $stop_list[] = [ |
| | | 'id' => $id, |
| | | 'name' => $stops[$id], |
| | | 'name' => normalize_name($stops[$id]), |
| | | 'type' => 'stop', |
| | | 'relevance' => $percent, |
| | | ]; |