Misplaced Pages

MediaWiki:Monobook.js

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

This is an old revision of this page, as edited by Xaosflux (talk | contribs) at 00:19, 11 February 2021 (lets id where this is coming from). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 00:19, 11 February 2021 by Xaosflux (talk | contribs) (lets id where this is coming from)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
This is the JavaScript for the monobook skin only. Any changes to this page should first be proposed on its talk page or the Village pump.

Please note that changes are visible within minutes. Errors you make here can disrupt the entire encyclopedia, so make sure you know what you are doing.

Testing can be done on your personal common.js or skin-specific JS file.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Misplaced Pages:Bypass your cache.
/* Any JavaScript here will be loaded for users using the MonoBook skin */

/**
 * Topbar content fix with sitenotice and CentralNotice
 *
 * Description: This fixes the location of topbar content (e.g., featured
 *              content star) when the sitenotice or CentralNotice is active.
 * Maintainers: ], ]
 */
// Only when editing/previewing a page
if ( mw.config.get( 'wgAction' ) == 'submit' || mw.config.get( 'wgAction' ) == 'view' ) {
	$( function() {
		// If there is a dismissible sitenotice or an (expanded) centralnotice
		if ( $( '#mw-dismissible-notice' ).length || $( '#centralNotice' ).hasClass('expanded') ) {
			mw.util.addCSS( '#bodyContent { position: relative; } #coordinates { position: absolute; top: 1px !important; }' );
		}
	} );
}

// Add support for legacy methods still being used by logged in users in their user scripts so these do not log as errors
// Please talk to ] before removing.

function stubMissingFunctionError( method, rtnValue ) {
  if(window) return;
  window = function () {
    mw.log.error('Monobook.js says - A user script or gadget you have loaded is using a deprecated method:' + method);
    return rtnValue;
  };
}
stubMissingFunctionError('getElementsByClassName', );
stubMissingFunctionError('sajax_init_object');
stubMissingFunctionError('appendCSS');
stubMissingFunctionError('akeytt');
stubMissingFunctionError('attachEvent');