r60004 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60003‎ | r60004 | r60005 >
Date:19:45, 12 December 2009
Author:dale
Status:deferred
Tags:
Comment:
* some code comment updates for scriptLoader
* some mwEmbed updates per updated http://www.mediawiki.org/wiki/MwEmbed page
* fixed spinner spelling
Modified paths:
  • /branches/js2-work/phase3/js2/mwEmbed/example_usage/Player_Timed_Text.html (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/jsScriptLoader.php (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskinConfig.js (modified) (history)
  • /branches/js2-work/phase3/js2/mwEmbed/tests/testApiProxy.html (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js2/mwEmbed/example_usage/Player_Timed_Text.html
@@ -17,7 +17,7 @@
1818 Metavid based ROE file using CMML<br> <pre>&lt;video roe=&quot;http://metavid.org/w/index.php?title=Special:MvExportStream&amp;stream_name=House_proceeding_07-18-06_00&amp;t=1:23:16/1:23:44&amp;feed_format=roe&quot; &gt;&lt;/video&gt;</pre><iframe width="600" height="250" src="http://metavid.org/w/index.php?title=Special:MvExportStream&stream_name=House_proceeding_07-18-06_00&t=1:23:16/1:23:44&feed_format=roe" ></iframe> </td>
1919
2020 </tr>
21 - <tr>
 21+ <!-- <tr>
2222 <td valign="top" width="410">
2323 <video poster="http://ia340929.us.archive.org/0/items/princess_iron_fan/princess_iron_fan.thumbs/princess_iron_fan_000360.jpg"
2424 duration="1:13:0" linkback="http://www.archive.org/details/princess_iron_fan" >
@@ -53,7 +53,7 @@
5454 </text>
5555 </video>
5656 </textarea> </td>
57 - </tr>
 57+ </tr> -->
5858 </table>
5959
6060 </body>
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -804,7 +804,7 @@
805805 mw.log( "showUploadTab::" );
806806 var _this = this;
807807 // set it to loading:
808 - $j( '#tab-upload' ).loadingSpiner();
 808+ $j( '#tab-upload' ).loadingSpinner();
809809 // Do things async to keep interface snappy
810810 setTimeout(
811811 function() {
@@ -859,13 +859,13 @@
860860 '<td valign="top" style="width:350px; padding-right: 12px;">' +
861861 '<h4>' + uploadMsg + '</h4>' +
862862 '<div id="upload_form">' +
863 - mw.loading_spiner() +
 863+ mw.loading_spinner() +
864864 '</div>' +
865865 '</td>' +
866866 '<td valign="top" id="upload_bin_cnt">' +
867867 '<h4>' + recentUploadsMsg + '</h4>' +
868868 '<div id="upload_bin">' +
869 - mw.loading_spiner() +
 869+ mw.loading_spinner() +
870870 '</div>' +
871871 '</td>' +
872872 '</tr>' +
@@ -951,7 +951,7 @@
952952 }
953953
954954 // Set the content to loading while we do the search:
955 - $j( '#tab-' + providerName ).html( mw.loading_spiner() );
 955+ $j( '#tab-' + providerName ).html( mw.loading_spinner() );
956956
957957 // Make sure the search library is loaded and issue the search request
958958 this.getLibSearchResults( provider );
@@ -1443,7 +1443,7 @@
14441444 'style="position:absolute;' + overflowStyle + ';' +
14451445 'left:' + ( maxWidth + 20 ) + 'px;right:0px;top:5px;bottom:10px;' +
14461446 'padding:5px;" >' +
1447 - mw.loading_spiner( 'position:absolute;top:30px;left:30px' ) +
 1447+ mw.loading_spinner( 'position:absolute;top:30px;left:30px' ) +
14481448 '</div>' +
14491449 '</div>' );
14501450 },
@@ -1944,7 +1944,7 @@
19451945 '<br style="clear both"/>' +
19461946 '<strong>' + gM( 'mwe-resource_page_desc' ) + '</strong>' +
19471947 '<div id="rsd_import_desc" style="display:inline;">' +
1948 - mw.loading_spiner( 'position:absolute;top:5px;left:5px' ) +
 1948+ mw.loading_spinner( 'position:absolute;top:5px;left:5px' ) +
19491949 '</div>' +
19501950 '</div>' +
19511951 '<div id="rds_edit_import_container" ' +
@@ -1997,7 +1997,7 @@
19981998 .btnBind()
19991999 .click( function() {
20002000 mw.log( " Do preview asset update" );
2001 - $j( '#rsd_import_desc' ).html( mw.loading_spiner() );
 2001+ $j( '#rsd_import_desc' ).html( mw.loading_spinner() );
20022002 // load the preview text:
20032003 _this.parse(
20042004 $j( '#rsd_import_ta' ).val(),
@@ -2198,7 +2198,7 @@
21992199 '<div id="rsd_preview_display"' +
22002200 'style="position:absolute;overflow:hidden;z-index:4;' +
22012201 'top:0px;bottom:0px;right:0px;left:0px;background-color:#FFF;">' +
2202 - mw.loading_spiner( 'top:30px;left:30px' ) +
 2202+ mw.loading_spinner( 'top:30px;left:30px' ) +
22032203 '</div>' );
22042204
22052205 var buttonPaneSelector = _this.target_container + '~ .ui-dialog-buttonpane';
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
@@ -377,7 +377,7 @@
378378
379379 // Set the HTTP box to "loading", in case we don't get an update for some time
380380 $j( '#dlbox-centered' ).html( '<h5>' + _this.getProgressTitle() + '</h5>' +
381 - mw.loading_spiner( 'left:40%;top:20%' )
 381+ mw.loading_spinner( 'left:40%;top:20%' )
382382 );
383383
384384 // Set up the request
@@ -568,7 +568,7 @@
569569 error_msg = apiRes.error;
570570
571571 // There are many possible error messages here, so we don't load all
572 - // message text in advance, instead we use gMsgLoadRemote() for some.
 572+ // message text in advance, instead we use mw.getRemoteMsg() for some.
573573 //
574574 // This code is similar to the error handling code formerly in
575575 // SpecialUpload::processUpload()
@@ -600,7 +600,7 @@
601601 if ( apiRes.upload.error == 'internal-error' ) {
602602 // Do a remote message load
603603 errorKey = apiRes.upload.details[0];
604 - gMsgLoadRemote( errorKey, function() {
 604+ mw.getRemoteMsg( errorKey, function() {
605605 _this.updateProgressWin( gM( 'mwe-uploaderror' ), gM( errorKey ), buttons );
606606
607607 });
@@ -637,7 +637,7 @@
638638 }
639639
640640 mw.log( 'get key: ' + error_msg_key[ error_code ] )
641 - gMsgLoadRemote( error_msg_key[ error_code ], function() {
 641+ mw.getRemoteMsg( error_msg_key[ error_code ], function() {
642642 _this.updateProgressWin(
643643 gM( 'mwe-uploaderror' ),
644644 gM( error_msg_key[ error_code ], errorReplaceArg ),
@@ -693,7 +693,7 @@
694694 //check if we have a stashed key:
695695 if ( _this.warnings_sessionkey ) {
696696 //set to "loading"
697 - $j( '#upProgressDialog' ).html( mw.loading_spiner() );
 697+ $j( '#upProgressDialog' ).html( mw.loading_spinner() );
698698 //setup loading:
699699 var request = {
700700 'action': 'upload',
@@ -797,7 +797,7 @@
798798 title_txt = _this.getProgressTitle();
799799
800800 if ( !msg )
801 - msg = mw.loading_spiner( 'left:40%;top:40px;' );
 801+ msg = mw.loading_spinner( 'left:40%;top:40px;' );
802802
803803 if ( !buttons ) {
804804 // If no buttons are specified, add a close button
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js
@@ -416,7 +416,7 @@
417417 'width' : playerInterface.width,
418418 'height' : playerInterface.height
419419 } )
420 - .html( mw.loading_spiner() );
 420+ .html( mw.loading_spinner() );
421421
422422 // Apply the Player interface to the DOM element
423423 for ( var method in playerInterface ) { // for in loop oky in Element context
@@ -1047,15 +1047,9 @@
10481048 addROE: function( roe_data ) {
10491049 mw.log( 'f:addROE' );
10501050 this.addedROEData = true;
1051 - var _this = this;
1052 - if ( typeof roe_data == 'string' )
1053 - {
1054 - var parser = new DOMParser();
1055 - mw.log( 'ROE data:' + roe_data );
1056 - roe_data = parser.parseFromString( roe_data, "text/xml" );
1057 - }
 1051+ var _this = this;
10581052 if ( roe_data ) {
1059 - $j.each( roe_data.getElementsByTagName( 'mediaSource' ), function( inx, source ) {
 1053+ $j( roe_data ).find("mediaSource").each( function( inx, source ) {
10601054 _this.tryAddSource( source );
10611055 } );
10621056 // set the thumbnail:
@@ -2240,7 +2234,7 @@
22412235 'height:' + theight + 'px;width:400px;' +
22422236 'display:none;" ' +
22432237 'id="metaBox_' + this.id + '">' +
2244 - mw.loading_spiner() +
 2238+ mw.loading_spinner() +
22452239 '</div>' );
22462240 }
22472241 // check if textObj present:
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js
@@ -777,7 +777,7 @@
778778 mw.log( "sequence:doEditTransition" );
779779 var _this = this;
780780 // Add a loading image
781 - mw.loading_spiner( '#transitions_ic' );
 781+ mw.loading_spinner( '#transitions_ic' );
782782 mw.load( [
783783 '$j.fn.ColorPicker',
784784 'mvTimedEffectsEdit'
@@ -799,7 +799,7 @@
800800 mw.log( 'seq:doEditClip' );
801801 var _this = this;
802802
803 - mw.loading_spiner( '#clipedit_ic' );
 803+ mw.loading_spinner( '#clipedit_ic' );
804804
805805 // Load the clipEdit library if not already loaded:
806806 mw.load( [
Index: branches/js2-work/phase3/js2/mwEmbed/tests/testApiProxy.html
@@ -29,7 +29,7 @@
3030 });
3131 function doHello(){
3232 mw.log('to a hello user');
33 - $j('#helloTarget').html( mw.loading_spiner() );
 33+ $j('#helloTarget').html( mw.loading_spinner() );
3434 //first get the user name:
3535 getUserName(function( user_name ){
3636 $j('#helloTarget').hide().text( user_name ).fadeIn('slow');
@@ -56,7 +56,7 @@
5757
5858 //simple "hello from api proxy" append on talk page
5959 function doAppend(){
60 - $j('#appendTarget').html( mw.loading_spiner() );
 60+ $j('#appendTarget').html( mw.loading_spinner() );
6161 //get user name
6262 getUserName(function(userName){
6363 var eTitle = 'User_talk:' + userName;
Index: branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js
@@ -234,7 +234,7 @@
235235 'doEdit':function( _this, target ) {
236236 // if media type is template we have to query to get its URI to get its parameters
237237 if ( _this.getMediaType() == 'template' && !_this.resource.tVars ) {
238 - $j( '#sub_cliplib_ic' ).loadingSpiner()
 238+ $j( '#sub_cliplib_ic' ).loadingSpinner()
239239 var request = {
240240 'action':'query',
241241 'prop':'revisions',
@@ -385,7 +385,7 @@
386386 'title' : _this.parentSequence.plObj.mTitle,
387387 'text' : template_wiki_text
388388 };
389 - $j( _this.resource.embed ).html( mw.loading_spiner() );
 389+ $j( _this.resource.embed ).html( mw.loading_spinner() );
390390
391391 var api_url = _this.parentSequence.plObj.interface_url;
392392 mw.getJSON( api_url, request, function( data ) {
Index: branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskinConfig.js
@@ -197,7 +197,7 @@
198198
199199 $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' +
200200 '<div class="credits_box ui-corner-all">' +
201 - mw.loading_spiner() +
 201+ mw.loading_spinner() +
202202 '</div>'
203203 );
204204
Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js
@@ -163,7 +163,7 @@
164164 * mw.addMessages function
165165 * Loads a set of json messages into the messegeCache object.
166166 *
167 - * @param json msgSet The set of msgs to be loaded
 167+ * @param {JSON} msgSet The set of msgs to be loaded
168168 */
169169 $.addMessages = function( msgSet ) {
170170 for ( var i in msgSet ) {
@@ -191,10 +191,10 @@
192192 * the user msg.
193193 *
194194 * @param {String} key The msg key as set by mw.addMessages
195 - * @param [mixed] args An array of replacement strings
 195+ * @param {Array} args An array of replacement strings
196196 * @return string
197197 */
198 - $.lang.gM = function( key , args ) {
 198+ $.getMsg = function( key , args ) {
199199
200200 // Check for missing message key
201201 if ( ! messageCache[ key ] )
@@ -208,10 +208,7 @@
209209 if ( ms.indexOf( '{{' ) === -1 && ms.indexOf( '[' ) === -1 ) {
210210 return ms;
211211 }
212 -
213 - // make sure we have the lagMagic setup:
214 - // @@todo move to init
215 - $.lang.magicSetup();
 212+
216213 // send the msg key through the parser
217214 var pObj = $.parser.pNew( ms );
218215 // return the transformed msg
@@ -365,12 +362,12 @@
366363 }
367364
368365 /**
369 - * gMsgLoadRemote loads remote msg strings
 366+ * getRemoteMsg loads remote msg strings
370367 *
371368 * @param mixed msgSet the set of msg to load remotely
372369 * @param function callback the callback to issue once string is ready
373370 */
374 - $.lang.gMsgLoadRemote = function( msgSet, callback ) {
 371+ $.getRemoteMsg = function( msgSet, callback ) {
375372 var ammessages = '';
376373 if ( typeof msgSet == 'object' ) {
377374 for ( var i in msgSet ) {
@@ -465,7 +462,7 @@
466463 /**
467464 * MediaWiki wikitext "Parser"
468465 *
469 - * This is not feature complete but we need a way to get at template properties
 466+ * Not feature complete but we need a way to get at template properties
470467 *
471468 *
472469 * @param {String} wikiText the wikitext to be parsed
@@ -488,9 +485,9 @@
489486 }
490487
491488 // Create a new parser Object
492 - $.parser.pNew = function( wikiText, opt ) {
493 - var parseObj = function( wikiText, opt ) {
494 - return this.init( wikiText, opt )
 489+ $.parser.pNew = function( wikiText, options ) {
 490+ var parseObj = function( wikiText, options ) {
 491+ return this.init( wikiText, options )
495492 }
496493 parseObj.prototype = {
497494 // the wikiText "DOM"... stores the parsed wikiText structure
@@ -763,6 +760,7 @@
764761 * Module loader function should accept a callback argument
765762 *
766763 * {String} Name of a class to loaded.
 764+ * Classes are added via addClassFilePaths function
767765 * Using defined class names avoids loading the same class
768766 * twice by first checking if the "class variable" is defined
769767 *
@@ -776,22 +774,21 @@
777775 * {Array} {Array} Can be a set of Arrays for loading.
778776 * Some browsers execute included scripts out of order.
779777 * This lets you chain sets of request for those browsers.
780 - * If using the script-loader order is preserved in output and
781 - * a single request will be used.
 778+ * If using the server side script-loader order is preserved
 779+ * in output and a single request will be used.
782780 *
783781 * @param {Function} callback Function called once loading is complete
784782 */
785783 load: function( loadRequest, callback ){
786784 // Check for empty loadRequest ( directly return the callback )
787785 if( $.isEmpty( loadRequest ) ){
788 - mw.log( 'Error: Empty load request ' );
 786+ mw.log( 'Error: Empty load request: ' + loadRequest);
789787 callback( loadRequest );
790788 }
791789
792790 // Check if its a multi-part request:
793791 if( typeof loadRequest == 'object' ){
794 - if( loadRequest.length > 1 ){
795 - mw.log("mw.load: LoadMany:: " + loadRequest );
 792+ if( loadRequest.length > 1 ){
796793 this.loadMany ( loadRequest, callback );
797794 return ;
798795 }else{
@@ -857,7 +854,9 @@
858855 loadStates[ loadName ] = 0;
859856 }
860857 }
861 -
 858+ // We are infact loading many:
 859+ mw.log("mw.load: LoadMany:: " + loadSet );
 860+
862861 // Issue the load request check check loadStates to see if we are "done"
863862 for( var loadName in loadStates ){
864863 //mw.log("loadMany: load: " + loadName );
@@ -1013,8 +1012,7 @@
10141013 callback( className );
10151014 callback = null;
10161015 } );
1017 - mw.log( 'done with running getScript request ' );
1018 -
 1016+ //mw.log( 'done with running getScript request ' );
10191017 },
10201018
10211019 /**
@@ -1029,7 +1027,7 @@
10301028 },
10311029
10321030 /**
1033 - * Adds file path key value pairs
 1031+ * Adds class file path key value pairs
10341032 *
10351033 * @param {Object} classSet JSON formated list of
10361034 * class name file path pairs.
@@ -1047,7 +1045,9 @@
10481046 * Add a style sheet to be loaded the same time as the requested class
10491047 *
10501048 * NOTE: In general style sheets should be loaded via a module loader function.
1051 - * In some cases a single class has a single sheet that can use this function
 1049+ * In some cases a single class has a single sheet dependency which can be set-up using this function
 1050+ *
 1051+ * @param {Object} sheetSet ClassKey : sheet location key value paris
10521052 */
10531053 addClassStyleSheets: function( sheetSet ){
10541054 for(var i in sheetSet ){
@@ -1105,8 +1105,8 @@
11061106 * Lets you assume a few options:
11071107 * url is optional
11081108 * ( If the first argument is not a string we assume a local mediaWiki api request )
1109 - * callback paramater is not needed we setup the callback automatically
1110 - * url param 'action'=>'query' is assumed ( if not set to something else in the "data" parma
 1109+ * callback parameter is not needed we setup the callback automatically
 1110+ * url param 'action'=>'query' is assumed ( if not set to something else in the "data" param
11111111 * format is set to "json" automatically
11121112 *
11131113 * @param {Mixed} url or data request
@@ -1234,7 +1234,7 @@
12351235 return true;
12361236 }
12371237 /**
1238 - * Waits for a object to be deinfed and the calls callback
 1238+ * Waits for a object to be defined and the calls callback
12391239 *
12401240 * @param {Object} objectName Name of object to be defined
12411241 * @param {Function} callback Function to call once object is defined
@@ -1243,7 +1243,7 @@
12441244 */
12451245 var waitTime = 1200; // About 30 seconds
12461246 $.waitForObject = function( objectName, callback, _callNumber){
1247 - mw.log( 'waitForObject: ' + objectName );
 1247+ //mw.log( 'waitForObject: ' + objectName );
12481248 if( !_callNumber )
12491249 _callNumber = 1;
12501250
@@ -1264,16 +1264,16 @@
12651265 /**
12661266 * Check if an object is empty or if its an empty string.
12671267 *
1268 - * @param {Object} ob Object to be checked
 1268+ * @param {Object} object Object to be checked
12691269 */
1270 - $.isEmpty = function( ob ) {
1271 - if( typeof ob == 'string' ){
1272 - if( ob == '' ) return true;
 1270+ $.isEmpty = function( object ) {
 1271+ if( typeof object == 'string' ){
 1272+ if( object == '' ) return true;
12731273 // Non empty string:
12741274 return false;
12751275 }
12761276 // Else check as an object:
1277 - for(var i in ob){ return false; }
 1277+ for( var i in object ){ return false; }
12781278 return true;
12791279 }
12801280
@@ -1316,12 +1316,12 @@
13171317 }
13181318
13191319 /**
1320 - * Get a loading spiner html
1321 - * @param {String} [Optional] style Style string to apply to the spiner
 1320+ * Get a loading spinner html
 1321+ * @param {String} [Optional] style Style string to apply to the spinner
13221322 */
1323 - $.loading_spiner = function( style ) {
 1323+ $.loading_spinner = function( style ) {
13241324 var style_txt = ( style ) ? style:'';
1325 - return '<div class="loading_spiner" style="' + style_txt + '"></div>';
 1325+ return '<div class="loading_spinner" style="' + style_txt + '"></div>';
13261326 }
13271327
13281328
@@ -1335,6 +1335,9 @@
13361336 * Enables load hooks to run once DOM is "ready"
13371337 * Will ensure jQuery is available, is in the $j namespace
13381338 * and mw interfaces and configuration has been loaded and applied
 1339+ *
 1340+ * this is different from jQuery(document).ready()
 1341+ * ( jQuery ready is not friendly with dynamic includes and core interface asynchronous build out.)
13391342 *
13401343 * @param {Function} callback Function to run once DOM and jQuery are ready
13411344 */
@@ -1402,6 +1405,9 @@
14031406 cache: true
14041407 } );
14051408
 1409+ //Update the magic keywords
 1410+ $.lang.magicSetup();
 1411+
14061412 // Set up mvEmbed jQuery bindings
14071413 mwDojQueryBindings();
14081414
@@ -1592,7 +1598,10 @@
15931599 }
15941600
15951601 /**
1596 - * Get Api URL from mediaWiki output page defined variables
 1602+ * Get Api URL from mediaWiki page defined variables
 1603+ * @return {Mixed}
 1604+ * api url
 1605+ * false
15971606 */
15981607 $.getLocalApiUrl = function() {
15991608 if ( typeof wgServer != 'undefined' && typeof wgScriptPath != 'undefined' ) {
@@ -1939,7 +1948,7 @@
19401949 }
19411950
19421951 // Set gM shortcut:
1943 -var gM = mw.lang.gM;
 1952+var gM = mw.getMsg;
19441953
19451954 // Setup legacy global shortcuts:
19461955 var loadRS = mw.lang.loadRS;
@@ -2190,11 +2199,11 @@
21912200 ( function( $ ) {
21922201
21932202 /**
2194 - * Set a given selector html to the loading spiner:
 2203+ * Set a given selector html to the loading spinner:
21952204 */
2196 - $.fn.loadingSpiner = function() {
 2205+ $.fn.loadingSpinner = function() {
21972206 if ( this.selector ) {
2198 - $j( this.selector ).html( mw.loading_spiner() );
 2207+ $j( this.selector ).html( mw.loading_spinner() );
21992208 }
22002209 }
22012210
@@ -2511,7 +2520,7 @@
25122521 * @param msg text text of the loader msg
25132522 */
25142523 $.addLoaderDialog = function( msg_txt ) {
2515 - $.addDialog( msg_txt, msg_txt + '<br>' + mw.loading_spiner() );
 2524+ $.addDialog( msg_txt, msg_txt + '<br>' + mw.loading_spinner() );
25162525 }
25172526
25182527 /**
@@ -2572,6 +2581,8 @@
25732582
25742583 /**
25752584 * Utility functions that override globals
 2585+*
 2586+* Will be depreciated once we move all XML parsing to jQuery calls
25762587 */
25772588
25782589 if ( typeof DOMParser == "undefined" ) {
Index: branches/js2-work/phase3/js2/mwEmbed/jsScriptLoader.php
@@ -5,7 +5,8 @@
66 */
77
88
9 -//Setup the script local script cache directory (has to be hard coded rather than config based for fast non-mediawiki config hits
 9+//Setup the script local script cache directory
 10+// ( has to be hard coded rather than config based for fast non-mediawiki config hits )
1011 $wgScriptCacheDirectory = realpath( dirname( __FILE__ ) ) . '/php/script-cache';
1112
1213 // Check if we are being invoked in a MediaWiki context or stand alone usage:
@@ -44,7 +45,7 @@
4546 if ( $this->sFileCache->isFileCached() ) {
4647 // Just output headers so we can use PHP's @readfile::
4748 $this->outputJsHeaders();
48 - $this->sFileCache->outputFromFileCache();
 49+ $this->sFileCache->loadFromFileCache();
4950 return true;
5051 }
5152 return false;
@@ -233,7 +234,7 @@
234235 * true if client accepts gzip encoded response
235236 * false if client does not accept gzip encoded response
236237 */
237 - function clientAcceptsGzip() {
 238+ static function clientAcceptsGzip() {
238239 $m = array();
239240 if( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ){
240241 if( preg_match(
@@ -248,8 +249,9 @@
249250 }
250251 return false;
251252 }
252 - /*
253 - * postProcRequestVars uses globals, configuration and mediaWiki to test wiki-titles and files exist etc.
 253+
 254+ /**
 255+ * Post process request uses globals, configuration and mediaWiki to test wiki-titles and files exist etc.
254256 */
255257 function postProcRequestVars(){
256258 global $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses,
@@ -274,7 +276,7 @@
275277 //make sure its a valid lang code:
276278 $this->langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['uselang']);
277279 }else{
278 - //set english as default
 280+ //set English as default
279281 $this->langCode = 'en';
280282 }
281283 $this->langCode = self::checkForCommonsLanguageFormHack( $this->langCode );
@@ -326,7 +328,6 @@
327329 }
328330 }
329331
330 -
331332 // Add the language code to the rKey:
332333 $this->requestKey .= '_' . $wgContLanguageCode;
333334
@@ -487,8 +488,9 @@
488489 //return the js str unmodified if we did not transform with the localisation.
489490 return $str;
490491 }
 492+
491493 /**
492 - * Get the addMesseges index ( for replacing msg text with localized json )
 494+ * Get the "addMesseges" function index ( for replacing msg text with localized json )
493495 *
494496 * @param {String} $str Javascript string to grab msg text from
495497 * @return {Array} Array with start and end points character indexes
@@ -564,6 +566,7 @@
565567
566568 return FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true);
567569 }
 570+
568571 /**
569572 * Updates an array of messages with the wfMsgGetKey value
570573 *
@@ -581,6 +584,7 @@
582585 $jmsg[ $msgKey ] = wfMsgGetKey( $msgKey, true, $langCode, false );
583586 }
584587 }
 588+
585589 /**
586590 * Replace a string of json msgs with the translated json msgs.
587591 *
@@ -630,9 +634,10 @@
631635 }
632636
633637 /**
634 - * get Cache file file Name based on $requestKey and if gzip is enabled or not
 638+ * Get cache file file Name based on $requestKey and if gzip is enabled or not
 639+ * Updates the local filename var
635640 *
636 - * @return unknown
 641+ * @return {String} file path
637642 */
638643 public function getCacheFileName() {
639644 global $wgUseGzip, $wgScriptCacheDirectory;
@@ -649,22 +654,29 @@
650655 if( is_file( $this->filename ) )
651656 return $this->filename;
652657
 658+ // Check for non-config based gzip version already there?
653659 if( is_file( $this->filename . '.gz') ){
654660 $this->filename .= '.gz';
655661 return $this->filename;
656662 }
657 - //check the update the name based on the $wgUseGzip config var
 663+ //Update the name based on the $wgUseGzip config var
658664 if ( isset($wgUseGzip) && $wgUseGzip )
659665 $this->filename.='.gz';
660666
 667+ return $this->filename;
661668 }
662 -
 669+ /**
 670+ * Checks if file is cached
 671+ */
663672 public function isFileCached() {
664673 return file_exists( $this->filename );
665674 }
666675
667 - public function outputFromFileCache() {
668 - if ( $this->clientAcceptsGzip() && substr( $this->filename, -3 ) == '.gz' ) {
 676+ /**
 677+ * Loads and outputs the file from file cache
 678+ */
 679+ public function loadFromFileCache() {
 680+ if ( jsScriptLoader::clientAcceptsGzip() && substr( $this->filename, -3 ) == '.gz' ) {
669681 header( 'Content-Encoding: gzip' );
670682 readfile( $this->filename );
671683 return true;
@@ -677,19 +689,10 @@
678690 }
679691 return true;
680692 }
681 - public function clientAcceptsGzip(){
682 - $m = array();
683 - if ( preg_match(
684 - '/\bgzip(?:;(q)=([0-9]+(?:\.[0-9]+)))?\b/',
685 - $_SERVER['HTTP_ACCEPT_ENCODING'],
686 - $m ) ) {
687 - if ( isset( $m[2] ) && ( $m[1] == 'q' ) && ( $m[2] == 0 ) )
688 - return false;
689 -
690 - return true;
691 - }
692 - return false;
693 - }
 693+ /**
 694+ * Saves text string to file
 695+ * @param unknown_type $text
 696+ */
694697 public function saveToFileCache( &$text ) {
695698 global $wgUseFileCache, $wgUseGzip;
696699 if ( !$wgUseFileCache ) {
@@ -718,7 +721,9 @@
719722 }
720723 return true;
721724 }
722 -
 725+ /**
 726+ * Checks cache directories and makes the dirs if not present
 727+ */
723728 protected function checkCacheDirs() {
724729 $mydir2 = substr( $this->filename, 0, strrpos( $this->filename, '/' ) ); # subdirectory level 2
725730 $mydir1 = substr( $mydir2, 0, strrpos( $mydir2, '/' ) ); # subdirectory level 1
Index: branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js
@@ -352,7 +352,7 @@
353353 'right:0px;bottom:0px;' +
354354 'height:' + ( this.pe.height) +
355355 'px;overflow:auto;"><span style="display:none;" id="mv_txt_load_' + this.pe.id + '">' +
356 - mw.loading_spiner() + '</span>' +
 356+ mw.loading_spinner() + '</span>' +
357357 '</div>';
358358 },
359359 getTsSelect:function() {

Status & tagging log