User:Eentelijent/common.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin can be added at User:Eentelijent/common.css. |
importScript('User:SD0001/DYK-helper.js'); // [[User:SD0001/DYK-helper.js]]
/* The following is for custom add-ons for 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' ) {
$( 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 [[User:Jon (WMF)]] before removing.
function stubMissingFunctionError( method, rtnValue ) {
if(window[method]) return;
window[method] = 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');
if (typeof InstaView === 'undefined') {
window.InstaView = {}; // seeing various Uncaught ReferenceError: InstaView is not defined errors. Can be removed when addressed in https://global-search.toolforge.org/?q=InstaView%5C.®ex=1&namespaces=&title=.*%2Fmonobook%5C.js
}
// Avoid issue in old Monobook scripts: ReferenceError: mwCustomEditButtons is not defined
if(typeof mwCustomEditButtons !== 'undefined') window.mwCustomEditButtons = [];