parent
2152ca3d1a
commit
f535993201
1 changed files with 15 additions and 10 deletions
|
@ -1130,14 +1130,10 @@ L.U.Map.include({
|
||||||
toggleCaveat()
|
toggleCaveat()
|
||||||
const download = L.DomUtil.create('a', 'button', container)
|
const download = L.DomUtil.create('a', 'button', container)
|
||||||
download.textContent = L._('Download data')
|
download.textContent = L._('Download data')
|
||||||
L.DomEvent.on(
|
L.DomEvent.on(download, 'click', () => {
|
||||||
download,
|
|
||||||
'click',
|
|
||||||
() => {
|
|
||||||
if (typeInput.value === 'umap') this.fullDownload()
|
if (typeInput.value === 'umap') this.fullDownload()
|
||||||
else this.download(typeInput.value)
|
else this.download(typeInput.value)
|
||||||
}
|
})
|
||||||
)
|
|
||||||
this.ui.openPanel({ data: { html: container } })
|
this.ui.openPanel({ data: { html: container } })
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1153,11 +1149,11 @@ L.U.Map.include({
|
||||||
let name = this.options.name || 'data'
|
let name = this.options.name || 'data'
|
||||||
name = name.replace(/[^a-z0-9]/gi, '_').toLowerCase()
|
name = name.replace(/[^a-z0-9]/gi, '_').toLowerCase()
|
||||||
const filename = name + type.ext
|
const filename = name + type.ext
|
||||||
return {content, filetype: type.filetype, filename}
|
return { content, filetype: type.filetype, filename }
|
||||||
},
|
},
|
||||||
|
|
||||||
download: function (mode) {
|
download: function (mode) {
|
||||||
const {content, filetype, filename} = this.format(mode)
|
const { content, filetype, filename } = this.format(mode)
|
||||||
const blob = new Blob([content], { type: filetype })
|
const blob = new Blob([content], { type: filetype })
|
||||||
window.URL = window.URL || window.webkitURL
|
window.URL = window.URL || window.webkitURL
|
||||||
const el = document.createElement('a')
|
const el = document.createElement('a')
|
||||||
|
@ -1263,6 +1259,15 @@ L.U.AttributionControl = L.Control.Attribution.extend({
|
||||||
const home = L.DomUtil.add('a', '', this._container, ` — ${L._('Home')}`)
|
const home = L.DomUtil.add('a', '', this._container, ` — ${L._('Home')}`)
|
||||||
home.href = '/'
|
home.href = '/'
|
||||||
}
|
}
|
||||||
|
if (this._map.options.captionMenus) {
|
||||||
|
const poweredBy = L.DomUtil.add(
|
||||||
|
'a',
|
||||||
|
'',
|
||||||
|
this._container,
|
||||||
|
` — ${L._('Powered by uMap')}`
|
||||||
|
)
|
||||||
|
poweredBy.href = 'https://github.com/umap-project/umap/'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue