<commit_before>document.addEventListener("DOMContentLoaded", function(event) {
  // this only works because the parent in AEM receives the message
  // and has code to act on it
  if (window.parent && window.parent.postMessage) {
    window.parent.postMessage({scrollToTop: true}, '*');
  }
});<commit_msg>Scroll to iframe top when clicking "Back to top" links<commit_after>document.addEventListener("DOMContentLoaded", function(event) {
  const sendScrollToTopMessage = () => {
    if (window.parent && window.parent.postMessage) {
      // this only works because the parent in AEM receives the message
      // and has code to act on it
      window.parent.postMessage({scrollToTop: true}, '*');
    }
  }

  sendScrollToTopMessage()

  document.getElementsByClassName("back_to_top__link").forEach((element) => {
    element.addEventListener("click", () => { sendScrollToTopMessage() })
  })
});
{'fraction_non_alphanumeric': 0.13028953229398663, 'fraction_numerical': 0.0, 'mean_word_length': 4.319526627218935, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5390577', 'n_tokens_mistral': 253, 'n_tokens_neox': 247, 'n_words': 65}