mirror of
https://github.com/agdamsbo/agdamsbo.github.io.git
synced 2024-11-24 21:11:54 +01:00
13 lines
357 B
JavaScript
13 lines
357 B
JavaScript
|
|
||
|
window.initializeSourceEmbed = function(filename) {
|
||
|
$("#rmd-download-source").click(function() {
|
||
|
var src = $("#rmd-source-code").html();
|
||
|
var a = document.createElement('a');
|
||
|
a.href = "data:text/x-r-markdown;base64," + src;
|
||
|
a.download = filename;
|
||
|
document.body.appendChild(a);
|
||
|
a.click();
|
||
|
document.body.removeChild(a);
|
||
|
});
|
||
|
};
|