From 5515fcacb41ce1d10833e8aef44cfd00c8ecac8c Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Sat, 18 Mar 2017 21:46:25 +0000
Subject: [PATCH] Autofocus stop name input field

---
 index.js |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/index.js b/index.js
index dfbdf7c..a558485 100644
--- a/index.js
+++ b/index.js
@@ -271,7 +271,7 @@
 	nav.className = nav.className.replace(' loading', '');
 }
 
-function loadTimes(stopId = null, clearRoute = false) {
+function loadTimes(stopId, clearRoute) {
 	if(!stopId) stopId = stop_id;
 	if(!stopId) return;
 	
@@ -500,11 +500,11 @@
 	if(stop_name_autocomplete_xhr) stop_name_autocomplete_xhr.abort();
 	
 	stop_name_autocomplete_xhr = $.get(
-		ttss_base + '/lookup/autocomplete/json'
-			+ '?query=' + encodeURIComponent(stop_name.value)
+		'stops.php?query=' + encodeURIComponent(stop_name.value)
 	).done(function(data) {
 		deleteChildren(stop_name_autocomplete);
-		for(var i = 1, il = data.length; i < il; i++) {
+		for(var i = 0, il = data.length; i < il; i++) {
+			if(data[i].type != 'stop') continue;
 			if(data[i].id > 6000) continue;
 			var opt = document.createElement('option');
 			opt.value = data[i].id;

--
Gitblit v1.9.1