Move key JS to application bundle
This commit is contained in:
parent
e83fba2b47
commit
519c7dc2dd
3 changed files with 27 additions and 29 deletions
26
app/assets/javascripts/key.js
Normal file
26
app/assets/javascripts/key.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
$(document).ready(function () {
|
||||
$("#open_map_key").click(function (e) {
|
||||
var url = $(this).attr('href'),
|
||||
title = $(this).text();
|
||||
|
||||
function updateMapKey() {
|
||||
$("#sidebar_content").load(url, {
|
||||
layer: map.baseLayer.keyid,
|
||||
zoom: map.getZoom()
|
||||
});
|
||||
}
|
||||
|
||||
updateMapKey();
|
||||
openSidebar({ title: title });
|
||||
|
||||
$("#sidebar").one("closed", function () {
|
||||
map.events.unregister("zoomend", map, updateMapKey);
|
||||
map.events.unregister("changelayer", map, updateMapKey);
|
||||
});
|
||||
|
||||
map.events.register("zoomend", map, updateMapKey);
|
||||
map.events.register("changelayer", map, updateMapKey);
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue