MCPcopy Index your code
hub / github.com/Maps4HTML/MapML.js / parseLicenseAndLegend

Function parseLicenseAndLegend

src/mapml/layers/MapLayer.js:297–326  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

295 }
296 }
297 function parseLicenseAndLegend() {
298 var licenseLink = mapml.querySelector('map-link[rel=license]'),
299 licenseTitle,
300 licenseUrl,
301 attText;
302 if (licenseLink) {
303 licenseTitle = licenseLink.getAttribute('title');
304 licenseUrl = licenseLink.getAttribute('href');
305 attText =
306 '<a href="' +
307 licenseUrl +
308 '" title="' +
309 licenseTitle +
310 '">' +
311 licenseTitle +
312 '</a>';
313 }
314 setOptions(layer, { attribution: attText });
315 var legendLink = mapml.querySelector('map-link[rel=legend]');
316 if (legendLink) {
317 layer._legendUrl = legendLink.getAttribute('href');
318 }
319 if (layer._map) {
320 // if the layer is checked in the layer control, force the addition
321 // of the attribution just received
322 if (layer._map.hasLayer(layer)) {
323 layer._map.attributionControl.addAttribution(layer.getAttribution());
324 }
325 }
326 }
327 },
328 getQueryTemplates: function (location, zoom) {
329 const queryLinks = this._layerEl.querySelectorAll(

Callers 1

MapLayer.jsFile · 0.85

Calls 1

getAttributeMethod · 0.80

Tested by

no test coverage detected