Jump to content

MediaWiki:Monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Xaosflux (talk | contribs) at 19:08, 5 June 2020 (phab:T254485 workaroudn). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
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 Wikipedia: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: [[User:TheDJ]], [[User:MZMcBride]]
 */
// Only when editing/previewing a page
if ( mw.config.get( 'wgAction' ) == 'submit' || mw.config.get( 'wgAction' ) == 'view' ) {
jQuery( function( $ ) {

	var $cNote = $( '#centralNotice' );
	// If there is no dismissible sitenotice and no expanded centralnotice:
	if ( !$( '#mw-dismissible-notice' ).length && !( $cNote.length && $cNote.hasClass('expanded') ) ) {
		return;
	}
	// Otherwise:
	mw.util.addCSS( '#bodyContent { position: relative; } #coordinates { position: absolute; top: 1px !important; }' );

} );
}

//Temporary fix for missing wikidata sidebar links, pending [[phab:T254485]] resolution
mw.loader.using(['mediawiki.util'], function () {
  if (mw.config.get('wgWikibaseItemId')) {
    mw.util.addPortletLink(
      'p-tb',
      'https://www.wikidata.org/wiki/' + mw.config.get('wgWikibaseItemId'),
      'Wikidata item',
      't-wikidata',
      'Structured data on this page hosted by Wikidata',
      null,
      '#t-cite'
    );
  };
});