Recent searches


No recent searches

Goldylox's Avatar

Goldylox

Joined Oct 22, 2021

·

Last activity Oct 22, 2021

Following

0

Followers

0

Total activity

1

Votes

0

Subscriptions

0

ACTIVITY OVERVIEW

Latest activity by Goldylox

Goldylox commented,

Community comment Feedback - Help Center (Guide)

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

around whatever needs to be internal.

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!

 
 

View comment · Posted Jul 22, 2021 · Goldylox

0

Followers

0

Votes

0

Comments