17 lines
533 B
JavaScript
17 lines
533 B
JavaScript
window.sptb = {
|
|
downloadFile: function(fileName, contentType, base64) {
|
|
var link = document.createElement('a');
|
|
link.download = fileName;
|
|
link.href = 'data:' + contentType + ';base64,' + base64;
|
|
document.body.appendChild(link);
|
|
link.click();
|
|
document.body.removeChild(link);
|
|
},
|
|
setTheme: function(theme) {
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
},
|
|
scrollToBottom: function(el) {
|
|
if (el) el.scrollTop = el.scrollHeight;
|
|
}
|
|
};
|