Revize e77db3b6
Přidáno uživatelem Jan Pašek před asi 4 roky(ů)
static/js/utilities.js | ||
---|---|---|
1 |
function download(filename, text) { |
|
2 |
var element = document.createElement('a'); |
|
3 |
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); |
|
4 |
element.setAttribute('download', filename); |
|
5 |
|
|
6 |
element.style.display = 'none'; |
|
7 |
document.body.appendChild(element); |
|
8 |
|
|
9 |
element.click(); |
|
10 |
|
|
11 |
document.body.removeChild(element); |
|
12 |
} |
Také k dispozici: Unified diff
Re #8475 - Added utilities.js with file download support