-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodharbour.js
More file actions
31 lines (27 loc) · 827 Bytes
/
modharbour.js
File metadata and controls
31 lines (27 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
function RunCode( cCode ){
var o = new Object();
o['source'] = cCode;
console.log('PARAM', o);
$.post("https://modharbour.org/modharbour_samples/run.prg", o)
.done(function(data){console.log('DONE', data); $('#code').html(data);})
.fail(function(data){console.log('ERROR', data);});
}
function RunPrg( file ){
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
RunCode(rawFile.responseText);
}
}
}
rawFile.send(null);
}
function RunFromDiv(){
var myDiv = document.getElementById('code');
RunCode( myDiv.innerHTML );
}