Jump to content

MediaWiki:Common.js

From Idle Lumber Empire Wiki

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
// IDLELUMBER_CONTEXTUAL_CORRECTION_LINK_START
// Pre-fill the owner-approved editorial correction form with the exact page.
mw.hook( 'wikipage.content' ).add( function ( $content ) {
    if ( !window.mw || !mw.config || document.getElementById( 'idlewiki-report-this-page' ) ) {
        return;
    }
    var pageName = mw.config.get( 'wgPageName' );
    if ( !pageName || mw.config.get( 'wgNamespaceNumber' ) === -1 ) {
        return;
    }
    var wikiUrl = 'https://idlelumber.wiki/w/index.php?title=' + encodeURIComponent( pageName );
    var formUrl = '/support/report.php?page=' + encodeURIComponent( wikiUrl );
    var target = $content && $content[ 0 ];
    if ( !target ) {
        return;
    }
    var wrap = document.createElement( 'div' );
    wrap.id = 'idlewiki-report-this-page';
    wrap.className = 'idlewiki-report-this-page';
    var link = document.createElement( 'a' );
    link.href = formUrl;
    link.textContent = 'Report a correction on this page';
    link.setAttribute( 'aria-label', 'Report an error or correction for this wiki page' );
    wrap.appendChild( link );
    target.appendChild( wrap );
} );
// IDLELUMBER_CONTEXTUAL_CORRECTION_LINK_END