소스 정리

main
이범준 3 months ago
parent a19f0b7a4e
commit 9eda173b86

@ -176,6 +176,11 @@
}
}
async function LoadJson(path){
let resp = await fetch("<c:url value='' />"+path);
return await resp.json();
}
function FindObject(objectName, pageName){
if(pageName == undefined || pageName == null || pageName == ""){
return window[objectName];

@ -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파일 미리보기
**************************************************************************/

Loading…
Cancel
Save