From 2b3733ecab253215d9c24684e7ee0871cb1f78e1 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Mon, 26 Dec 2011 16:12:07 +0000 Subject: [PATCH] [Core JS] wikibits.js / IEFixes clean up * fix on-the-loose fixalpha() call -- Calls should not be dangling loose like that -- Removed local calls from skins and installer -- instead calling from the IEFixes script (which is loaded raw by wikibits which is loaded from the bottom, as are all legacy scripts) * Removing usage of 'skinpath' and 'skin' globals in wikibits.js, those aren't globals per se since introduction of mw.config and $wgLegacyJavaScriptGlobals * Wrapping wikibits.js in closure to avoid leakage of "local" variables. This shouldn't break anything as it is loaded through resource loader which, in production mode, wraps it in a closure anyway. * adding explicit posision=>bottom for wikibits. 'bottom' is default but repeating here since it must not change for legacy reasons. --- includes/installer/WebInstallerOutput.php | 1 - resources/Resources.php | 1 + skins/MonoBook.php | 1 - skins/Vector.php | 3 --- skins/common/IEFixes.js | 6 +++++ skins/common/wikibits.js | 27 ++++++++++++++--------- 6 files changed, 23 insertions(+), 16 deletions(-) diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index a28cda09a2..ac97b37d28 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -232,7 +232,6 @@ class WebInstallerOutput { href="http://www.mediawiki.org/" title="Main Page"> -
parent->parse( wfMsgNoTrans( 'config-sidebar' ), true ); diff --git a/resources/Resources.php b/resources/Resources.php index efbbab394a..9e0d689065 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -833,6 +833,7 @@ return array( 'localBasePath' => $GLOBALS['wgStyleDirectory'], 'dependencies' => 'mediawiki.language', 'messages' => array( 'showtoc', 'hidetoc' ), + 'position' => 'bottom', ), 'mediawiki.legacy.wikiprintable' => array( 'styles' => array( 'common/wikiprintable.css' => array( 'media' => 'print' ) ), diff --git a/skins/MonoBook.php b/skins/MonoBook.php index b799fbcdfd..0e10b5b9e6 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -109,7 +109,6 @@ class MonoBookTemplate extends BaseTemplate { + Linker::tooltipAndAccesskeyAttribs('p-logo') ); ?>
- renderPortals( $this->data['sidebar'] ); ?> diff --git a/skins/Vector.php b/skins/Vector.php index 1779566e99..4b6433d630 100644 --- a/skins/Vector.php +++ b/skins/Vector.php @@ -238,9 +238,6 @@ class VectorTemplate extends BaseTemplate {
- - - printTrail(); ?> diff --git a/skins/common/IEFixes.js b/skins/common/IEFixes.js index 7f3b9c0fb7..427d41c4d6 100644 --- a/skins/common/IEFixes.js +++ b/skins/common/IEFixes.js @@ -63,6 +63,12 @@ window.fixalpha = function( logoId ) { } }; +if( isMSIE55 ) { + // Legacy modules are loaded from the bottom + // No need to wait for DOMContentReady or window.onload + fixalpha(); +} + // fix ie6 disappering float bug window.relativeforfloats = function() { var bc = document.getElementById( 'bodyContent' ); diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 682034a45d..a6ba268b04 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -1,4 +1,7 @@ -// MediaWiki JavaScript support functions +/** + * MediaWiki legacy wikibits + */ +(function(){ window.clientPC = navigator.userAgent.toLowerCase(); // Get client info window.is_gecko = /gecko/.test( clientPC ) && @@ -47,7 +50,7 @@ if ( /msie ([0-9]{1,}[\.0-9]{0,})/.exec( clientPC ) != null } // Global external objects used by this script. -/*extern ta, stylepath, skin */ +/*extern ta */ // add any onload functions in this hook (please don't hard-code any events in the xhtml source) window.doneOnloadHook = undefined; @@ -116,20 +119,20 @@ window.appendCSS = function( text ) { }; // Special stylesheet links for Monobook only (see bug 14717) -if ( typeof stylepath != 'undefined' && skin == 'monobook' ) { +var skinpath = mw.config.get( 'stylepath' ) + '/' + mw.config.get( 'skin' ); +if ( mw.config.get( 'skin' ) === 'monobook' ) { if ( opera6_bugs ) { - importStylesheetURI( stylepath + '/' + skin + '/Opera6Fixes.css' ); + importStylesheetURI( skinpath + '/Opera6Fixes.css' ); } else if ( opera7_bugs ) { - importStylesheetURI( stylepath + '/' + skin + '/Opera7Fixes.css' ); + importStylesheetURI( skinpath + '/Opera7Fixes.css' ); } else if ( opera95_bugs ) { - importStylesheetURI( stylepath + '/' + skin + '/Opera9Fixes.css' ); + importStylesheetURI( skinpath + '/Opera9Fixes.css' ); } else if ( ff2_bugs ) { - importStylesheetURI( stylepath + '/' + skin + '/FF2Fixes.css' ); + importStylesheetURI( skinpath + '/FF2Fixes.css' ); } } - -if ( 'wgBreakFrames' in window && window.wgBreakFrames ) { +if ( mw.config.get( 'wgBreakFrames' ) ) { // Un-trap us from framesets if ( window.top != window ) { window.top.location = window.location; @@ -581,7 +584,7 @@ window.jsMsg = function( message, className ) { window.injectSpinner = function( element, id ) { var spinner = document.createElement( 'img' ); spinner.id = 'mw-spinner-' + id; - spinner.src = stylepath + '/common/images/spinner.gif'; + spinner.src = mw.config.get( 'stylepath' ) + '/common/images/spinner.gif'; spinner.alt = spinner.title = '...'; if( element.nextSibling ) { element.parentNode.insertBefore( spinner, element.nextSibling ); @@ -666,5 +669,7 @@ window.removeHandler = function( element, remove, handler ) { hookEvent( 'load', runOnloadHook ); if ( ie6_bugs ) { - importScriptURI( stylepath + '/common/IEFixes.js' ); + importScriptURI( mw.config.get( 'stylepath' ) + '/common/IEFixes.js' ); } + +})(); -- 2.20.1