From 0ccd565a97a724595502333a62a1b7189f0dcd2c Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 22 Jun 2023 13:25:00 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B3=B4=EC=95=88=EB=AA=A8=EB=93=9C=20?= =?UTF-8?q?=EC=B2=98=EB=A6=AC=20=ED=95=A8=EC=88=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/WEB-INF/jsp/include/top.jsp | 56 ++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) 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); + } +});