#Title Collapsible Journal subpages

1 messages · Page 1 of 1 (latest)

dull osprey
#
Hooks.on('renderJournalPageSheet', (JournalSheet, html)=>{
  $(`li[data-page-id="${JournalSheet.object._id}"] > div`).next().hide();
  $(`li[data-page-id="${JournalSheet.object._id}"] > div > a.toggle`).remove();
  let $button = $(`<a class="toggle" style="width:50px; text-align: right; padding-right: .5em;"><i class="fa-solid fa-caret-down"></i></a>`)
  .click(function(){
    $(this).parent().next().toggle();
    $(this).parent().next().is(':hidden')?$(this).html('<i class="fa-solid fa-caret-down"></i>'):$(this).html('<i class="fa-solid fa-caret-up"></i>')
  })
  $(`li[data-page-id="${JournalSheet.object._id}"] > div`).append($button)
});
```try this
I have not messed with subpages, but this helps with my pages with many headers