forked from osmlab/show-me-the-way
-
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.
Deploying to gh-pages from @ osmlab/show-me-the-way@56f5a48 🚀
- Loading branch information
Showing
15 changed files
with
34,212 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Show Me The Way</title> | ||
<meta charset='utf-8' /> | ||
<link rel='stylesheet' href='//unpkg.com/[email protected]/dist/leaflet.css' /> | ||
<link rel='stylesheet' href='css/style.css' /> | ||
<link rel='stylesheet' href='css/site.css' /> | ||
<link rel='stylesheet' href='js/locationfilter/src/locationfilter.css' /> | ||
<style> | ||
#bbox { | ||
position:absolute; | ||
bottom:0; | ||
left:0; | ||
font-size:40px; | ||
font-family:monospace; | ||
right:0; | ||
background:#fff; | ||
color:#000; | ||
border:0; | ||
margin:0; | ||
z-index: 500; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class='container'> | ||
<div id='map' class='col12 full-height'></div> | ||
<a id='bbox'></a> | ||
</div> | ||
<script src='//unpkg.com/[email protected]/dist/leaflet.js'></script> | ||
<script src='js/locationfilter/src/locationfilter.js'></script> | ||
<script> | ||
//<![CDATA[ | ||
function updateLink(bounds, hashParams) { | ||
const bs = | ||
bounds.getSouthWest().lat.toFixed(5) + ',' + | ||
bounds.getSouthWest().lng.toFixed(5) + ',' + | ||
bounds.getNorthEast().lat.toFixed(5) + ',' + | ||
bounds.getNorthEast().lng.toFixed(5); | ||
hashParams.set('bounds', bs); | ||
var loc = new URL(location.href.replace('bbox.html', '').replace('bbox', '')); | ||
loc.hash = hashParams; | ||
document.getElementById('bbox').textContent = loc; | ||
document.getElementById('bbox').setAttribute('href', loc); | ||
} | ||
|
||
const hashParams = new URLSearchParams(location.hash.replace('#', '')); | ||
var map = L.map('map'); | ||
const mapboxKey = 'pk.eyJ1Ijoib3BlbnN0cmVldG1hcHVzIiwiYSI6ImNqdTM1ZWxqeTBqa2MzeXBhODIxdnE2eG8ifQ.zyhAo181muDzPRdyYsqLGw'; | ||
var osm = new L.TileLayer( | ||
'https://api.mapbox.com/styles/v1/openstreetmapus/{style_id}/tiles/256/{z}/{x}/{y}?access_token={key}', { | ||
style_id: 'cju35gljt1bpm1fp2z93dlyca', | ||
key: mapboxKey, | ||
attribution: '<a href="https://mapbox.com/about/maps/">Terms & Conditions</a>'}).addTo(map); | ||
map.setView([0, 0], 3); | ||
var locationFilter = new L.LocationFilter().addTo(map); | ||
const hashBounds = hashParams.get('bounds'); | ||
if (hashBounds) { | ||
const boundsParts = hashBounds.split(','); | ||
if (boundsParts.length === 4) { | ||
const providedBounds = L.latLngBounds( | ||
[ boundsParts[0], boundsParts[1] ], | ||
[ boundsParts[2], boundsParts[3] ], | ||
); | ||
locationFilter.setBounds(providedBounds); | ||
map.fitBounds(providedBounds); | ||
updateLink(providedBounds, hashParams); | ||
} | ||
} | ||
locationFilter.on("change", function (e) { | ||
console.log(e.bounds); | ||
// Do something when the bounds change. | ||
// Bounds are available in `e.bounds`. | ||
updateLink(e.bounds, hashParams); | ||
}); | ||
locationFilter.enable(); | ||
//]]> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Show Me The Way</title> | ||
<meta charset='utf-8' /> | ||
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/leaflet/0.5/leaflet.css' /> | ||
<link rel='stylesheet' href='../css/style.css' /> | ||
<link rel='stylesheet' href='../css/site.css' /> | ||
<!--[if lte IE 8]><link rel='stylesheet' href='http://cdn.leafletjs.com/leaflet-0.5/leaflet.ie.css' /><![endif]--> | ||
<link href='//fonts.googleapis.com/css?family=Open+Sans:400,700|Open+Sans+Condensed:700' rel='stylesheet' type='text/css'> | ||
|
||
</head> | ||
<body> | ||
<div class='container'> | ||
<div class='sq overlay round'> | ||
<div id='overview_map'></div> | ||
<p class='pad2 change-meta' id='reverse-location'></p> | ||
</div> | ||
<div class='overlay align-bottom'> | ||
<div class='pad2' id='changeset_info'></div> | ||
<p class='pad2 change-meta' id='comment'></p> | ||
</div> | ||
<div class='indicator' id='queuesize'></div> | ||
<div id='map' class='col12 full-height'></div> | ||
<a href='http://openstreetmap.org/' class='byosm'></a> | ||
</div> | ||
<script id='changeset-template' type='template'> | ||
<% var past_tense = { modify: 'modified', create: 'created', 'delete': 'deleted' }; %> | ||
<p><a target='_blank' href='//osm.org/browse/changeset/<%=change.meta.changeset%>'><%=change.timetext%></a> <a target='_blank' href='//osm.org/user/<%= change.meta.user %>'><%= change.meta.user %></a> | ||
<%= past_tense[change.type] %> <a target='_blank' href='//osm.org/browse/<%= change.meta.type %>/<%= change.meta.id %>'><%= change.tagtext %></a> | ||
</p> | ||
</script> | ||
<script src='//cdnjs.cloudflare.com/ajax/libs/leaflet/0.5/leaflet.js'></script> | ||
<script src='../js/Bing.js'></script> | ||
<script src='../js/bundle.js'></script> | ||
<script type="text/javascript"> | ||
|
||
var _gaq = _gaq || []; | ||
_gaq.push(['_setAccount', 'UA-39286611-2']); | ||
_gaq.push(['_trackPageview']); | ||
|
||
(function() { | ||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | ||
})(); | ||
|
||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
<!-- | ||
Copyright (C) 2014 Google Inc. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Hello World</title> | ||
<style type="text/css"> | ||
html, body, #wrapper { | ||
height:100%; | ||
width: 100%; | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
} | ||
#wrapper td { | ||
vertical-align: middle; | ||
text-align: center; | ||
} | ||
input { | ||
font-family: "Arial", Arial, sans-serif; | ||
font-size: 40px; | ||
font-weight: bold; | ||
} | ||
.border { | ||
border: 2px solid #cccccc; | ||
border-radius: 5px; | ||
} | ||
.border:focus { | ||
outline: none; | ||
border-color: #8ecaed; | ||
box-shadow: 0 0 5px #8ecaed; | ||
} | ||
</style> | ||
<script type="text/javascript" src="//www.gstatic.com/cv/js/sender/v1/cast_sender.js"></script> | ||
<script type="text/javascript"> | ||
var applicationID = '6BB1F385'; | ||
var namespace = 'urn:x-cast:io.github.osmlab.showmetheway'; | ||
var session = null; | ||
|
||
/** | ||
* Call initialization for Cast | ||
*/ | ||
if (!chrome.cast || !chrome.cast.isAvailable) { | ||
setTimeout(initializeCastApi, 1000); | ||
} | ||
|
||
/** | ||
* initialization | ||
*/ | ||
function initializeCastApi() { | ||
var sessionRequest = new chrome.cast.SessionRequest(applicationID); | ||
var apiConfig = new chrome.cast.ApiConfig(sessionRequest, | ||
sessionListener, | ||
receiverListener); | ||
|
||
chrome.cast.initialize(apiConfig, onInitSuccess, onError); | ||
}; | ||
|
||
/** | ||
* initialization success callback | ||
*/ | ||
function onInitSuccess() { | ||
appendMessage("onInitSuccess"); | ||
} | ||
|
||
/** | ||
* initialization error callback | ||
*/ | ||
function onError(message) { | ||
appendMessage("onError: "+JSON.stringify(message)); | ||
} | ||
|
||
/** | ||
* generic success callback | ||
*/ | ||
function onSuccess(message) { | ||
appendMessage("onSuccess: "+message); | ||
} | ||
|
||
/** | ||
* callback on success for stopping app | ||
*/ | ||
function onStopAppSuccess() { | ||
appendMessage('onStopAppSuccess'); | ||
} | ||
|
||
/** | ||
* session listener during initialization | ||
*/ | ||
function sessionListener(e) { | ||
appendMessage('New session ID:' + e.sessionId); | ||
session = e; | ||
session.addUpdateListener(sessionUpdateListener); | ||
session.addMessageListener(namespace, receiverMessage); | ||
} | ||
|
||
/** | ||
* listener for session updates | ||
*/ | ||
function sessionUpdateListener(isAlive) { | ||
var message = isAlive ? 'Session Updated' : 'Session Removed'; | ||
message += ': ' + session.sessionId; | ||
appendMessage(message); | ||
if (!isAlive) { | ||
session = null; | ||
} | ||
}; | ||
|
||
/** | ||
* utility function to log messages from the receiver | ||
* @param {string} namespace The namespace of the message | ||
* @param {string} message A message string | ||
*/ | ||
function receiverMessage(namespace, message) { | ||
appendMessage("receiverMessage: "+namespace+", "+message); | ||
}; | ||
|
||
/** | ||
* receiver listener during initialization | ||
*/ | ||
function receiverListener(e) { | ||
if( e === 'available' ) { | ||
appendMessage("receiver found"); | ||
} | ||
else { | ||
appendMessage("receiver list empty"); | ||
} | ||
} | ||
|
||
/** | ||
* stop app/session | ||
*/ | ||
function stopApp() { | ||
session.stop(onStopAppSuccess, onError); | ||
} | ||
|
||
/** | ||
* send a message to the receiver using the custom namespace | ||
* receiver CastMessageBus message handler will be invoked | ||
* @param {string} message A message string | ||
*/ | ||
function sendMessage(message) { | ||
if (session!=null) { | ||
session.sendMessage(namespace, message, onSuccess.bind(this, "Message sent: " + message), onError); | ||
} | ||
else { | ||
chrome.cast.requestSession(function(e) { | ||
session = e; | ||
session.sendMessage(namespace, message, onSuccess.bind(this, "Message sent: " + message), onError); | ||
}, onError); | ||
} | ||
} | ||
|
||
/** | ||
* append message to debug message window | ||
* @param {string} message A message string | ||
*/ | ||
function appendMessage(message) { | ||
console.log(message); | ||
var dw = document.getElementById("debugmessage"); | ||
dw.innerHTML += '\n' + JSON.stringify(message); | ||
}; | ||
|
||
/** | ||
* utility function to handle text typed in by user in the input field | ||
*/ | ||
function update() { | ||
sendMessage(document.getElementById("input").value); | ||
} | ||
|
||
/** | ||
* handler for the transcribed text from the speech input | ||
* @param {string} words A transcibed speech string | ||
*/ | ||
function transcribe(words) { | ||
sendMessage(words); | ||
} | ||
</script> | ||
</head> | ||
<body> | ||
<table id="wrapper"> | ||
<tr> | ||
<td> | ||
<form method="get" action="JavaScript:update();"> | ||
<input id="input" class="border" type="text" size="30" onwebkitspeechchange="transcribe(this.value)" x-webkit-speech/> | ||
</form> | ||
</td> | ||
</tr> | ||
</table> | ||
|
||
<!-- Debbugging output --> | ||
<div style="margin:10px; visibility:hidden;"> | ||
<textarea rows="20" cols="70" id="debugmessage"> | ||
</textarea> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
document.getElementById("input").focus(); | ||
</script> | ||
</body> | ||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.