It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Detecting if page is included in another page Edited

I have a macro ("Macro A") on one page that is running some javascript and creating some html.

 

That page is then included using the "Page Include" macro.

 

Is there a way, inside Macro A, to determine that it is inside the Page Include macro?

And then alter (in this case, disable some of the javascript and html) what Macro A is generating?

 

Currently, i'm using the AJS.toInit and searching for the "include" tag in the parent html.  This doesn't work as nicely as detecting it ahead of time, because i have to retroactively disable javascript or "display:none" html.


<script type="text/javascript">
var $pageIncluded = false;

AJS.toInit(function(){
a = document.getElementById("macro-a-content");
b = a.closest("[data-macro-name='include']")
if(b){
$pageIncluded = true;
}

)}
</script>

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

5,964 views 4 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you