Add clearer close action, refactor base layer code

This commit is contained in:
Tom MacWright 2013-06-13 13:21:24 -04:00 committed by John Firebaugh
parent c26b60c4c6
commit ded28617c7
6 changed files with 35 additions and 7 deletions

View file

@ -126,13 +126,14 @@ function getShortUrl(map) {
function getUrl(map) {
var center = map.getCenter(),
zoom = map.getZoom();
zoom = map.getZoom(),
toZoom = zoomPrecision(zoom);
return (window.location.hostname.match(/^www\.openstreetmap\.org/i) ?
'http://openstreetmap.org/?' : '/?') +
querystring.stringify({
lat: center.lat,
lon: center.lng,
lat: toZoom(center.lat),
lon: toZoom(center.lng),
zoom: zoom,
layers: map.getLayersCode()
});

View file

@ -38,7 +38,7 @@ function initializeExport(map) {
openSidebar();
if (getMapBaseLayerId(map) == "mapnik") {
if (map.getMapBaseLayerId() == "mapnik") {
$("#format_mapnik").prop("checked", true);
}
@ -186,7 +186,7 @@ function initializeExport(map) {
function htmlUrlChanged() {
var bounds = getBounds();
var layerName = getMapBaseLayerId(map);
var layerName = map.getMapBaseLayerId();
var url = "http://" + OSM.SERVER_URL + "/export/embed.html?bbox=" + bounds.toBBoxString() + "&layer=" + layerName;
var markerUrl = "";

View file

@ -18,6 +18,12 @@ L.OSM.key = function (options) {
$('<section>')
.appendTo($ui)
.append(
$('<a>')
.html('&raquo;')
.attr('class', 'close-button')
.attr('href', '#')
.bind('click', toggle))
.append(
$('<h2>')
.text(I18n.t('javascripts.key.title')));
@ -47,7 +53,7 @@ L.OSM.key = function (options) {
}
function update() {
var layer = getMapBaseLayerId(map),
var layer = map.getMapBaseLayerId(),
zoom = map.getZoom();
$('.mapkey-table-entry').each(function () {

View file

@ -20,6 +20,12 @@ L.OSM.layers = function(options) {
$('<section>')
.appendTo($ui)
.append(
$('<a>')
.html('&raquo;')
.attr('class', 'close-button')
.attr('href', '#')
.bind('click', toggle))
.append(
$('<h2>')
.text(I18n.t('javascripts.map.layers.header')));

View file

@ -18,6 +18,12 @@ L.OSM.share = function (options) {
$('<section>')
.appendTo($ui)
.append(
$('<a>')
.html('&raquo;')
.attr('class', 'close-button')
.attr('href', '#')
.bind('click', toggle))
.append(
$('<h2>')
.text(I18n.t('javascripts.share.title')));

View file

@ -604,6 +604,15 @@ a.donate {
margin:0;
}
a.close-button {
float: right;
padding:5px;
font-size:20px;
line-height:15px;
color:#222;
border:1px solid #ddd;
}
li {
border-radius: 4px;
overflow: hidden;
@ -1268,7 +1277,7 @@ ul.results-list li { border-bottom: 1px solid #ccc; }
}
h1, h2 {
font-size: 21px;
line-height: 1;
line-height: 1em;
}
small.deemphasize {
float: left;