forked from james/TFL-Live-Bus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request james#3 from jwheare/master
iOS legibility improvements
- Loading branch information
Showing
6 changed files
with
144 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Hide address bar on iOS | ||
window.addEventListener("load",function() { | ||
setTimeout(function () { | ||
window.scrollTo(0, 1); | ||
}, 0); | ||
}); | ||
|
||
// Mobile Safari in standalone mode | ||
if(("standalone" in window.navigator) && window.navigator.standalone){ | ||
|
||
// If you want to prevent remote links in standalone web apps opening Mobile Safari, change 'remotes' to true | ||
var noddy, remotes = false; | ||
|
||
document.addEventListener('click', function(event) { | ||
|
||
noddy = event.target; | ||
|
||
// Bubble up until we hit link or top HTML element. Warning: BODY element is not compulsory so better to stop on HTML | ||
while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") { | ||
noddy = noddy.parentNode; | ||
} | ||
|
||
if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes)) | ||
{ | ||
event.preventDefault(); | ||
document.location.href = noddy.href; | ||
} | ||
|
||
},false); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
body { | ||
font: normal 14px "Helvetica Neue", "Helvetica", "Arial" sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
p.instruction { | ||
margin: 5px; | ||
font-size: 13px; | ||
} | ||
form.search { | ||
margin: 5px; | ||
} | ||
td.stop, | ||
td.map { | ||
vertical-align: top; | ||
border-bottom: 1px solid #ddd; | ||
} | ||
td.map a { | ||
padding: 5px 3px 5px 0; | ||
display: block; | ||
} | ||
a.stop { | ||
padding: 5px 6px 6px 6px; | ||
color: #000; | ||
display: block; | ||
text-decoration: none; | ||
} | ||
a.stop span.name { | ||
font-weight: bold; | ||
font-size: 17px; | ||
} | ||
a span.details { | ||
color: #000; | ||
font-size: 14px; | ||
} | ||
a.stop span.direction { | ||
color: #36C; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,53 @@ | ||
<p>Search for a bus stop name here, or try <a href="/nearby">autolocation</a>.</p> | ||
<form action="/" method="get"> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | ||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | ||
<head> | ||
<title><% if @search_results %>Search Buses Live!<% else %>Buses Live!<% end %></title> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta name="apple-mobile-web-app-capable" content="yes" /> | ||
<link rel="stylesheet" href="/style.css" type="text/css"> | ||
<script src="/mobile.js"></script> | ||
</head> | ||
|
||
<p class="instruction">Search for a bus stop name here, or try <a href="/nearby">autolocation</a>.</p> | ||
<form action="/" method="get" class="search"> | ||
<input name="search" type="text" /> | ||
<input type="submit" value="Search"> | ||
</form> | ||
|
||
<% if @search_results %> | ||
<ul> | ||
<table cellspacing="0"> | ||
<% @search_results.each do |result| %> | ||
<% if !result["routes"].empty? %> | ||
<li> | ||
<a href="/stop/<%= result["id"] %>"> | ||
<%= result["name"] %> | ||
<% if result["stopIndicator"] %> | ||
(<%= result["stopIndicator"] %>) | ||
<% end %> | ||
</a> (<a href="http://maps.google.com/maps?z=16&q=loc:<%= result["lat"]%>+<%= result["lng"]%>">map</a>) | ||
<% if result["towards"] %> | ||
<br /> | ||
Towards <%= result["towards"].downcase.gsub(/\b\w/){$&.upcase} %> | ||
<% end %> | ||
<br /> | ||
<%= result["routes"].collect {|x| x["name"]}.join(", ") %> | ||
</li> | ||
<tr> | ||
<td class="stop"> | ||
<a class="stop" href="/stop/<%= result["id"] %>"> | ||
<span class="name"> | ||
<%= result["name"] %> | ||
<% if result["stopIndicator"] %> | ||
(<%= result["stopIndicator"] %>) | ||
<% end %> | ||
</span> | ||
<span class="details"> | ||
<% if result["towards"] %> | ||
<br /> | ||
<span class="direction">Towards <%= result["towards"].downcase.gsub(/\b\w/){$&.upcase} %></span> | ||
<% end %> | ||
<br /> | ||
<%= result["routes"].collect {|x| x["name"]}.join(", ") %> | ||
</span> | ||
</a> | ||
</td> | ||
<td class="map"> | ||
<a href="http://maps.google.com/maps?z=16&q=loc:<%= result["lat"]%>+<%= result["lng"]%>">map</a> | ||
</td> | ||
</tr> | ||
<% end %> | ||
<% end %> | ||
</ul> | ||
<% end %> | ||
</table> | ||
<% end %> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
<p>Determining location...</p> | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | ||
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | ||
<head> | ||
<title>Nearby Buses Live!</title> | ||
<meta name="viewport" content="width=device-width"> | ||
<meta name="apple-mobile-web-app-capable" content="yes" /> | ||
</head> | ||
<body> | ||
<p style="font: normal 17px 'Helvetica Neue', Helvetica, Arial, sans-serif;">Determining location...</p> | ||
<script> | ||
navigator.geolocation.getCurrentPosition(function(location) { | ||
window.location = ("/?lat=" + location.coords.latitude + "&lon=" + location.coords.longitude); | ||
}); | ||
</script> | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters