|
|
|
@ -26,6 +26,10 @@ |
|
|
|
<link rel="stylesheet" type="text/css" href="easyui.css"> |
|
|
|
<link rel="stylesheet" type="text/css" href="easyui.css"> |
|
|
|
<link rel="stylesheet" href="css/sweetalert2.min.css"> |
|
|
|
<link rel="stylesheet" href="css/sweetalert2.min.css"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.7/codemirror.min.css"> |
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.7/codemirror.min.js"></script> |
|
|
|
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.7/mode/python/python.min.js"></script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
window.onerror = function (message, url, linenumber) { |
|
|
|
window.onerror = function (message, url, linenumber) { |
|
|
|
@ -98,13 +102,15 @@ |
|
|
|
margin: 0; |
|
|
|
margin: 0; |
|
|
|
font-family: 'Arial', sans-serif; |
|
|
|
font-family: 'Arial', sans-serif; |
|
|
|
} |
|
|
|
} |
|
|
|
#sidebar { |
|
|
|
/* 檔案列表的大小 */ |
|
|
|
|
|
|
|
#sidebar { |
|
|
|
width: 310px; |
|
|
|
width: 310px; |
|
|
|
height: 200vh; |
|
|
|
height: 200vh; |
|
|
|
background-color: #f9f9f9; |
|
|
|
background-color: #f9f9f9; |
|
|
|
padding: 5px; |
|
|
|
padding: 5px; |
|
|
|
max-height: calc(100vh - 20px); |
|
|
|
max-height: calc(100vh - 20px); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@media (max-height: 600px) { |
|
|
|
@media (max-height: 600px) { |
|
|
|
#sidebar { |
|
|
|
#sidebar { |
|
|
|
max-height: 80vh; |
|
|
|
max-height: 80vh; |
|
|
|
@ -116,27 +122,41 @@ |
|
|
|
max-height: 70vh; |
|
|
|
max-height: 70vh; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.container { |
|
|
|
/*負責裝按鈕的 container*/ |
|
|
|
display: flex; |
|
|
|
#editor-container { |
|
|
|
height: 100vh; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#editor-container { |
|
|
|
|
|
|
|
flex-grow: 1; |
|
|
|
flex-grow: 1; |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
flex-direction: column; |
|
|
|
flex-direction: column; |
|
|
|
height: 120%; |
|
|
|
height: 100vh; |
|
|
|
|
|
|
|
width: 100%; |
|
|
|
background-color: #f9f9f9; |
|
|
|
background-color: #f9f9f9; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/*Program container*/ |
|
|
|
#code-editor { |
|
|
|
#code-editor { |
|
|
|
flex-grow: 1; |
|
|
|
flex-grow: 1; |
|
|
|
display: flex; |
|
|
|
width: 100%; |
|
|
|
flex-direction: column; |
|
|
|
height: 100%; |
|
|
|
margin-bottom: 10px; |
|
|
|
margin-bottom: 10px; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*Program textarea*/ |
|
|
|
|
|
|
|
#code-textarea { |
|
|
|
|
|
|
|
width: 100%; |
|
|
|
|
|
|
|
height: 100%; |
|
|
|
|
|
|
|
font-size: 1vw; |
|
|
|
|
|
|
|
resize: none; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*Messege textarea*/ |
|
|
|
|
|
|
|
#console { |
|
|
|
|
|
|
|
height: 50vh; |
|
|
|
|
|
|
|
padding: 10px; |
|
|
|
|
|
|
|
border: 2px solid #ccc; |
|
|
|
|
|
|
|
font-size: 1vw; |
|
|
|
|
|
|
|
overflow-x: auto; |
|
|
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
|
|
flex-grow: 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#code-editor, #console { |
|
|
|
|
|
|
|
flex-grow: 1; |
|
|
|
} |
|
|
|
} |
|
|
|
.editor-container { |
|
|
|
.editor-container { |
|
|
|
font-size: 1vw; |
|
|
|
font-size: 1vw; |
|
|
|
@ -144,8 +164,12 @@ |
|
|
|
margin-left: 15px; |
|
|
|
margin-left: 15px; |
|
|
|
margin-top: 10px; |
|
|
|
margin-top: 10px; |
|
|
|
line-height: normal; |
|
|
|
line-height: normal; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.container { |
|
|
|
|
|
|
|
display: flex; |
|
|
|
|
|
|
|
height: 100vh; |
|
|
|
|
|
|
|
} |
|
|
|
.console-container { |
|
|
|
.console-container { |
|
|
|
font-size: 1vw; |
|
|
|
font-size: 1vw; |
|
|
|
font-weight: normal; |
|
|
|
font-weight: normal; |
|
|
|
@ -153,32 +177,6 @@ |
|
|
|
margin-bottom: 5px; |
|
|
|
margin-bottom: 5px; |
|
|
|
line-height: normal; |
|
|
|
line-height: normal; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#code-textarea { |
|
|
|
|
|
|
|
flex-grow: 1; |
|
|
|
|
|
|
|
width: 100%; |
|
|
|
|
|
|
|
border: 2px solid #ccc; |
|
|
|
|
|
|
|
margin: 0; |
|
|
|
|
|
|
|
padding: 10px; |
|
|
|
|
|
|
|
font-family: 'Courier New', Courier, monospace; |
|
|
|
|
|
|
|
font-size: 1vw; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
white-space: pre; |
|
|
|
|
|
|
|
overflow-x: auto; |
|
|
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
|
|
resize: none; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#console { |
|
|
|
|
|
|
|
height: auto; |
|
|
|
|
|
|
|
padding: 10px; |
|
|
|
|
|
|
|
border: 2px solid #ccc; |
|
|
|
|
|
|
|
font-size: 1vw; |
|
|
|
|
|
|
|
overflow-x: auto; |
|
|
|
|
|
|
|
overflow-y: auto; |
|
|
|
|
|
|
|
flex-grow: 1; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</style> |
|
|
|
</style> |
|
|
|
</head> |
|
|
|
</head> |
|
|
|
@ -314,7 +312,25 @@ |
|
|
|
func_getPythonStatus(); |
|
|
|
func_getPythonStatus(); |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
// 初始化 CodeMirror |
|
|
|
|
|
|
|
var editor = CodeMirror.fromTextArea(document.getElementById('code-textarea'), { |
|
|
|
|
|
|
|
lineNumbers: true, |
|
|
|
|
|
|
|
mode: "python", |
|
|
|
|
|
|
|
theme: "default", |
|
|
|
|
|
|
|
lineWrapping: true, |
|
|
|
|
|
|
|
indentUnit: 4, |
|
|
|
|
|
|
|
matchBrackets: true |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
// 動態調整 CodeMirrir 面板大小 |
|
|
|
|
|
|
|
function resizeEditor() { |
|
|
|
|
|
|
|
editor.setSize("100%", "100%"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 動態調整 CodeMirrir 字體大小 |
|
|
|
|
|
|
|
editor.getWrapperElement().style.fontSize = '1.0vw'; |
|
|
|
|
|
|
|
resizeEditor(); |
|
|
|
|
|
|
|
window.addEventListener('resize', function() { |
|
|
|
|
|
|
|
resizeEditor(); |
|
|
|
|
|
|
|
}); |
|
|
|
// 取得資料夾中的所有檔案名稱 |
|
|
|
// 取得資料夾中的所有檔案名稱 |
|
|
|
function func_getFileList(pyFileName) { |
|
|
|
function func_getFileList(pyFileName) { |
|
|
|
console.log('in get file list'); |
|
|
|
console.log('in get file list'); |
|
|
|
@ -334,11 +350,9 @@ |
|
|
|
data = retdata; |
|
|
|
data = retdata; |
|
|
|
} |
|
|
|
} |
|
|
|
var fileList = data.file_list; |
|
|
|
var fileList = data.file_list; |
|
|
|
fileArray = Object.values(fileList); // 儲存為全域變數 |
|
|
|
fileArray = Object.values(fileList); // 儲存所有 python 檔名 |
|
|
|
console.log("########################", fileArray); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 更新 datagrid 顯示所有檔案 |
|
|
|
updateDataGrid(fileArray); // 更新顯示的檔案列表 |
|
|
|
updateDataGrid(fileArray); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (pyFileName != null) { |
|
|
|
if (pyFileName != null) { |
|
|
|
selectFileInDataGrid(pyFileName); // 此時 fileList 已包含新文件 |
|
|
|
selectFileInDataGrid(pyFileName); // 此時 fileList 已包含新文件 |
|
|
|
@ -370,7 +384,7 @@ |
|
|
|
// 取得文件內容 |
|
|
|
// 取得文件內容 |
|
|
|
function func_FileGet(file_name) { |
|
|
|
function func_FileGet(file_name) { |
|
|
|
var reqFileNmae = file_name; |
|
|
|
var reqFileNmae = file_name; |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: "/pythonget?file=" + reqFileNmae, |
|
|
|
url: "/pythonget?file=" + reqFileNmae, |
|
|
|
type: "GET", |
|
|
|
type: "GET", |
|
|
|
@ -380,17 +394,18 @@ |
|
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
|
xmlHttp.setRequestHeader("Cache-Control", "no-cache"); |
|
|
|
}, |
|
|
|
}, |
|
|
|
success: function (retdata) { |
|
|
|
success: function (retdata) { |
|
|
|
$('#code-editor textarea').val(retdata); |
|
|
|
editor.setValue(retdata); |
|
|
|
}, |
|
|
|
}, |
|
|
|
error: function (retdata) { |
|
|
|
error: function (retdata) { |
|
|
|
console.warn(retdata); |
|
|
|
console.warn(retdata); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 儲存文件內容 |
|
|
|
// 儲存文件內容 |
|
|
|
function func_FileSave(file_name) { |
|
|
|
function func_FileSave(file_name) { |
|
|
|
var pyFileName = file_name; |
|
|
|
var pyFileName = file_name; |
|
|
|
pythoncode = $('#code-editor textarea').val(); |
|
|
|
pythoncode = editor.getValue(); |
|
|
|
var encoded = encodeURIComponent(pythoncode); |
|
|
|
var encoded = encodeURIComponent(pythoncode); |
|
|
|
console.log("func_FileSave pyFileName ---------- ",pyFileName) |
|
|
|
console.log("func_FileSave pyFileName ---------- ",pyFileName) |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
@ -469,7 +484,6 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
success: function (retdata) { |
|
|
|
success: function (retdata) { |
|
|
|
// 直接刷新文件列表,無需指定 Index 刪除行 |
|
|
|
// 直接刷新文件列表,無需指定 Index 刪除行 |
|
|
|
|
|
|
|
|
|
|
|
console.log("Delete File successfully !!!") |
|
|
|
console.log("Delete File successfully !!!") |
|
|
|
$('#console').append(' '); // 換行 |
|
|
|
$('#console').append(' '); // 換行 |
|
|
|
$('#console').append(retdata.replace(/\n/g, '<br>')); |
|
|
|
$('#console').append(retdata.replace(/\n/g, '<br>')); |
|
|
|
@ -502,8 +516,6 @@ |
|
|
|
async: true, |
|
|
|
async: true, |
|
|
|
success: function (retdata) { |
|
|
|
success: function (retdata) { |
|
|
|
clearInterval(Status_intervalId); |
|
|
|
clearInterval(Status_intervalId); |
|
|
|
// 在請求完成後重新啟用「Run」 |
|
|
|
|
|
|
|
// $("#run-button").prop("disabled", false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#console').append(' '); // 換行 |
|
|
|
$('#console').append(' '); // 換行 |
|
|
|
$('#console').append(retdata.replace(/\n/g, '<br>')); |
|
|
|
$('#console').append(retdata.replace(/\n/g, '<br>')); |
|
|
|
@ -513,7 +525,7 @@ |
|
|
|
var textarea = $('#console')[0]; |
|
|
|
var textarea = $('#console')[0]; |
|
|
|
textarea.scrollTop = textarea.scrollHeight; |
|
|
|
textarea.scrollTop = textarea.scrollHeight; |
|
|
|
} |
|
|
|
} |
|
|
|
// displayDataCounter = 1; |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
error: function (retdata) { |
|
|
|
error: function (retdata) { |
|
|
|
console.warn(retdata); |
|
|
|
console.warn(retdata); |
|
|
|
@ -628,36 +640,21 @@ |
|
|
|
// 取得 Python 結果 |
|
|
|
// 取得 Python 結果 |
|
|
|
function func_getPythonBuffer() { |
|
|
|
function func_getPythonBuffer() { |
|
|
|
console.log("func_getPythonBuffer() start"); |
|
|
|
console.log("func_getPythonBuffer() start"); |
|
|
|
var python_content = $('#code-textarea').val(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: "/pythongetbuffer?buffersize=" + getPythonBufferSize.toString(), |
|
|
|
url: "/pythongetbuffer?buffersize=" + getPythonBufferSize.toString(), |
|
|
|
method: "GET", |
|
|
|
method: "GET", |
|
|
|
async: true, |
|
|
|
async: true, |
|
|
|
success: function (retdata) { |
|
|
|
success: function (retdata) { |
|
|
|
|
|
|
|
|
|
|
|
// console.log("GET request succeeded."); |
|
|
|
// console.log("GET request succeeded."); |
|
|
|
var existData = $('#console').html(); |
|
|
|
var existData = $('#console').html(); |
|
|
|
// console.log("Get Data: ", retdata); |
|
|
|
// console.log("Get Data: ", retdata); |
|
|
|
console.log("Get Data:", JSON.stringify(retdata)); |
|
|
|
console.log("Get Data:", JSON.stringify(retdata)); |
|
|
|
|
|
|
|
|
|
|
|
// $('#console').append(retdata); |
|
|
|
// $('#console').append(retdata); |
|
|
|
displayData = func_checkSpecialChar(retdata); |
|
|
|
displayData = func_checkSpecialChar(retdata); |
|
|
|
|
|
|
|
|
|
|
|
console.log("Get displayData",JSON.stringify(displayData)); |
|
|
|
console.log("Get displayData",JSON.stringify(displayData)); |
|
|
|
$('#console').append(displayData); |
|
|
|
$('#console').append(displayData); |
|
|
|
/*if (dataReceivedCount == 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$('#console').html(displayData); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$('#console').append(displayData); |
|
|
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// dataReceivedCount++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根據 autoScroll 開關自動滾動 Ming 2024-08-29 |
|
|
|
// 根據 autoScroll 開關自動滾動 Ming 2024-08-29 |
|
|
|
if (autoScroll) { |
|
|
|
if (autoScroll) { |
|
|
|
var textarea = $('#console')[0]; |
|
|
|
var textarea = $('#console')[0]; |
|
|
|
@ -684,7 +681,6 @@ |
|
|
|
// 更改檔案圖示 |
|
|
|
// 更改檔案圖示 |
|
|
|
function updateFileIcon() { |
|
|
|
function updateFileIcon() { |
|
|
|
var rows = $('#file-data-grid').datagrid('getRows'); // 取得所有行的資料 |
|
|
|
var rows = $('#file-data-grid').datagrid('getRows'); // 取得所有行的資料 |
|
|
|
|
|
|
|
|
|
|
|
rows.forEach(function (row, index) { |
|
|
|
rows.forEach(function (row, index) { |
|
|
|
var $row = $('#file-data-grid').datagrid('getPanel').find('tr[datagrid-row-index="' + index + '"]'); |
|
|
|
var $row = $('#file-data-grid').datagrid('getPanel').find('tr[datagrid-row-index="' + index + '"]'); |
|
|
|
if (row.filename.endsWith('.py')) { // 只對 .py 檔案進行操作 |
|
|
|
if (row.filename.endsWith('.py')) { // 只對 .py 檔案進行操作 |
|
|
|
@ -712,7 +708,7 @@ |
|
|
|
func_setconfigfile(json_data); |
|
|
|
func_setconfigfile(json_data); |
|
|
|
console.log("func_runPython"); |
|
|
|
console.log("func_runPython"); |
|
|
|
autoScroll = true; |
|
|
|
autoScroll = true; |
|
|
|
var python_content = $('#code-textarea').val(); |
|
|
|
var python_content = editor.getValue(); |
|
|
|
var json_data = "lifile_liname=" + file_name; |
|
|
|
var json_data = "lifile_liname=" + file_name; |
|
|
|
|
|
|
|
|
|
|
|
console.log(file_name); |
|
|
|
console.log(file_name); |
|
|
|
@ -773,7 +769,7 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
// enable_python = "Yes" 則開啟上次未執行完成的 python file |
|
|
|
// 取得 config.json 中 enable_python_file 的值 |
|
|
|
function func_enablePythonfile() { // Ming 2024-10-04 |
|
|
|
function func_enablePythonfile() { // Ming 2024-10-04 |
|
|
|
$.ajax({ |
|
|
|
$.ajax({ |
|
|
|
url: "/getconfigfile?ch=all", |
|
|
|
url: "/getconfigfile?ch=all", |
|
|
|
@ -904,38 +900,31 @@ |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ctrl + S 保存 |
|
|
|
// 按 Ctrl + S |
|
|
|
editor.on('keydown', function (instance, event) { |
|
|
|
$(document).keydown(function (event) { |
|
|
|
|
|
|
|
if (event.ctrlKey && event.which === 83) { |
|
|
|
if (event.ctrlKey && event.which === 83) { |
|
|
|
event.preventDefault(); |
|
|
|
event.preventDefault(); |
|
|
|
func_FileSave(currentFileName); // 使用現在的文件名稱進行上傳 |
|
|
|
func_FileSave(currentFileName); // 使用現在的文件名稱進行上傳 |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 按 SHIFT + ENTER 執行 |
|
|
|
|
|
|
|
$(document).keydown(function (event) { |
|
|
|
// Shift + Enter 執行 |
|
|
|
|
|
|
|
editor.on('keydown', function (instance, event) { |
|
|
|
if (event.shiftKey && event.which === 13) { |
|
|
|
if (event.shiftKey && event.which === 13) { |
|
|
|
event.preventDefault(); |
|
|
|
event.preventDefault(); |
|
|
|
console.log("----------------Now Runing :",currentFileName) |
|
|
|
console.log("Now Running:", currentFileName); |
|
|
|
// 禁用「Run」,防止連續點擊 |
|
|
|
// 禁用「Run」,防止連續點擊 |
|
|
|
$("#run-button").prop("disabled", true); |
|
|
|
$("#run-button").prop("disabled", true); |
|
|
|
func_runPython(currentFileName); // 使用現在的文件名稱執行 Python |
|
|
|
func_runPython(currentFileName); // 使用現在的文件名稱執行 Python |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
// 設定 Textarea 可使用 Tab |
|
|
|
|
|
|
|
$('#code-textarea').on('keydown', function(e) { |
|
|
|
|
|
|
|
if (e.key === 'Tab') { |
|
|
|
|
|
|
|
e.preventDefault(); |
|
|
|
|
|
|
|
var start = this.selectionStart; |
|
|
|
|
|
|
|
var end = this.selectionEnd; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.value = this.value.substring(0, start) + ' ' + ' ' + ' ' + ' ' + this.value.substring(end); |
|
|
|
// 設定 Textarea 可使用 Tab |
|
|
|
|
|
|
|
editor.setOption("extraKeys", { |
|
|
|
this.selectionStart = this.selectionEnd = start + 4; |
|
|
|
Tab: function(cm) { |
|
|
|
|
|
|
|
cm.replaceSelection(" ", "end"); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('#console').on('mousedown', function() { |
|
|
|
$('#console').on('mousedown', function() { |
|
|
|
isUserScrolling = true; |
|
|
|
isUserScrolling = true; |
|
|
|
@ -956,11 +945,13 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 按儲存按鈕 |
|
|
|
// 按儲存按鈕 |
|
|
|
$('#save-button').click(function (event) { |
|
|
|
$('#save-button').click(function (event) { |
|
|
|
console.log("Click event triggered on #save-button"); |
|
|
|
console.log("Click event triggered on #save-button"); |
|
|
|
func_FileSave(currentFileName); // 使用現在的文件名稱進行上傳 |
|
|
|
func_FileSave(currentFileName); // 使用現在的文件名稱進行上傳 |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 按刪除按鈕 |
|
|
|
// 按刪除按鈕 |
|
|
|
$('#deletefile-button').click(function () { |
|
|
|
$('#deletefile-button').click(function () { |
|
|
|
if (currentFileName) { |
|
|
|
if (currentFileName) { |
|
|
|
@ -975,6 +966,7 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 上傳按鈕 (只接受 .py 檔案) |
|
|
|
// 上傳按鈕 (只接受 .py 檔案) |
|
|
|
$('#uploadfile-button').click(function() { |
|
|
|
$('#uploadfile-button').click(function() { |
|
|
|
var fileInput = $('<input type="file" accept=".py">'); |
|
|
|
var fileInput = $('<input type="file" accept=".py">'); |
|
|
|
@ -992,6 +984,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 按執行按鈕 |
|
|
|
// 按執行按鈕 |
|
|
|
$('#run-button').click(function () { |
|
|
|
$('#run-button').click(function () { |
|
|
|
$('#console').append("Running.....\n"); |
|
|
|
$('#console').append("Running.....\n"); |
|
|
|
@ -1002,17 +995,19 @@ |
|
|
|
|
|
|
|
|
|
|
|
// StartGetPythonBuffer(currentFileName) |
|
|
|
// StartGetPythonBuffer(currentFileName) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 按暫停按鈕 |
|
|
|
// 按暫停按鈕 |
|
|
|
$('#stop-button').click(function () { |
|
|
|
$('#stop-button').click(function () { |
|
|
|
// 開啟 「Run」& Func_funpython |
|
|
|
// 開啟 「Run」& Func_funpython |
|
|
|
$("#run-button").prop("disabled", false); |
|
|
|
$("#run-button").prop("disabled", false); |
|
|
|
func_stopPython(currentFileName) |
|
|
|
func_stopPython(currentFileName) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 按清除 Console 按鈕 |
|
|
|
// 按清除 Console 按鈕 |
|
|
|
$('#ClearConsole-button').click(function () { |
|
|
|
$('#ClearConsole-button').click(function () { |
|
|
|
//displayDataCounter = 0; |
|
|
|
|
|
|
|
$('#console').html(''); |
|
|
|
$('#console').html(''); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// 將程式碼清空並上傳 |
|
|
|
// 將程式碼清空並上傳 |
|
|
|
$('#delete-button').click(function () { |
|
|
|
$('#delete-button').click(function () { |
|
|
|
console.log(""); |
|
|
|
console.log(""); |
|
|
|
@ -1024,8 +1019,8 @@ |
|
|
|
}).then((result) => { |
|
|
|
}).then((result) => { |
|
|
|
if (result.isConfirmed) { |
|
|
|
if (result.isConfirmed) { |
|
|
|
// 清空 textarea 的内容 |
|
|
|
// 清空 textarea 的内容 |
|
|
|
var textarea = document.getElementById('code-textarea'); |
|
|
|
//var codeContent = editor.getValue(); |
|
|
|
textarea.value = ''; |
|
|
|
editor.setValue(""); |
|
|
|
func_FileUpload(currentFileName); |
|
|
|
func_FileUpload(currentFileName); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|