소스 정리

main
이범준 3 months ago
parent d1e36975b3
commit a4fe729d93

@ -85,39 +85,6 @@ function setCurrentRow(et){
}
/**************************************************************************
* HTML요소 어트리뷰트(프로퍼티,이벤트) 등록
**************************************************************************/
function ObjectInspector(doctx, data){
let objectInspector = {};
if(data == null){
objectInspector = JSON.parse(document.querySelector("[data-doctx='"+doctx+"']").querySelector("script.objectInspector").text);
} else if(data instanceof HTMLScriptElement){
objectInspector = JSON.parse(data.text);
} else if(typeof data == "string"){
let curlyBracketsOpen = String.fromCharCode(123); //중괄호시작
if(!data.trim().startsWith(curlyBracketsOpen)){
objectInspector = JSON.parse(document.querySelector("script[id='"+data+"'").text);
} else {
objectInspector = JSON.parse(data);
}
} else {
objectInspector = data;
}
let keys = Object.keys(objectInspector);
for(let key of keys){
let elem = document.querySelector("[data-doctx='"+doctx+"'] [name='"+key+"']");
let attrs = objectInspector[key];
let attrNames = Object.keys(attrs);
for(let attrName of attrNames){
elem.setAttribute(attrName,attrs[attrName]);
}
}
};
/**************************************************************************
@ -269,14 +236,6 @@ const Apply = {
};
const GRID = {
checkbox : {
sync : function(checkboxElement, bool){
@ -362,30 +321,3 @@ const GRID = {
/**************************************************************************
* 프로그레스바 표시
**************************************************************************/
const SSE_SUBSCRIBE_URL = wctx.url("/subscribe.do");
function fnProgress(sseKey, progressContent, progressEvent){
var eventSource = new EventSource(SSE_SUBSCRIBE_URL+"?sseKey="+sseKey);
eventSource.onopen = function(e) {
$.blockUI({
message : "<span id='progress-"+sseKey+"' >"+progressContent+"</span>",
css: { backgroundColor: "lightgrey", padding : "10px" }
});
};
eventSource.onerror = function(e) {
$.unblockUI();
};
eventSource.onmessage = function(e) {
if (e.data == 'FIN'){
eventSource.close();
$.unblockUI();
} else {
progressEvent(e.data);
}
};
}

@ -18,6 +18,7 @@ class FimsSupport {
console.log("fnJsonArrayToFormData(json배열,배열이름) : jsonArray를 FormData형식의 키를 갖는 json으로 치환한다.");
console.log("getCellDefsForPrivacyCell(TD태그의 제이쿼리 객체) : 엑셀다운로드시 개인정보 포함된 셀의 컬럼명을 추출하는 함수");
console.log("openPDF(blob객체,새 창 이름) : PDF파일 미리보기 창 열기");
console.log("fnProgress(sse키, progress팝업화면 내용, progress응답시 처리 메소드) : 프로그레스바 표시");
}
/**************************************************************************
@ -465,8 +466,36 @@ class FimsSupport {
};
}
/**************************************************************************
* 프로그레스바 표시
**************************************************************************/
static fnProgress(sseKey, progressContent, progressEvent){
var eventSource = new EventSource(SSE_SUBSCRIBE_URL+"?sseKey="+sseKey);
eventSource.onopen = function(e) {
$.blockUI({
message : "<span id='progress-"+sseKey+"' >"+progressContent+"</span>",
css: { backgroundColor: "lightgrey", padding : "10px" }
});
};
eventSource.onerror = function(e) {
$.unblockUI();
};
eventSource.onmessage = function(e) {
if (e.data == 'FIN'){
eventSource.close();
$.unblockUI();
} else {
progressEvent(e.data);
}
};
}
}
const SSE_SUBSCRIBE_URL = wctx.url("/subscribe.do");
const BOOTSTRAP_COLS = [
"col-1","col-2","col-3","col-4","col-5","col-6","col-7","col-8","col-9","col-10","col-11","col-12",
"col-sm-1","col-sm-2","col-sm-3","col-sm-4","col-sm-5","col-sm-6","col-sm-7","col-sm-8","col-sm-9","col-sm-10","col-sm-11","col-sm-12",

@ -0,0 +1,38 @@
/**************************************************************************
* HTML요소 어트리뷰트(프로퍼티,이벤트) 등록
**************************************************************************/
class ObjectInspector {
static help(){
console.log("regist(doctx명, 어트리뷰트정보) : HTML요소에 어트리뷰트(프로퍼티,이벤트) 등록");
}
static regist(doctx, data){
let objectInspector = {};
if(data == null){
objectInspector = JSON.parse(document.querySelector("[data-doctx='"+doctx+"']").querySelector("script.objectInspector").text);
} else if(data instanceof HTMLScriptElement){
objectInspector = JSON.parse(data.text);
} else if(typeof data == "string"){
let curlyBracketsOpen = String.fromCharCode(123); //중괄호시작
if(!data.trim().startsWith(curlyBracketsOpen)){
objectInspector = JSON.parse(document.querySelector("script[id='"+data+"'").text);
} else {
objectInspector = JSON.parse(data);
}
} else {
objectInspector = data;
}
let keys = Object.keys(objectInspector);
for(let key of keys){
let elem = document.querySelector("[data-doctx='"+doctx+"'] [name='"+key+"']");
let attrs = objectInspector[key];
let attrNames = Object.keys(attrs);
for(let attrName of attrNames){
elem.setAttribute(attrName,attrs[attrName]);
}
}
}
}
Loading…
Cancel
Save