101 lines
2.2 KiB
HTML
101 lines
2.2 KiB
HTML
<script type="text/javascript">
|
|
|
|
$(document).ready(function() {
|
|
loadTypingApp();
|
|
});
|
|
|
|
function loadTypingApp() {
|
|
let self = this;
|
|
|
|
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
|
|
"./../server/app/typing_app_list.php",
|
|
"maestro_id=" + maestroID,
|
|
|
|
(jsonData) => {
|
|
makeTypingAppList(jsonData["appList"]);
|
|
activateTypingApp(jsonData["activatedAppList"]);
|
|
},
|
|
|
|
(errorMessage, errorCode) => {
|
|
console.log(errorMessage);
|
|
if($("#error_message").length) {
|
|
$("#error_message").text(errorMessage);
|
|
}
|
|
}
|
|
|
|
);
|
|
}
|
|
|
|
function makeTypingAppList(appList) {
|
|
$("#typing_practice_kor").empty();
|
|
$("#typing_practice_eng").empty();
|
|
$("#typing_test_kor").empty();
|
|
$("#typing_test_eng").empty();
|
|
$("#typing_app").empty();
|
|
|
|
for(let i = 0; i < appList.length; i++) {
|
|
let appData = appList[i];
|
|
if(appData.koreanName === "")
|
|
continue;
|
|
|
|
let divTag = null;
|
|
if(appData.appID <= 10)
|
|
divTag = $("#typing_practice_kor");
|
|
else if(appData.appID <= 20)
|
|
divTag = $("#typing_practice_eng");
|
|
else if(appData.appID <= 30)
|
|
divTag = $("#typing_test_kor");
|
|
else if(appData.appID <= 40)
|
|
divTag = $("#typing_test_eng");
|
|
else
|
|
divTag = $("#typing_app");
|
|
divTag.append(
|
|
"<span>"
|
|
+ "<input type='checkbox' id='checkbox" + appData.appID + "' data-app-id='" + appData.appID + "' />"
|
|
+ "<label for='checkbox" + appData.appID + "'>" + appData.koreanName + "</label>"
|
|
+ "</span>"
|
|
);
|
|
|
|
$("#checkbox" + appData.appID).change(function() {
|
|
if($(this).is(":checked")) {
|
|
activateApp($(this).data("appId"));
|
|
} else {
|
|
deactivateApp($(this).data("appId"));
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function activateTypingApp(activatedList) {
|
|
for(let i = 0; i < activatedList.length; i++) {
|
|
let activatedAppID = activatedList[i].appID;
|
|
|
|
let input = $("#checkbox" + activatedAppID);
|
|
input.prop("checked", true);
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<div id="typing_app_content">
|
|
|
|
<div>
|
|
<h1>자리 연습</h1>
|
|
<div id="typing_practice_kor"></div>
|
|
<div id="typing_practice_eng"></div>
|
|
</div>
|
|
|
|
<div>
|
|
<h1>타자 시험</h1>
|
|
<div id="typing_test_kor"></div>
|
|
<div id="typing_test_eng"></div>
|
|
</div>
|
|
|
|
<div>
|
|
<h1>타자 앱</h1>
|
|
<div id="typing_app"></div>
|
|
</div>
|
|
|
|
</div> |