MediaWiki:Common.js: Difference between revisions

No edit summary
No edit summary
Line 28: Line 28:
   });
   });
}
}
// Report page height to parent when embedded
( function () {
  if ( !window.location.search.includes( 'embed=1' ) ) return;
  function sendHeight() {
    window.parent.postMessage( { embedHeight: document.body.scrollHeight }, '*' );
  }
  mw.hook( 'wikipage.content' ).add( function () {
    sendHeight();
    setTimeout( sendHeight, 500 );
    setTimeout( sendHeight, 1500 );
  } );
} )();