agdamsbo.github.io/site_libs/navigation-1.1/sourceembed.js

13 lines
357 B
JavaScript
Raw Normal View History

2022-09-19 15:06:07 +02:00
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);
});
};