diff options
Diffstat (limited to 'public/site.js')
-rw-r--r-- | public/site.js | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/public/site.js b/public/site.js index 17a8115..ed7173d 100644 --- a/public/site.js +++ b/public/site.js @@ -11,6 +11,16 @@ $(function() { }); editor.setSize(null, 500); + $("#dlCodeButton").on("click", function() { + var a = $("<a></a>") + .attr("href", "data:text/x-java;charset=UTF-8," + encodeURIComponent(editor.getValue())) + .attr("download", "Program.java") + .css("display", "none") + .appendTo("body"); + a.get(0).click(); + a.remove(); + }); + $("form").on("submit", function(e) { e.preventDefault(); |