first commit

This commit is contained in:
2026-08-07 12:52:33 +09:00
commit 7fb30dcd0d
1409 changed files with 473704 additions and 0 deletions

342
module/Qmodule/com.js Normal file
View File

@@ -0,0 +1,342 @@
window.kon = window.kon || {}
kon.com = (function () {
var variable;
var data;
function setVariable(vars) { kon.com.variable = vars; }
function setData(dataset) { kon.com.data = dataset; }
/* 싱글 - 멀티 */
function CM1() {
var ul = createnode("ul", "", { "class": "list-group list-group-horizontal-sm" });
var ul2 = createnode("ul","",{"class": "list-group","style":"display:none" , "id" : "multiexample"});
var single = kon.com.data.single;
var multi = kon.com.data.multi;
var li_list = Object.keys(single).map(function (key) {
var li = createnode("li", [{ "element": "label", "text": single[key].label, "attr": { "for": kon.com.variable + "_" + key } }], { "class": "list-group-item flex-fill" })
$(li).prepend(createnode("INPUT", "", { "id": kon.com.variable + "_" + key, "value": key, "type": "radio", "name": kon.com.variable, "class": "m-1" }))
return li
})
appendChild_m(ul, li_list);
var li_list2 = Object.keys(multi).map(function (key) {
var li = createnode("li", [{ "element": "label", "text": multi[key].label, "attr": { "for": "m"+kon.com.variable + "_" + key } }], { "class": "list-group-item" })
$(li).prepend(createnode("INPUT", "", { "id": "m"+kon.com.variable + "_" + key, "value": key, "type": "checkbox", "name": kon.com.variable + "_"+ key, "class": "m-1" }))
return li
})
appendChild_m(ul2, li_list2);
$("#question_body").append(ul);
$("#question_body").append(ul2);
$(".list-group-item").css("border", "0px")
etcRadio();
var nextFunc = function (pvar, pdata) {
var vars = pvar || kon.com.variable;
var data = pdata || kon.com.data;
return kon.com.com_page_logic(vars, data);
};
return nextFunc
}
/* 싱글 - 오픈 */
function CM2(option) {
var single = kon.com.data.single;
var open = kon.com.data.open;
var li = [];
Object.keys(open).forEach(function(key){
var option = {}
// 2025-06-26 권민서 - 기능 추가 및 수정
// if(kon.open.data[key].option === "inputHangulOnly") { // 한글만 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s]/g, '')";
// } else if(kon.open.data[key].option === "inputEnglishOnly") { // 영문만 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^a-zA-Z\\s]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^a-zA-Z\\s]/g, '')";
// } else if(kon.open.data[key].option === "inputNumberOnly") { // 숫자만 입력
// optionx["type"] = "number";
// optionx["onkeyup"] = "value = value.replace(/[^0-9]/g,'')";
// optionx["onchange"] = "value = value.replace(/[^0-9]/g,'')";
// } else if(kon.open.data[key].option === "inputHangulWithSymbols") { // 한글과 특수문자 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// } else if(kon.open.data[key].option === "inputEnglishWithSymbols") { // 영문과 특수문자 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^a-zA-Z\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^a-zA-Z\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// } else if(kon.open.data[key].option === "inputAllAllowed") { // 모든 문자 입력
// optionx["type"] = "text";
// } else {
// optionx["type"] = "text"
// }
if(open[key].option === "han") {
option["type"] = "text";
option["onkeyup"] = "value = value.replace(/[^ㄱ-ㅎㅏ-ㅣ가-힣0-9]/g,'')";
} else if(open[key].option === "num") {
option["type"] = "number";
option["onkeyup"] = "value = value.replace(/[^0-9]/g,'')";
} else if(open[key].option === "all") {
option["type"] = "text";
} else {
option["type"] = "text"
}
option["text"] = open[key].label;
option["prev"] = open[key].prev || ""
option["after"] = open[key].after || ""
li.push(make_input_text(option,kon.com.variable+"_"+key,{"class":"input-group m-1","style":"max-width:300px"}));
})
var ul = createnode("div",li,{"class":"text-right d-block p-2 m-1"});
$(ul).on("change blur","input[name="+kon.com.variable+"_1]",function(e){
var range = option["record_range"].split("/");
var num = (+e.target.value)
if(option.clickable !== "1") {
$("input:radio").prop("checked",false);
}
range.some(function(r,i){
var x = r.split("~");
if(+x[0] <= num && +x[1] >= num) {
$("input[name="+kon.com.variable+"][value="+(i+1)+"]").prop("checked",true);
return true;
}
})
})
$("#question_body").append(ul)
ul = createnode("ul","",{"class":"list-group"});
var li_list = Object.keys(single).map(function (key) {
var li = createnode("li", [{ "element": "label", "text": single[key].label, "attr": { "for": kon.com.variable + "_" + key } }], { "class": "list-group-item flex-fill" })
/* 체크 못하게 막기 */
if(option.clickable === "1") {
var input = createnode("INPUT", "", { "id": kon.com.variable + "_" + key, "value": key, "type": "radio", "name": kon.com.variable, "class": "m-1"})
} else {
var input = createnode("INPUT", "", { "id": kon.com.variable + "_" + key, "value": key, "type": "radio", "name": kon.com.variable, "class": "m-1", "onclick":"return false;" })
}
$(li).prepend(input)
return li
})
appendChild_m(ul, li_list);
$("#question_body").append(ul);
$(".list-group-item").css("border", "0px")
var nextFunc = function (pvar, pdata) {
var vars = pvar || kon.com.variable;
var data = pdata || kon.com.data;
return kon.com.com_page_logic(vars, data);
};
return nextFunc
}
/* 싱글 - 오픈 오픈 타입 변경 */
function CM3(option) {
var single = kon.com.data.single;
var open = kon.com.data.open;
var inner_element = []
Object.keys(single).forEach(function (key) {
var label = createnode("label",single[key].label,{"for":kon.com.variable+"_"+key,"class":"p-2 m-0"});
var input = createnode("INPUT", "", { "id": kon.com.variable + "_" + key, "value": key, "type": "radio", "name": kon.com.variable, "class": "m-1" })
label.appendChild(input);
inner_element.push(label)
})
Object.keys(open).forEach(function(key){
var optionx = {}
// 2025-06-26 권민서 - 기능 추가 및 수정
// if(kon.open.data[key].option === "inputHangulOnly") { // 한글만 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s]/g, '')";
// } else if(kon.open.data[key].option === "inputEnglishOnly") { // 영문만 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^a-zA-Z\\s]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^a-zA-Z\\s]/g, '')";
// } else if(kon.open.data[key].option === "inputNumberOnly") { // 숫자만 입력
// optionx["type"] = "number";
// optionx["onkeyup"] = "value = value.replace(/[^0-9]/g,'')";
// optionx["onchange"] = "value = value.replace(/[^0-9]/g,'')";
// } else if(kon.open.data[key].option === "inputHangulWithSymbols") { // 한글과 특수문자 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^ㄱ-ㅎ가-힣\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// } else if(kon.open.data[key].option === "inputEnglishWithSymbols") { // 영문과 특수문자 입력
// optionx["type"] = "text";
// optionx["onkeyup"] = "value = value.replace(/[^a-zA-Z\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// optionx["onchange"] = "value = value.replace(/[^a-zA-Z\\s!@#\\$%\\^&\\*\\(\\)_\\+=\\-\\.,]/g, '')";
// } else if(kon.open.data[key].option === "inputAllAllowed") { // 모든 문자 입력
// optionx["type"] = "text";
// } else {
// optionx["type"] = "text"
// }
if(open[key].option === "han") {
optionx["type"] = "text";
optionx["onkeyup"] = "value = value.replace(/[^ㄱ-ㅎㅏ-ㅣ가-힣0-9]/g,'')";
} else if(open[key].option === "num") {
optionx["type"] = "number";
optionx["onkeyup"] = "value = value.replace(/[^0-9]/g,'')";
} else if(open[key].option === "all") {
optionx["type"] = "text";
} else {
optionx["type"] = "text"
}
optionx["text"] = open[key].label || ""
optionx["prev"] = open[key].prev || ""
optionx["after"] = open[key].after || ""
if(open[key].label) {
var text_label = createnode("label",open[key].label,{"class":"w-100 p-1"});;
inner_element.push(text_label)
}
inner_element.push(make_input_text(optionx,kon.com.variable+"_"+key,{"class":"input-group m-1","style":"max-width:300px"}));
if(option["show_num"] === "1"){
var show_box = createnode("div","",{"class":"text-primary","id":"show_num_"+kon.com.variable+"_"+key});
inner_element.push(show_box);
$("body").on("keyup","input[type=number][name="+kon.com.variable+"_"+key+"]",function(e){
var num = e.target.value
var $target = $(e.target);
var ed_txt = $target.next().text();
var id = "show_num_"+e.target.name;
if(num !== ""){
$("#"+id).text(viewKorean(num,ed_txt));
} else{
$("#"+id).text("");
}
});
}
})
if(option["change_label"] === "1") {
$("body").on("click","input[type=radio][name="+kon.com.variable+"]",function(e){
var $target = $(e.target);
var text = $("label[for="+e.target.id+"]").text();
var wrapper = $target.closest(".com_wrapper")
wrapper.find(".input-group-text:last").text(text);
wrapper.find("input[type=text], input[type=number]").val("");
$("[id^=show_num_"+e.target.name+"]").text("");
});
} else {
$("body").on("click","input[type=radio][name="+kon.com.variable+"]",function(e){
var $target = $(e.target);
var wrapper = $target.closest(".com_wrapper")
wrapper.find("input[type=text], input[type=number]").val("");
});
}
var wrapper = createnode("div",inner_element,{"class":"border p-2 m-1 com_wrapper d-inline-block","id":kon.com.variable+"_"+"box"});
$("#question_body").append(wrapper)
var nextFunc = function (pvar, pdata) {
var vars = pvar || kon.com.variable;
var data = pdata || kon.com.data;
return kon.com.com_page_logic(vars, data);
};
return nextFunc
}
function etcRadio() {
$("body").on("click","input:radio",function(e){
if(e.target.value === "1") {
$("#multiexample").css("display","block")
} else {
$("#multiexample").css("display","none")
}
});
}
/* 체크 박스 확인하여 응답 받을 지 안 받을 지 정함 */
function com_page_logic(pvar, pdata) {
var bools = true;
var open = pdata.open || kon.com.data["open"]
open = open || {};
var vars = pvar;
if($("input[name="+vars+"]:checked").length === 0 && $("input[name="+vars+"]:not(:disabled)").length > 0){
$.alert(kon.qmake.alert["문항에 응답해주세요."]);
bools = false;
return false;
}
$.each(Object.keys(open),function(id,key){
if( open[key].min !== undefined && !$.isNumeric(open[key].min) ) {
var min = kon.survey.tv[open[key].min]
if(min)
open[key].min = min
else
open[key].min = 0
}
if( open[key].max !== undefined && !$.isNumeric(open[key].max) ) {
var max = kon.survey.tv[open[key].max]
if(max)
open[key].max = max
else
open[key].max = 100
}
if(open[key]["must"] === "1"){
var target = $("input[name="+vars+"_"+key+"]:not(:disabled) , textarea[name=" +vars+"_"+key+"]:not(:disabled)");
if(target.length == 0) return true;
if(target.val().trim() === ""){
//target.focus();
$.alert(kon.qmake.alert["문항에 응답해주세요."]);
bools = false;
return false;
}
if(open[key]["option"]==="number"){
if(!$.isNumeric(target.val())){
//target.focus();
$.alert(kon.qmake.alert["숫자로만 응답해주세요."]);
bools = false;
return false;
}
}
if( $.isNumeric(open[key].min) && $.isNumeric(open[key].max) ) {
number = (+target.val());
if(+(open[key].min) > number || +(open[key].max) < number) {
$.alert( kon.qmake.alert["[min] ~ [max] 사이로 응답해주세요."].replace("[min]",open[key].min).replace("[max]",open[key].max) );
bools = false;
return false;
}
}
}
})
return bools;
}
var module = {
setVariable:setVariable,
setData:setData,
com_page_logic:com_page_logic,
CM1: CM1,
CM2: CM2,
CM3: CM3
}
return module;
})();