update other libs

This commit is contained in:
Norbert Renner 2014-05-14 16:01:20 +02:00
parent e4ae9b5533
commit aa1e051cfd
31 changed files with 679 additions and 719 deletions

View file

@ -1,3 +1,4 @@
/* global console: true */
L.BingLayer = L.TileLayer.extend({
options: {
subdomains: [0, 1, 2, 3],
@ -20,20 +21,19 @@ L.BingLayer = L.TileLayer.extend({
for (var i = z; i > 0; i--) {
var digit = 0;
var mask = 1 << (i - 1);
if ((x & mask) != 0) digit += 1;
if ((y & mask) != 0) digit += 2;
if ((x & mask) !== 0) digit += 1;
if ((y & mask) !== 0) digit += 2;
quad = quad + digit;
}
return quad;
},
getTileUrl: function(p, z) {
var z = this._getZoomForUrl();
var zoom = this._getZoomForUrl();
var subdomains = this.options.subdomains,
s = this.options.subdomains[Math.abs((p.x + p.y) % subdomains.length)];
return this._url.replace('{subdomain}', s)
.replace('{quadkey}', this.tile2quad(p.x, p.y, z))
.replace('http:', document.location.protocol)
.replace('{quadkey}', this.tile2quad(p.x, p.y, zoom))
.replace('{culture}', this.options.culture);
},
@ -46,17 +46,18 @@ L.BingLayer = L.TileLayer.extend({
var e = document.getElementById(cbid);
e.parentNode.removeChild(e);
if (meta.errorDetails) {
if (window.console) console.log("Leaflet Bing Plugin Error - Got metadata: " + meta.errorDetails);
if (window.console) console.log('Leaflet Bing Plugin Error - Got metadata: ' + meta.errorDetails);
return;
}
_this.initMetadata();
};
var url = document.location.protocol + "//dev.virtualearth.net/REST/v1/Imagery/Metadata/" + this.options.type + "?include=ImageryProviders&jsonp=" + cbid + "&key=" + this._key;
var script = document.createElement("script");
script.type = "text/javascript";
var url = document.location.protocol + '//dev.virtualearth.net/REST/v1/Imagery/Metadata/' + this.options.type + '?include=ImageryProviders&jsonp=' + cbid +
'&key=' + this._key + '&UriScheme=' + document.location.protocol.slice(0, -1);
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = url;
script.id = cbid;
document.getElementsByTagName("head")[0].appendChild(script);
document.getElementsByTagName('head')[0].appendChild(script);
},
initMetadata: function() {
@ -84,7 +85,7 @@ L.BingLayer = L.TileLayer.extend({
},
_update: function() {
if (this._url == null || !this._map) return;
if (this._url === null || !this._map) return;
this._update_attribution();
L.TileLayer.prototype._update.apply(this, []);
},

View file

@ -1,7 +1,8 @@
/*
* Google layer using Google Maps API
*/
//(function (google, L) {
/* global google: true */
L.Google = L.Class.extend({
includes: L.Mixin.Events,
@ -25,7 +26,7 @@ L.Google = L.Class.extend({
initialize: function(type, options) {
L.Util.setOptions(this, options);
this._ready = google.maps.Map != undefined;
this._ready = google.maps.Map !== undefined;
if (!this._ready) L.Google.asyncWait.push(this);
this._type = type || 'SATELLITE';
@ -48,7 +49,7 @@ L.Google = L.Class.extend({
map.on('zoomanim', this._handleZoomAnim, this);
//20px instead of 1em to avoid a slight overlap with google's attribution
map._controlCorners['bottomright'].style.marginBottom = "20px";
map._controlCorners.bottomright.style.marginBottom = '20px';
this._reset();
this._update();
@ -64,7 +65,7 @@ L.Google = L.Class.extend({
this._map.off('zoomanim', this._handleZoomAnim, this);
map._controlCorners['bottomright'].style.marginBottom = "0em";
map._controlCorners.bottomright.style.marginBottom = '0em';
//this._map.off('moveend', this._update, this);
},
@ -80,8 +81,8 @@ L.Google = L.Class.extend({
},
setElementSize: function(e, size) {
e.style.width = size.x + "px";
e.style.height = size.y + "px";
e.style.width = size.x + 'px';
e.style.height = size.y + 'px';
},
_initContainer: function() {
@ -90,16 +91,14 @@ L.Google = L.Class.extend({
if (!this._container) {
this._container = L.DomUtil.create('div', 'leaflet-google-layer leaflet-top leaflet-left');
this._container.id = "_GMapContainer_" + L.Util.stamp(this);
this._container.style.zIndex = "auto";
this._container.id = '_GMapContainer_' + L.Util.stamp(this);
this._container.style.zIndex = 'auto';
}
if (true) {
tilePane.insertBefore(this._container, first);
tilePane.insertBefore(this._container, first);
this.setOpacity(this.options.opacity);
this.setElementSize(this._container, this._map.getSize());
}
this.setOpacity(this.options.opacity);
this.setElementSize(this._container, this._map.getSize());
},
_initMapObject: function() {
@ -121,11 +120,11 @@ L.Google = L.Class.extend({
});
var _this = this;
this._reposition = google.maps.event.addListenerOnce(map, "center_changed",
this._reposition = google.maps.event.addListenerOnce(map, 'center_changed',
function() { _this.onReposition(); });
this._google = map;
google.maps.event.addListenerOnce(map, "idle",
google.maps.event.addListenerOnce(map, 'idle',
function() { _this._checkZoomLevels(); });
},
@ -163,8 +162,8 @@ L.Google = L.Class.extend({
_resize: function() {
var size = this._map.getSize();
if (this._container.style.width == size.x &&
this._container.style.height == size.y)
if (this._container.style.width === size.x &&
this._container.style.height === size.y)
return;
this.setElementSize(this._container, size);
this.onReposition();
@ -182,7 +181,7 @@ L.Google = L.Class.extend({
onReposition: function() {
if (!this._google) return;
google.maps.event.trigger(this._google, "resize");
google.maps.event.trigger(this._google, 'resize');
}
});
@ -198,5 +197,4 @@ L.Google.asyncInitialize = function() {
}
}
L.Google.asyncWait = [];
};
//})(window.google, L)
};

View file

@ -1,7 +1,9 @@
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
//(function (ymaps, L) {
/* global ymaps: true */
/* global console: true */
L.Yandex = L.Class.extend({
includes: L.Mixin.Events,
@ -18,7 +20,7 @@ L.Yandex = L.Class.extend({
initialize: function(type, options) {
L.Util.setOptions(this, options);
this._type = "yandex#" + (type || 'map');
this._type = 'yandex#' + (type || 'map');
},
onAdd: function(map, insertAtTheBottom) {
@ -35,7 +37,7 @@ L.Yandex = L.Class.extend({
this._limitedUpdate = L.Util.limitExecByInterval(this._update, 150, this);
map.on('move', this._update, this);
map._controlCorners['bottomright'].style.marginBottom = "3em";
map._controlCorners.bottomright.style.marginBottom = '3em';
this._reset();
this._update(true);
@ -48,7 +50,7 @@ L.Yandex = L.Class.extend({
this._map.off('move', this._update, this);
map._controlCorners['bottomright'].style.marginBottom = "0em";
map._controlCorners.bottomright.style.marginBottom = '0em';
},
getAttribution: function() {
@ -63,8 +65,8 @@ L.Yandex = L.Class.extend({
},
setElementSize: function(e, size) {
e.style.width = size.x + "px";
e.style.height = size.y + "px";
e.style.width = size.x + 'px';
e.style.height = size.y + 'px';
},
_initContainer: function() {
@ -73,8 +75,8 @@ L.Yandex = L.Class.extend({
if (!this._container) {
this._container = L.DomUtil.create('div', 'leaflet-yandex-layer leaflet-top leaflet-left');
this._container.id = "_YMapContainer_" + L.Util.stamp(this);
this._container.style.zIndex = "auto";
this._container.id = '_YMapContainer_' + L.Util.stamp(this);
this._container.style.zIndex = 'auto';
}
if (this.options.overlay) {
@ -82,7 +84,7 @@ L.Yandex = L.Class.extend({
first = first.nextSibling;
// XXX: Bug with layer order
if (L.Browser.opera)
this._container.className += " leaflet-objects-pane";
this._container.className += ' leaflet-objects-pane';
}
tilePane.insertBefore(this._container, first);
@ -96,9 +98,9 @@ L.Yandex = L.Class.extend({
// Check that ymaps.Map is ready
if (ymaps.Map === undefined) {
if (console) {
console.debug("L.Yandex: Waiting on ymaps.load('package.map')");
console.debug('L.Yandex: Waiting on ymaps.load("package.map")');
}
return ymaps.load(["package.map"], this._initMapObject, this);
return ymaps.load(['package.map'], this._initMapObject, this);
}
// If traffic layer is requested check if control.TrafficControl is ready
@ -106,9 +108,9 @@ L.Yandex = L.Class.extend({
if (ymaps.control === undefined ||
ymaps.control.TrafficControl === undefined) {
if (console) {
console.debug("L.Yandex: loading traffic and controls");
console.debug('L.Yandex: loading traffic and controls');
}
return ymaps.load(["package.traffic", "package.controls"],
return ymaps.load(['package.traffic', 'package.controls'],
this._initMapObject, this);
}
@ -117,9 +119,9 @@ L.Yandex = L.Class.extend({
if (this.options.traffic)
map.controls.add(new ymaps.control.TrafficControl({shown: true}));
if (this._type == "yandex#null") {
this._type = new ymaps.MapType("null", []);
map.container.getElement().style.background = "transparent";
if (this._type === 'yandex#null') {
this._type = new ymaps.MapType('null', []);
map.container.getElement().style.background = 'transparent';
}
map.setType(this._type);
@ -143,19 +145,17 @@ L.Yandex = L.Class.extend({
var _center = [center.lat, center.lng];
var zoom = this._map.getZoom();
if (force || this._yandex.getZoom() != zoom)
if (force || this._yandex.getZoom() !== zoom)
this._yandex.setZoom(zoom);
this._yandex.panTo(_center, {duration: 0, delay: 0});
},
_resize: function(force) {
var size = this._map.getSize(), style = this._container.style;
if (style.width == size.x + "px" &&
style.height == size.y + "px")
if (force != true) return;
if (style.width === size.x + 'px' && style.height === size.y + 'px')
if (force !== true) return;
this.setElementSize(this._container, size);
var b = this._map.getBounds(), sw = b.getSouthWest(), ne = b.getNorthEast();
this._yandex.container.fitToViewport();
}
});
//})(ymaps, L)
});