Skip to content
Snippets Groups Projects
Commit 0b9f9edb authored by Anton Sarukhanov's avatar Anton Sarukhanov
Browse files

Make sure a stop is pre-selected on embed modal open

parent aed34e42
No related branches found
No related tags found
1 merge request!1Implemented Embed-code generator interface
......@@ -5,8 +5,8 @@ BusMap.Embed = function(opts) {
/* Constructor - initialize the embed form */
function init() {
populateOptions();
bindEventHandlers();
populateOptions();
}
var updateEmbedCode = function() {
......
......@@ -26,6 +26,7 @@ BusMap.Map = function(opts) {
animate: false,
reset: true,
};
that.map = that.opts.mapElement;
that.leaflet = L.map(that.map, mapOptions)
.fitBounds(that.opts.bounds)
......@@ -52,7 +53,7 @@ BusMap.Map = function(opts) {
}
// Hide any opened modals when map is clicked.
$(that.map).on('click', hideModal);
$(that.map).on('mousedown', hideModal);
// Show/hide markers based on zoom.
that.leaflet.on('zoomend', zoomShowHide);
......@@ -439,13 +440,15 @@ BusMap.Map = function(opts) {
if (that.hashChangedProgrammatically ) {
// Ignore hash changes caused programmatically (would inf-loop).
delete that['hashChangedProgrammatically'];
return;
return false;
}
if (that.opts.hashListen == false) {
return;
return false;
}
var hash = window.location.hash.substring(1);
if (hash == "") return;
if (hash == "") {
return false;
}
var parts = hash.split(";");
// First part: view string (lat,lon,zoom; vehicle; or stop)
applyViewString(parts[0]);
......@@ -453,6 +456,7 @@ BusMap.Map = function(opts) {
if (parts.length > 1) {
showModal(parts[1]);
}
return true;
}
function setUrlFromView() {
......
......@@ -10,7 +10,7 @@
<h3>Preview</h3>
<div id="embed-preview">
<iframe
src="{{ url_for('map_embed', mode='m', _external=True, _scheme='') }}"
src=""
frameborder=0></iframe>
</div>
<h3>Options</h3>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment