r65991 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65990‎ | r65991 | r65992 >
Date:19:03, 6 May 2010
Author:dale
Status:deferred
Tags:
Comment:
* added support for detecting the usability jquery-ui skin ( and not loading mwEmbed version )
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -2184,12 +2184,22 @@
21852185
21862186 // Set up mvEmbed utility jQuery bindings
21872187 mw.dojQueryBindings();
 2188+ var skinRequest = ['mw.style.mwCommon'];
21882189
 2190+ var includeUiCss = true;
 2191+ // Load the jQuery ui skin if usability skin not set
 2192+ $j( 'link' ).each( function( na, linkNode ){
 2193+ if( $j( linkNode ).attr( 'href' ).indexOf('jquery-ui-1.7.2.css') != -1 ) {
 2194+ includeUiCss = false;
 2195+ return false;
 2196+ }
 2197+ } );
 2198+ if( includeUiCss ){
 2199+ skinRequest.push( 'mw.style.' + mw.getConfig( 'jQueryUISkin' ) );
 2200+ }
 2201+
21892202 // Make sure style sheets are loaded:
2190 - mw.load( [
2191 - 'mw.style.mwCommon',
2192 - 'mw.style.' + mw.getConfig( 'jQueryUISkin' )
2193 - ], function(){
 2203+ mw.load( skinRequest , function(){
21942204
21952205 // Run all the setup function hooks
21962206 // NOTE: setup functions are added via addSetupHook calls
Index: branches/js2-work/phase3/js/mwEmbed/jsScriptLoader.php
@@ -132,7 +132,7 @@
133133 // Check that mwEmbed required style sheets are part of the request,
134134 // if not include them here
135135 // This is so mwEmbed requests gets basic interface css
136 - foreach( array('mw.style.mwCommon', 'mw.style.jqueryUiRedmond') as $styleKey ){
 136+ foreach( array('mw.style.mwCommon' ) as $styleKey ){
137137 if( !isset( $this->namedFileList[ $styleKey ] ) ) {
138138 $this->output .= $this->getScriptText( $styleKey );
139139 }
Index: branches/js2-work/phase3/js/mwEmbed/remotes/mediaWiki.js
@@ -171,7 +171,8 @@
172172 * ( front-loaded to avoid extra requests )
173173 */
174174 function mwLoadPlayer( callback ){
175 - // the jsPlayerRequest includes both javascript and style sheets for the embedPlayer
 175+
 176+ // The jsPlayerRequest includes both javascript and style sheets for the embedPlayer
176177 var jsPlayerRequest = [
177178 'mw.EmbedPlayer',
178179 '$j.ui',
@@ -183,7 +184,8 @@
184185 '$j.fn.menu',
185186 'mw.style.jquerymenu',
186187 'mw.TimedText'
187 - ];
 188+ ];
 189+
188190 // Quick sniff use java if IE and native if firefox
189191 // ( other browsers will run detect and get on-demand )
190192 if (navigator.userAgent.indexOf("MSIE") != -1){
@@ -208,8 +210,7 @@
209211 // Don't process empty vids
210212 if ( !vidId ){
211213 return ;
212 - }
213 -
 214+ }
214215
215216 tag_type = 'video';
216217
@@ -250,7 +251,7 @@
251252 offset = re.exec( rewriteHTML );
252253 var offset_attr = ( offset && offset[2] )? 'startOffset="' + offset[2] + '" ' : '';
253254
254 - // Check if file is from commons and therefore should explictly set apiProvider to commons:
 255+ // Check if file is from commons and therefore should explicitly set apiProvider to commons:
255256 var apiProviderAttr = ( src.indexOf( 'wikipedia\/commons' ) != -1 )?'apiProvider="commons" ': '';
256257
257258 if ( src ) {
@@ -412,8 +413,7 @@
413414 //Gadget button already in dom
414415 return false;
415416 }
416 -
417 -
 417+
418418 scripts = document.getElementsByTagName( 'script' );
419419
420420 // Check for document paramater withJS and ignore found gadget

Status & tagging log