Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit de2c1a8

Browse files
committed
tweaks to enable files on other languages
1 parent 99d7588 commit de2c1a8

1 file changed

Lines changed: 19 additions & 21 deletions

File tree

runestone/activecode/js/activecode.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,26 +1999,24 @@ LiveCode.prototype.runProg = function() {
19991999
$(this.output).html($.i18n("msg_activecode_compiling_running"));
20002000

20012001
var files = [];
2002-
if(this.language === "java") {
2003-
if (this.datafile != undefined) {
2004-
var ids = this.datafile.split(",");
2005-
for (var i = 0; i < ids.length; i++) {
2006-
file = document.getElementById(ids[i].trim());
2007-
if (file === null || file === undefined) {
2008-
// console.log("No file with given id");
2009-
} else if (file.className === "javaFiles") {
2010-
files = files.concat(this.parseJavaClasses(file.textContent));
2011-
} else if (file.className === "image") {
2012-
var fileName = file.id;
2013-
var extension = fileName.substring(fileName.indexOf('.') + 1);
2014-
var base64 = file.toDataURL('image/' + extension);
2015-
base64 = base64.substring(base64.indexOf(',') + 1);
2016-
files.push({name: fileName, content: base64});
2017-
} else {
2018-
// if no className or un recognized className it is treated as an individual file
2019-
// this could be any type of file, .txt, .java, .csv, etc
2020-
files.push({name: file.id, content: file.textContent});
2021-
}
2002+
if (this.datafile != undefined) {
2003+
var ids = this.datafile.split(",");
2004+
for (var i = 0; i < ids.length; i++) {
2005+
file = document.getElementById(ids[i].trim());
2006+
if (file === null || file === undefined) {
2007+
// console.log("No file with given id");
2008+
} else if (file.className === "javaFiles") {
2009+
files = files.concat(this.parseJavaClasses(file.textContent));
2010+
} else if (file.className === "image") {
2011+
var fileName = file.id;
2012+
var extension = fileName.substring(fileName.indexOf('.') + 1);
2013+
var base64 = file.toDataURL('image/' + extension);
2014+
base64 = base64.substring(base64.indexOf(',') + 1);
2015+
files.push({name: fileName, content: base64});
2016+
} else {
2017+
// if no className or un recognized className it is treated as an individual file
2018+
// this could be any type of file, .txt, .java, .csv, etc
2019+
files.push({name: file.id, content: file.textContent});
20222020
}
20232021
}
20242022
}
@@ -2035,7 +2033,7 @@ LiveCode.prototype.runProg = function() {
20352033
}
20362034

20372035

2038-
if(this.language !== "java" || files.length === 0) {
2036+
if(files.length === 0) {
20392037
data = JSON.stringify({'run_spec': runspec});
20402038
this.runProg_callback(data);
20412039
} else {

0 commit comments

Comments
 (0)