最近の検索
最近の検索はありません

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
コメント