MediaWiki:Common.js: Difference between revisions
Dragon 12dk (talk | contribs) No edit summary |
Dragon 12dk (talk | contribs) No edit summary |
||
| Line 29: | Line 29: | ||
} | } | ||
( function () { | ( function () { | ||
if ( window === window.top ) return; | if ( window === window.top ) return; | ||
function sendHeight() { | function sendHeight() { | ||
| Line 38: | Line 37: | ||
} | } | ||
// Fire on multiple events to catch all page types | |||
document.addEventListener( 'DOMContentLoaded', sendHeight ); | |||
window.addEventListener( 'load', function () { | |||
sendHeight(); | sendHeight(); | ||
setTimeout( sendHeight, 500 ); | setTimeout( sendHeight, 500 ); | ||
setTimeout( sendHeight, 1500 ); | setTimeout( sendHeight, 1500 ); | ||
} ); | } ); | ||
if ( typeof mw !== 'undefined' ) { | |||
mw.hook( 'wikipage.content' ).add( sendHeight ); | |||
} | |||
// | // Anchor scroll forwarding | ||
document.addEventListener( 'click', function ( e ) { | document.addEventListener( 'click', function ( e ) { | ||
var link = e.target.closest( 'a' ); | var link = e.target.closest( 'a' ); | ||