- else {
- // Retrieve image from the web and store it in the cache.
- var XHR = new XMLHttpRequest();
- XHR.open("GET",
- gMapStyles[aStyle].url
- .replace("{x}", norm.x)
- .replace("{y}", norm.y)
- .replace("{z}", norm.z)
- .replace("[a-c]", String.fromCharCode(97 + Math.floor(Math.random() * 2)))
- .replace("[1-4]", 1 + Math.floor(Math.random() * 3)),
- true);
- XHR.responseType = "blob";
- XHR.addEventListener("load", function () {
- if (XHR.status === 200) {
- var blob = XHR.response;
- gTileService.setDBCache(dbkey, {image: blob, timestamp: Date.now()});
- aCallback(blob, aStyle, aCoords);
- }
- }, false);
- XHR.send();
- }
+ // Retrieve image from the web and store it in the cache.
+ var XHR = new XMLHttpRequest();
+ XHR.open("GET",
+ gMapStyles[aStyle].url
+ .replace("{x}", norm.x)
+ .replace("{y}", norm.y)
+ .replace("{z}", norm.z)
+ .replace("[a-c]", String.fromCharCode(97 + Math.floor(Math.random() * 2)))
+ .replace("[1-4]", 1 + Math.floor(Math.random() * 3)),
+ true);
+ XHR.responseType = "blob";
+ XHR.addEventListener("load", function () {
+ if (XHR.status === 200) {
+ var blob = XHR.response;
+ aCallback(blob, aStyle, aCoords);
+ gTileService.setDBCache(dbkey, {image: blob, timestamp: Date.now()});
+ }
+ }, false);
+ XHR.send();