r107327 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107326‎ | r107327 | r107328 >
Date:16:12, 26 December 2011
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
[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.
Modified paths:
  • /trunk/phase3/includes/installer/WebInstallerOutput.php (modified) (history)
  • /trunk/phase3/resources/Resources.php (modified) (history)
  • /trunk/phase3/skins/MonoBook.php (modified) (history)
  • /trunk/phase3/skins/Vector.php (modified) (history)
  • /trunk/phase3/skins/common/IEFixes.js (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -1,4 +1,7 @@
2 -// MediaWiki JavaScript support functions
 2+/**
 3+ * MediaWiki legacy wikibits
 4+ */
 5+(function(){
36
47 window.clientPC = navigator.userAgent.toLowerCase(); // Get client info
58 window.is_gecko = /gecko/.test( clientPC ) &&
@@ -47,7 +50,7 @@
4851 }
4952
5053 // Global external objects used by this script.
51 -/*extern ta, stylepath, skin */
 54+/*extern ta */
5255
5356 // add any onload functions in this hook (please don't hard-code any events in the xhtml source)
5457 window.doneOnloadHook = undefined;
@@ -116,20 +119,20 @@
117120 };
118121
119122 // Special stylesheet links for Monobook only (see bug 14717)
120 -if ( typeof stylepath != 'undefined' && skin == 'monobook' ) {
 123+var skinpath = mw.config.get( 'stylepath' ) + '/' + mw.config.get( 'skin' );
 124+if ( mw.config.get( 'skin' ) === 'monobook' ) {
121125 if ( opera6_bugs ) {
122 - importStylesheetURI( stylepath + '/' + skin + '/Opera6Fixes.css' );
 126+ importStylesheetURI( skinpath + '/Opera6Fixes.css' );
123127 } else if ( opera7_bugs ) {
124 - importStylesheetURI( stylepath + '/' + skin + '/Opera7Fixes.css' );
 128+ importStylesheetURI( skinpath + '/Opera7Fixes.css' );
125129 } else if ( opera95_bugs ) {
126 - importStylesheetURI( stylepath + '/' + skin + '/Opera9Fixes.css' );
 130+ importStylesheetURI( skinpath + '/Opera9Fixes.css' );
127131 } else if ( ff2_bugs ) {
128 - importStylesheetURI( stylepath + '/' + skin + '/FF2Fixes.css' );
 132+ importStylesheetURI( skinpath + '/FF2Fixes.css' );
129133 }
130134 }
131135
132 -
133 -if ( 'wgBreakFrames' in window && window.wgBreakFrames ) {
 136+if ( mw.config.get( 'wgBreakFrames' ) ) {
134137 // Un-trap us from framesets
135138 if ( window.top != window ) {
136139 window.top.location = window.location;
@@ -581,7 +584,7 @@
582585 window.injectSpinner = function( element, id ) {
583586 var spinner = document.createElement( 'img' );
584587 spinner.id = 'mw-spinner-' + id;
585 - spinner.src = stylepath + '/common/images/spinner.gif';
 588+ spinner.src = mw.config.get( 'stylepath' ) + '/common/images/spinner.gif';
586589 spinner.alt = spinner.title = '...';
587590 if( element.nextSibling ) {
588591 element.parentNode.insertBefore( spinner, element.nextSibling );
@@ -666,5 +669,7 @@
667670 hookEvent( 'load', runOnloadHook );
668671
669672 if ( ie6_bugs ) {
670 - importScriptURI( stylepath + '/common/IEFixes.js' );
 673+ importScriptURI( mw.config.get( 'stylepath' ) + '/common/IEFixes.js' );
671674 }
 675+
 676+})();
Index: trunk/phase3/skins/common/IEFixes.js
@@ -63,6 +63,12 @@
6464 }
6565 };
6666
 67+if( isMSIE55 ) {
 68+ // Legacy modules are loaded from the bottom
 69+ // No need to wait for DOMContentReady or window.onload
 70+ fixalpha();
 71+}
 72+
6773 // fix ie6 disappering float bug
6874 window.relativeforfloats = function() {
6975 var bc = document.getElementById( 'bodyContent' );
Index: trunk/phase3/skins/Vector.php
@@ -238,9 +238,6 @@
239239 <div style="clear:both"></div>
240240 </div>
241241 <!-- /footer -->
242 - <!-- fixalpha -->
243 - <script type="<?php $this->text( 'jsmimetype' ) ?>"> if ( window.isMSIE55 ) fixalpha(); </script>
244 - <!-- /fixalpha -->
245242 <?php $this->printTrail(); ?>
246243
247244 </body>
Index: trunk/phase3/skins/MonoBook.php
@@ -109,7 +109,6 @@
110110 + Linker::tooltipAndAccesskeyAttribs('p-logo') ); ?>
111111
112112 </div>
113 - <script type="<?php $this->text('jsmimetype') ?>"> if (window.isMSIE55) fixalpha(); </script>
114113 <?php
115114 $this->renderPortals( $this->data['sidebar'] );
116115 ?>
Index: trunk/phase3/includes/installer/WebInstallerOutput.php
@@ -232,7 +232,6 @@
233233 href="http://www.mediawiki.org/"
234234 title="Main Page"></a>
235235 </div>
236 - <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
237236 <div class="portal"><div class="body">
238237 <?php
239238 echo $this->parent->parse( wfMsgNoTrans( 'config-sidebar' ), true );
Index: trunk/phase3/resources/Resources.php
@@ -833,6 +833,7 @@
834834 'localBasePath' => $GLOBALS['wgStyleDirectory'],
835835 'dependencies' => 'mediawiki.language',
836836 'messages' => array( 'showtoc', 'hidetoc' ),
 837+ 'position' => 'bottom',
837838 ),
838839 'mediawiki.legacy.wikiprintable' => array(
839840 'styles' => array( 'common/wikiprintable.css' => array( 'media' => 'print' ) ),

Follow-up revisions

RevisionCommit summaryAuthorDate
r108222Set position => 'top' for wikibits, required to support legacy gadgets. Spott...catrope12:03, 6 January 2012
r108885[Core JS] Fix code from r107327 which was broken by r108222...krinkle00:40, 14 January 2012

Comments

#Comment by Krinkle (talk | contribs)   17:13, 26 December 2011

Tested in IE6 at Browserstack with local tunneling to their VM, still works and does the alphafix :)

#Comment by Robmoen (talk | contribs)   01:01, 21 January 2012

Tested in IE6 on XP SP2.

#Comment by Krinkle (talk | contribs)   14:13, 9 November 2012

Fixes bug 26878.

Status & tagging log