Access on Labels from edited Site

Knorkenknuff May 2, 2018

I found this code snipet:

<script>
function disableWatchers() {
setTimeout(disableWatchers, 1000);
if ( $('#notifyWatchers').attr( "mz" ) != 1) {
setTimeout(function() {$('#notifyWatchers').removeAttr('checked');}, 1000);
$('#notifyWatchers').attr( "mz", 1);
}
}
disableWatchers();
</script>

I have add this to the custom HTML options but i dont want the script on all sites just on them with a label like "unsubscribe" but i don't know where i find the current tags from the site in the edit frame. 

Is is there a simple way to read the tags in the java script?

I want something like this:

<script>
function disableWatchers() {
setTimeout(disableWatchers, 1000);
if ( $('#notifyWatchers').attr( "mz" ) != 1) {
setTimeout(function() {
//A simple check if the Label "unsubscribe" is set to this page

if(SiteLabels.indexOf("unsubscribe")){$('#notifyWatchers').removeAttr('checked');}

}, 1000);
$('#notifyWatchers').attr( "mz", 1);
}
}
disableWatchers();
</script>

Any ideas?

1 answer

1 accepted

0 votes
Answer accepted
Knorkenknuff May 3, 2018

<script>
function disableWatchers() {
if("12911684" == AJS.Confluence.getContentId())
{
$('#notifyWatchers').removeAttr('checked');
}
setTimeout(function(){disableWatchers();},1000);
}
disableWatchers();
</script>

ok this works great but i dont use labels i use the ContentId from the page.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events