Created
October 10, 2019 20:31
-
-
Save dbolella/a3f4a1a17272b10d80a348440d3d38b0 to your computer and use it in GitHub Desktop.
Leafs for SwiftKotlinOnline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set("title") { Translate Kotlin } | |
#set("body") { | |
<textarea id="constantsText" rows="4" cols="50"> | |
Please put swift code here... | |
</textarea> | |
<button onclick="post()">Click me</button> | |
<script> | |
function post() { | |
var method = "post"; // Set method to post by default if not specified. | |
var path = "/translate/" | |
var params = {swift: document.getElementById("constantsText").value\} | |
var form = document.createElement("form"); | |
form.setAttribute("method", method); | |
form.setAttribute("action", path); | |
for(var key in params) { | |
if(params.hasOwnProperty(key)) { | |
var hiddenField = document.createElement("input") | |
hiddenField.setAttribute("type", "hidden") | |
hiddenField.setAttribute("name", key) | |
hiddenField.setAttribute("value", params[key]) | |
form.appendChild(hiddenField) | |
\} | |
\} | |
document.body.appendChild(form) | |
form.submit() | |
\} | |
</script> | |
} | |
#embed("base") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set("title") { Translate Kotlin } | |
#set("body") { | |
<h1>Results:</h1> | |
<pre><code>#(output)</code></pre> | |
} | |
#embed("base") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment