최근 검색
최근 검색 없음

Goldylox
가입한 날짜: 2021년 10월 22일
·
마지막 활동: 2021년 10월 22일
팔로잉
0
팔로워
0
총 활동 수
1
투표 수
0
플랜 수
0
활동 개요
배지
문서
게시물
커뮤니티 댓글
문서 댓글
활동 개요
님의 최근 활동 Goldylox
Goldylox님이 에 댓글을 입력함
Hey all!
Just to chime in on a more secure way for what Colin suggested, instead of hiding and showing alone, there's a way to remove element by class so it doesn't show at all, not even in Inspect. This way it can't be bypassed (or at least is incredibly more difficult to bypass if not impossible?).
In javascript:
// Remove or show div html based on role
if (HelpCenter.user.role=="end_user"){
const elements = document.getElementsByClassName('internal');
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
}
if (HelpCenter.user.role=="anonymous"){
const elements = document.getElementsByClassName('internal');
while(elements.length > 0){
elements[0].parentNode.removeChild(elements[0]);
}
}
if (HelpCenter.user.role=="agent"){
var elements = document.getElementsByClassName('internal');
for (var i = 0; i < elements.length; i ++) {
elements[i].style.display = 'block';
}
}
if (HelpCenter.user.role=="manager"){
var elements = document.getElementsByClassName('internal');
for (var i = 0; i < elements.length; i ++) {
elements[i].style.display = 'block';
}
}
css code, hidden by default because there's a weird thing where when the page is refreshed the internal notes are displayed for everyone for a split second before the javascript removes it (puts a red outline and light red background so it stands out as being internal, as well as writes Internal Notes at the top of the box):
/* internal note styling */
.internal:before {
content:"Internal Notes \a";
font-size:22px;
color:red;
white-space: pre;
}
.internal {
background-color: #ffeeee;
border: 1px solid #ff0101;
border-radius: 5px;
text-align: left;
padding-top: 7px;
padding-bottom: 7px;
padding-left: 14px;
padding-right: 14px;
position: relative;
display: none;
}
Then put
This will hide internal notes by default, remove them from the HTML if the user is an End User or Anonymous, and change display to block if the user is an Agent or Manager. Internal notes can be used multiple times in the same article with this code. Hope this helps!
댓글 보기 · 2021년 7월 22일에 게시됨 · Goldylox
0
팔로워
0
투표 수
0
댓글