Recherches récentes
Pas de recherche récente

Goldylox
Adhésion le 22 oct. 2021
·
Dernière activité le 22 oct. 2021
Suivis
0
Abonnés
0
Activité totale
1
Votes
0
Abonnements
0
APERÇU DES ACTIVITÉS
BADGES
ARTICLES
PUBLICATIONS
COMMENTAIRES DE LA COMMUNAUTÉ
COMMENTAIRES SUR L’ARTICLE
APERÇU DES ACTIVITÉS
Dernière activité effectuée par Goldylox
Goldylox a ajouté un commentaire,
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!
Afficher le commentaire · Publication le 22 juil. 2021 · Goldylox
0
Abonnés
0
Votes
0
Commentaire