-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Landing page + client page + relationship bug correction
- Loading branch information
1 parent
6a9f115
commit 560f7c0
Showing
3 changed files
with
82 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Objectmorph-Sample-Client</title> | ||
</head> | ||
<body> | ||
<h1>Objectmorph Sample Client</h1> | ||
<h3> | ||
This page executes client side code. It can be downloaded and executed locally. | ||
</h3> | ||
<div align="center" > | ||
<textarea id="notepad" placeholder="drag and drop Java source code files here" cols="64" rows="16"></textarea> | ||
</div> | ||
</body> | ||
<script> | ||
var notepad = document.getElementById('notepad'); | ||
var files = []; | ||
function dropfile(file) { | ||
var reader = new FileReader(); | ||
reader.onload = function(e) { | ||
files.push(e.target.result); | ||
}; | ||
reader.readAsText(file, "UTF-8"); | ||
} | ||
|
||
notepad.ondrop = function(e) { | ||
e.preventDefault(); | ||
e.dataTransfer.setData("text/plain","data set in dragstart"); | ||
for (const file of e.dataTransfer.files) { | ||
if (!file.name.includes(".java")) { | ||
continue; | ||
} | ||
dropfile(file); | ||
} | ||
setTimeout(() => { | ||
UserAction(files); | ||
}, 250); | ||
files = []; | ||
}; | ||
|
||
function UserAction(file) { | ||
var xhttp = new XMLHttpRequest(); | ||
xhttp.onreadystatechange = function() { | ||
if (this.readyState == 4 && this.status == 200) { | ||
console.log(this.responseText); | ||
const winUrl = URL.createObjectURL( | ||
new Blob([this.responseText], { type: "text/html" }) | ||
); | ||
|
||
const win = window.open( | ||
winUrl, | ||
"win", | ||
`width=512,height=512` | ||
); | ||
} | ||
}; | ||
// var url = "https://objectmorph-app.onrender.com/html"; | ||
var url = "http://localhost:8080/html"; | ||
xhttp.open("POST", url, true); | ||
var data = new FormData(); | ||
data.append('sourceCode', file); | ||
xhttp.send(data); | ||
} | ||
</script> | ||
</html> |
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
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