diff --git a/src/main/webapp/WEB-INF/jsp/index.jsp b/src/main/webapp/WEB-INF/jsp/index.jsp index 0ef11896..c872ba20 100644 --- a/src/main/webapp/WEB-INF/jsp/index.jsp +++ b/src/main/webapp/WEB-INF/jsp/index.jsp @@ -176,6 +176,11 @@ } } + async function LoadJson(path){ + let resp = await fetch(""+path); + return await resp.json(); + } + function FindObject(objectName, pageName){ if(pageName == undefined || pageName == null || pageName == ""){ return window[objectName]; diff --git a/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js b/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js index f807bcec..22897da2 100644 --- a/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js +++ b/src/main/webapp/resources/js/fims/cmmn/fims-cmmnUtil.js @@ -69,6 +69,38 @@ function clipboardCopy(string){ } } +/************************************************************************** +* 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"){ + if(!data.trim().startsWith(String.fromCharCode(123))){ + 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]); + } + } +}; + + /************************************************************************** * pdf파일 미리보기 창 **************************************************************************/