diff --git a/src/main/webapp/WEB-INF/jsp/include/top.jsp b/src/main/webapp/WEB-INF/jsp/include/top.jsp index f9925b85..f869ef6d 100644 --- a/src/main/webapp/WEB-INF/jsp/include/top.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/top.jsp @@ -147,6 +147,60 @@ -console.log('TODO: 보안모드 관련 스크립트 작성 필요'); +/* + * 보안모드 토글 처리 + */ +function fn_securityModeToggle(flag, elementId){ + + var executionArea; + if(elementId){ + executionArea = $("#"+elementId); + } else { + executionArea = $(document); + } + + var targets = executionArea.find("input.privacy"); + for(let i=0; i< targets.length; i++){ + let originId = targets[i].id; + let originValue= targets[i].value; + let maskingValue = originValue.replace(/[0-9a-zA-Z]/g, "*"); + document.getElementById("mask-"+originId).value = maskingValue; + } + + if(flag){ //개인정보 숨김 + + //입력상자 + $("input.privacy").attr("hidden","hidden"); + $("input.privacy-mask").removeAttr("hidden"); + + //그리드 + $("th.privacy").attr("hidden","hidden"); + $("td.privacy").attr("hidden","hidden"); + $("th.privacy-mask").removeAttr("hidden"); + $("td.privacy-mask").removeAttr("hidden"); + + } else { //개인정보 표시 + + //입력상자 + $("input.privacy").removeAttr("hidden"); + $("input.privacy-mask").attr("hidden","hidden"); + + $("th.privacy").removeAttr("hidden"); + $("td.privacy").removeAttr("hidden"); + $("th.privacy-mask").attr("hidden","hidden"); + $("td.privacy-mask").attr("hidden","hidden"); + + } + +} + +/*--------------------- 보안모드 체크박스 클릭 이벤트 ---------------------*/ +$("#securityMode--top").on( "click", function() { + if($("#securityMode--top").is(":checked")){ + fn_securityModeToggle(true); + } else { + fn_securityModeToggle(false); + } +});