From bc9ab120621db0ac317315e37579e565e94fd358 Mon Sep 17 00:00:00 2001 From: Robert Waggott Date: Wed, 4 Sep 2013 16:49:14 +0100 Subject: [PATCH] adding support for subdomains --- L.TileLayer.Zoomify.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/L.TileLayer.Zoomify.js b/L.TileLayer.Zoomify.js index 65da270..5774805 100644 --- a/L.TileLayer.Zoomify.js +++ b/L.TileLayer.Zoomify.js @@ -94,7 +94,16 @@ L.TileLayer.Zoomify = L.TileLayer.extend({ }, getTileUrl: function (tilePoint) { - return this._url + 'TileGroup' + this._getTileGroup(tilePoint) + '/' + this._map.getZoom() + '-' + tilePoint.x + '-' + tilePoint.y + '.jpg'; + var url = this._url; + + if (this.options != null && (typeof this.options["subdomains"] === "string")) { + var subdomains = this.options.subdomains.split(''); + var subdomain = subdomains[Math.floor(Math.random() * subdomains.length)]; + + url = url.replace("{s}", subdomain); + } + + return url + 'TileGroup' + this._getTileGroup(tilePoint) + '/' + this._map.getZoom() + '-' + tilePoint.x + '-' + tilePoint.y + '.jpg'; }, _getTileGroup: function (tilePoint) {