Index: branches/js2-work/phase3/js2/mwEmbed/example_usage/Player_Timed_Text.html |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | Metavid based ROE file using CMML<br> <pre><video roe="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" ></video></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> |
19 | 19 | |
20 | 20 | </tr> |
21 | | - <tr> |
| 21 | + <!-- <tr> |
22 | 22 | <td valign="top" width="410"> |
23 | 23 | <video poster="http://ia340929.us.archive.org/0/items/princess_iron_fan/princess_iron_fan.thumbs/princess_iron_fan_000360.jpg" |
24 | 24 | duration="1:13:0" linkback="http://www.archive.org/details/princess_iron_fan" > |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | </text> |
55 | 55 | </video> |
56 | 56 | </textarea> </td> |
57 | | - </tr> |
| 57 | + </tr> --> |
58 | 58 | </table> |
59 | 59 | |
60 | 60 | </body> |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -804,7 +804,7 @@ |
805 | 805 | mw.log( "showUploadTab::" ); |
806 | 806 | var _this = this; |
807 | 807 | // set it to loading: |
808 | | - $j( '#tab-upload' ).loadingSpiner(); |
| 808 | + $j( '#tab-upload' ).loadingSpinner(); |
809 | 809 | // Do things async to keep interface snappy |
810 | 810 | setTimeout( |
811 | 811 | function() { |
— | — | @@ -859,13 +859,13 @@ |
860 | 860 | '<td valign="top" style="width:350px; padding-right: 12px;">' + |
861 | 861 | '<h4>' + uploadMsg + '</h4>' + |
862 | 862 | '<div id="upload_form">' + |
863 | | - mw.loading_spiner() + |
| 863 | + mw.loading_spinner() + |
864 | 864 | '</div>' + |
865 | 865 | '</td>' + |
866 | 866 | '<td valign="top" id="upload_bin_cnt">' + |
867 | 867 | '<h4>' + recentUploadsMsg + '</h4>' + |
868 | 868 | '<div id="upload_bin">' + |
869 | | - mw.loading_spiner() + |
| 869 | + mw.loading_spinner() + |
870 | 870 | '</div>' + |
871 | 871 | '</td>' + |
872 | 872 | '</tr>' + |
— | — | @@ -951,7 +951,7 @@ |
952 | 952 | } |
953 | 953 | |
954 | 954 | // 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() ); |
956 | 956 | |
957 | 957 | // Make sure the search library is loaded and issue the search request |
958 | 958 | this.getLibSearchResults( provider ); |
— | — | @@ -1443,7 +1443,7 @@ |
1444 | 1444 | 'style="position:absolute;' + overflowStyle + ';' + |
1445 | 1445 | 'left:' + ( maxWidth + 20 ) + 'px;right:0px;top:5px;bottom:10px;' + |
1446 | 1446 | 'padding:5px;" >' + |
1447 | | - mw.loading_spiner( 'position:absolute;top:30px;left:30px' ) + |
| 1447 | + mw.loading_spinner( 'position:absolute;top:30px;left:30px' ) + |
1448 | 1448 | '</div>' + |
1449 | 1449 | '</div>' ); |
1450 | 1450 | }, |
— | — | @@ -1944,7 +1944,7 @@ |
1945 | 1945 | '<br style="clear both"/>' + |
1946 | 1946 | '<strong>' + gM( 'mwe-resource_page_desc' ) + '</strong>' + |
1947 | 1947 | '<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' ) + |
1949 | 1949 | '</div>' + |
1950 | 1950 | '</div>' + |
1951 | 1951 | '<div id="rds_edit_import_container" ' + |
— | — | @@ -1997,7 +1997,7 @@ |
1998 | 1998 | .btnBind() |
1999 | 1999 | .click( function() { |
2000 | 2000 | mw.log( " Do preview asset update" ); |
2001 | | - $j( '#rsd_import_desc' ).html( mw.loading_spiner() ); |
| 2001 | + $j( '#rsd_import_desc' ).html( mw.loading_spinner() ); |
2002 | 2002 | // load the preview text: |
2003 | 2003 | _this.parse( |
2004 | 2004 | $j( '#rsd_import_ta' ).val(), |
— | — | @@ -2198,7 +2198,7 @@ |
2199 | 2199 | '<div id="rsd_preview_display"' + |
2200 | 2200 | 'style="position:absolute;overflow:hidden;z-index:4;' + |
2201 | 2201 | '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' ) + |
2203 | 2203 | '</div>' ); |
2204 | 2204 | |
2205 | 2205 | var buttonPaneSelector = _this.target_container + '~ .ui-dialog-buttonpane'; |
Index: branches/js2-work/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js |
— | — | @@ -377,7 +377,7 @@ |
378 | 378 | |
379 | 379 | // Set the HTTP box to "loading", in case we don't get an update for some time |
380 | 380 | $j( '#dlbox-centered' ).html( '<h5>' + _this.getProgressTitle() + '</h5>' + |
381 | | - mw.loading_spiner( 'left:40%;top:20%' ) |
| 381 | + mw.loading_spinner( 'left:40%;top:20%' ) |
382 | 382 | ); |
383 | 383 | |
384 | 384 | // Set up the request |
— | — | @@ -568,7 +568,7 @@ |
569 | 569 | error_msg = apiRes.error; |
570 | 570 | |
571 | 571 | // 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. |
573 | 573 | // |
574 | 574 | // This code is similar to the error handling code formerly in |
575 | 575 | // SpecialUpload::processUpload() |
— | — | @@ -600,7 +600,7 @@ |
601 | 601 | if ( apiRes.upload.error == 'internal-error' ) { |
602 | 602 | // Do a remote message load |
603 | 603 | errorKey = apiRes.upload.details[0]; |
604 | | - gMsgLoadRemote( errorKey, function() { |
| 604 | + mw.getRemoteMsg( errorKey, function() { |
605 | 605 | _this.updateProgressWin( gM( 'mwe-uploaderror' ), gM( errorKey ), buttons ); |
606 | 606 | |
607 | 607 | }); |
— | — | @@ -637,7 +637,7 @@ |
638 | 638 | } |
639 | 639 | |
640 | 640 | 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() { |
642 | 642 | _this.updateProgressWin( |
643 | 643 | gM( 'mwe-uploaderror' ), |
644 | 644 | gM( error_msg_key[ error_code ], errorReplaceArg ), |
— | — | @@ -693,7 +693,7 @@ |
694 | 694 | //check if we have a stashed key: |
695 | 695 | if ( _this.warnings_sessionkey ) { |
696 | 696 | //set to "loading" |
697 | | - $j( '#upProgressDialog' ).html( mw.loading_spiner() ); |
| 697 | + $j( '#upProgressDialog' ).html( mw.loading_spinner() ); |
698 | 698 | //setup loading: |
699 | 699 | var request = { |
700 | 700 | 'action': 'upload', |
— | — | @@ -797,7 +797,7 @@ |
798 | 798 | title_txt = _this.getProgressTitle(); |
799 | 799 | |
800 | 800 | if ( !msg ) |
801 | | - msg = mw.loading_spiner( 'left:40%;top:40px;' ); |
| 801 | + msg = mw.loading_spinner( 'left:40%;top:40px;' ); |
802 | 802 | |
803 | 803 | if ( !buttons ) { |
804 | 804 | // If no buttons are specified, add a close button |
Index: branches/js2-work/phase3/js2/mwEmbed/libEmbedPlayer/embedPlayer.js |
— | — | @@ -416,7 +416,7 @@ |
417 | 417 | 'width' : playerInterface.width, |
418 | 418 | 'height' : playerInterface.height |
419 | 419 | } ) |
420 | | - .html( mw.loading_spiner() ); |
| 420 | + .html( mw.loading_spinner() ); |
421 | 421 | |
422 | 422 | // Apply the Player interface to the DOM element |
423 | 423 | for ( var method in playerInterface ) { // for in loop oky in Element context |
— | — | @@ -1047,15 +1047,9 @@ |
1048 | 1048 | addROE: function( roe_data ) { |
1049 | 1049 | mw.log( 'f:addROE' ); |
1050 | 1050 | 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; |
1058 | 1052 | if ( roe_data ) { |
1059 | | - $j.each( roe_data.getElementsByTagName( 'mediaSource' ), function( inx, source ) { |
| 1053 | + $j( roe_data ).find("mediaSource").each( function( inx, source ) { |
1060 | 1054 | _this.tryAddSource( source ); |
1061 | 1055 | } ); |
1062 | 1056 | // set the thumbnail: |
— | — | @@ -2240,7 +2234,7 @@ |
2241 | 2235 | 'height:' + theight + 'px;width:400px;' + |
2242 | 2236 | 'display:none;" ' + |
2243 | 2237 | 'id="metaBox_' + this.id + '">' + |
2244 | | - mw.loading_spiner() + |
| 2238 | + mw.loading_spinner() + |
2245 | 2239 | '</div>' ); |
2246 | 2240 | } |
2247 | 2241 | // check if textObj present: |
Index: branches/js2-work/phase3/js2/mwEmbed/libSequencer/mvSequencer.js |
— | — | @@ -777,7 +777,7 @@ |
778 | 778 | mw.log( "sequence:doEditTransition" ); |
779 | 779 | var _this = this; |
780 | 780 | // Add a loading image |
781 | | - mw.loading_spiner( '#transitions_ic' ); |
| 781 | + mw.loading_spinner( '#transitions_ic' ); |
782 | 782 | mw.load( [ |
783 | 783 | '$j.fn.ColorPicker', |
784 | 784 | 'mvTimedEffectsEdit' |
— | — | @@ -799,7 +799,7 @@ |
800 | 800 | mw.log( 'seq:doEditClip' ); |
801 | 801 | var _this = this; |
802 | 802 | |
803 | | - mw.loading_spiner( '#clipedit_ic' ); |
| 803 | + mw.loading_spinner( '#clipedit_ic' ); |
804 | 804 | |
805 | 805 | // Load the clipEdit library if not already loaded: |
806 | 806 | mw.load( [ |
Index: branches/js2-work/phase3/js2/mwEmbed/tests/testApiProxy.html |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | }); |
31 | 31 | function doHello(){ |
32 | 32 | mw.log('to a hello user'); |
33 | | - $j('#helloTarget').html( mw.loading_spiner() ); |
| 33 | + $j('#helloTarget').html( mw.loading_spinner() ); |
34 | 34 | //first get the user name: |
35 | 35 | getUserName(function( user_name ){ |
36 | 36 | $j('#helloTarget').hide().text( user_name ).fadeIn('slow'); |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | |
58 | 58 | //simple "hello from api proxy" append on talk page |
59 | 59 | function doAppend(){ |
60 | | - $j('#appendTarget').html( mw.loading_spiner() ); |
| 60 | + $j('#appendTarget').html( mw.loading_spinner() ); |
61 | 61 | //get user name |
62 | 62 | getUserName(function(userName){ |
63 | 63 | var eTitle = 'User_talk:' + userName; |
Index: branches/js2-work/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js |
— | — | @@ -234,7 +234,7 @@ |
235 | 235 | 'doEdit':function( _this, target ) { |
236 | 236 | // if media type is template we have to query to get its URI to get its parameters |
237 | 237 | if ( _this.getMediaType() == 'template' && !_this.resource.tVars ) { |
238 | | - $j( '#sub_cliplib_ic' ).loadingSpiner() |
| 238 | + $j( '#sub_cliplib_ic' ).loadingSpinner() |
239 | 239 | var request = { |
240 | 240 | 'action':'query', |
241 | 241 | 'prop':'revisions', |
— | — | @@ -385,7 +385,7 @@ |
386 | 386 | 'title' : _this.parentSequence.plObj.mTitle, |
387 | 387 | 'text' : template_wiki_text |
388 | 388 | }; |
389 | | - $j( _this.resource.embed ).html( mw.loading_spiner() ); |
| 389 | + $j( _this.resource.embed ).html( mw.loading_spinner() ); |
390 | 390 | |
391 | 391 | var api_url = _this.parentSequence.plObj.interface_url; |
392 | 392 | mw.getJSON( api_url, request, function( data ) { |
Index: branches/js2-work/phase3/js2/mwEmbed/skins/kskin/kskinConfig.js |
— | — | @@ -197,7 +197,7 @@ |
198 | 198 | |
199 | 199 | $target.html( '<h2>' + gM( 'mwe-credits' ) + '</h2>' + |
200 | 200 | '<div class="credits_box ui-corner-all">' + |
201 | | - mw.loading_spiner() + |
| 201 | + mw.loading_spinner() + |
202 | 202 | '</div>' |
203 | 203 | ); |
204 | 204 | |
Index: branches/js2-work/phase3/js2/mwEmbed/mwEmbed.js |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | * mw.addMessages function |
165 | 165 | * Loads a set of json messages into the messegeCache object. |
166 | 166 | * |
167 | | - * @param json msgSet The set of msgs to be loaded |
| 167 | + * @param {JSON} msgSet The set of msgs to be loaded |
168 | 168 | */ |
169 | 169 | $.addMessages = function( msgSet ) { |
170 | 170 | for ( var i in msgSet ) { |
— | — | @@ -191,10 +191,10 @@ |
192 | 192 | * the user msg. |
193 | 193 | * |
194 | 194 | * @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 |
196 | 196 | * @return string |
197 | 197 | */ |
198 | | - $.lang.gM = function( key , args ) { |
| 198 | + $.getMsg = function( key , args ) { |
199 | 199 | |
200 | 200 | // Check for missing message key |
201 | 201 | if ( ! messageCache[ key ] ) |
— | — | @@ -208,10 +208,7 @@ |
209 | 209 | if ( ms.indexOf( '{{' ) === -1 && ms.indexOf( '[' ) === -1 ) { |
210 | 210 | return ms; |
211 | 211 | } |
212 | | - |
213 | | - // make sure we have the lagMagic setup: |
214 | | - // @@todo move to init |
215 | | - $.lang.magicSetup(); |
| 212 | + |
216 | 213 | // send the msg key through the parser |
217 | 214 | var pObj = $.parser.pNew( ms ); |
218 | 215 | // return the transformed msg |
— | — | @@ -365,12 +362,12 @@ |
366 | 363 | } |
367 | 364 | |
368 | 365 | /** |
369 | | - * gMsgLoadRemote loads remote msg strings |
| 366 | + * getRemoteMsg loads remote msg strings |
370 | 367 | * |
371 | 368 | * @param mixed msgSet the set of msg to load remotely |
372 | 369 | * @param function callback the callback to issue once string is ready |
373 | 370 | */ |
374 | | - $.lang.gMsgLoadRemote = function( msgSet, callback ) { |
| 371 | + $.getRemoteMsg = function( msgSet, callback ) { |
375 | 372 | var ammessages = ''; |
376 | 373 | if ( typeof msgSet == 'object' ) { |
377 | 374 | for ( var i in msgSet ) { |
— | — | @@ -465,7 +462,7 @@ |
466 | 463 | /** |
467 | 464 | * MediaWiki wikitext "Parser" |
468 | 465 | * |
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 |
470 | 467 | * |
471 | 468 | * |
472 | 469 | * @param {String} wikiText the wikitext to be parsed |
— | — | @@ -488,9 +485,9 @@ |
489 | 486 | } |
490 | 487 | |
491 | 488 | // 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 ) |
495 | 492 | } |
496 | 493 | parseObj.prototype = { |
497 | 494 | // the wikiText "DOM"... stores the parsed wikiText structure |
— | — | @@ -763,6 +760,7 @@ |
764 | 761 | * Module loader function should accept a callback argument |
765 | 762 | * |
766 | 763 | * {String} Name of a class to loaded. |
| 764 | + * Classes are added via addClassFilePaths function |
767 | 765 | * Using defined class names avoids loading the same class |
768 | 766 | * twice by first checking if the "class variable" is defined |
769 | 767 | * |
— | — | @@ -776,22 +774,21 @@ |
777 | 775 | * {Array} {Array} Can be a set of Arrays for loading. |
778 | 776 | * Some browsers execute included scripts out of order. |
779 | 777 | * 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. |
782 | 780 | * |
783 | 781 | * @param {Function} callback Function called once loading is complete |
784 | 782 | */ |
785 | 783 | load: function( loadRequest, callback ){ |
786 | 784 | // Check for empty loadRequest ( directly return the callback ) |
787 | 785 | if( $.isEmpty( loadRequest ) ){ |
788 | | - mw.log( 'Error: Empty load request ' ); |
| 786 | + mw.log( 'Error: Empty load request: ' + loadRequest); |
789 | 787 | callback( loadRequest ); |
790 | 788 | } |
791 | 789 | |
792 | 790 | // Check if its a multi-part request: |
793 | 791 | if( typeof loadRequest == 'object' ){ |
794 | | - if( loadRequest.length > 1 ){ |
795 | | - mw.log("mw.load: LoadMany:: " + loadRequest ); |
| 792 | + if( loadRequest.length > 1 ){ |
796 | 793 | this.loadMany ( loadRequest, callback ); |
797 | 794 | return ; |
798 | 795 | }else{ |
— | — | @@ -857,7 +854,9 @@ |
858 | 855 | loadStates[ loadName ] = 0; |
859 | 856 | } |
860 | 857 | } |
861 | | - |
| 858 | + // We are infact loading many: |
| 859 | + mw.log("mw.load: LoadMany:: " + loadSet ); |
| 860 | + |
862 | 861 | // Issue the load request check check loadStates to see if we are "done" |
863 | 862 | for( var loadName in loadStates ){ |
864 | 863 | //mw.log("loadMany: load: " + loadName ); |
— | — | @@ -1013,8 +1012,7 @@ |
1014 | 1013 | callback( className ); |
1015 | 1014 | callback = null; |
1016 | 1015 | } ); |
1017 | | - mw.log( 'done with running getScript request ' ); |
1018 | | - |
| 1016 | + //mw.log( 'done with running getScript request ' ); |
1019 | 1017 | }, |
1020 | 1018 | |
1021 | 1019 | /** |
— | — | @@ -1029,7 +1027,7 @@ |
1030 | 1028 | }, |
1031 | 1029 | |
1032 | 1030 | /** |
1033 | | - * Adds file path key value pairs |
| 1031 | + * Adds class file path key value pairs |
1034 | 1032 | * |
1035 | 1033 | * @param {Object} classSet JSON formated list of |
1036 | 1034 | * class name file path pairs. |
— | — | @@ -1047,7 +1045,9 @@ |
1048 | 1046 | * Add a style sheet to be loaded the same time as the requested class |
1049 | 1047 | * |
1050 | 1048 | * 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 |
1052 | 1052 | */ |
1053 | 1053 | addClassStyleSheets: function( sheetSet ){ |
1054 | 1054 | for(var i in sheetSet ){ |
— | — | @@ -1105,8 +1105,8 @@ |
1106 | 1106 | * Lets you assume a few options: |
1107 | 1107 | * url is optional |
1108 | 1108 | * ( 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 |
1111 | 1111 | * format is set to "json" automatically |
1112 | 1112 | * |
1113 | 1113 | * @param {Mixed} url or data request |
— | — | @@ -1234,7 +1234,7 @@ |
1235 | 1235 | return true; |
1236 | 1236 | } |
1237 | 1237 | /** |
1238 | | - * Waits for a object to be deinfed and the calls callback |
| 1238 | + * Waits for a object to be defined and the calls callback |
1239 | 1239 | * |
1240 | 1240 | * @param {Object} objectName Name of object to be defined |
1241 | 1241 | * @param {Function} callback Function to call once object is defined |
— | — | @@ -1243,7 +1243,7 @@ |
1244 | 1244 | */ |
1245 | 1245 | var waitTime = 1200; // About 30 seconds |
1246 | 1246 | $.waitForObject = function( objectName, callback, _callNumber){ |
1247 | | - mw.log( 'waitForObject: ' + objectName ); |
| 1247 | + //mw.log( 'waitForObject: ' + objectName ); |
1248 | 1248 | if( !_callNumber ) |
1249 | 1249 | _callNumber = 1; |
1250 | 1250 | |
— | — | @@ -1264,16 +1264,16 @@ |
1265 | 1265 | /** |
1266 | 1266 | * Check if an object is empty or if its an empty string. |
1267 | 1267 | * |
1268 | | - * @param {Object} ob Object to be checked |
| 1268 | + * @param {Object} object Object to be checked |
1269 | 1269 | */ |
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; |
1273 | 1273 | // Non empty string: |
1274 | 1274 | return false; |
1275 | 1275 | } |
1276 | 1276 | // Else check as an object: |
1277 | | - for(var i in ob){ return false; } |
| 1277 | + for( var i in object ){ return false; } |
1278 | 1278 | return true; |
1279 | 1279 | } |
1280 | 1280 | |
— | — | @@ -1316,12 +1316,12 @@ |
1317 | 1317 | } |
1318 | 1318 | |
1319 | 1319 | /** |
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 |
1322 | 1322 | */ |
1323 | | - $.loading_spiner = function( style ) { |
| 1323 | + $.loading_spinner = function( style ) { |
1324 | 1324 | 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>'; |
1326 | 1326 | } |
1327 | 1327 | |
1328 | 1328 | |
— | — | @@ -1335,6 +1335,9 @@ |
1336 | 1336 | * Enables load hooks to run once DOM is "ready" |
1337 | 1337 | * Will ensure jQuery is available, is in the $j namespace |
1338 | 1338 | * 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.) |
1339 | 1342 | * |
1340 | 1343 | * @param {Function} callback Function to run once DOM and jQuery are ready |
1341 | 1344 | */ |
— | — | @@ -1402,6 +1405,9 @@ |
1403 | 1406 | cache: true |
1404 | 1407 | } ); |
1405 | 1408 | |
| 1409 | + //Update the magic keywords |
| 1410 | + $.lang.magicSetup(); |
| 1411 | + |
1406 | 1412 | // Set up mvEmbed jQuery bindings |
1407 | 1413 | mwDojQueryBindings(); |
1408 | 1414 | |
— | — | @@ -1592,7 +1598,10 @@ |
1593 | 1599 | } |
1594 | 1600 | |
1595 | 1601 | /** |
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 |
1597 | 1606 | */ |
1598 | 1607 | $.getLocalApiUrl = function() { |
1599 | 1608 | if ( typeof wgServer != 'undefined' && typeof wgScriptPath != 'undefined' ) { |
— | — | @@ -1939,7 +1948,7 @@ |
1940 | 1949 | } |
1941 | 1950 | |
1942 | 1951 | // Set gM shortcut: |
1943 | | -var gM = mw.lang.gM; |
| 1952 | +var gM = mw.getMsg; |
1944 | 1953 | |
1945 | 1954 | // Setup legacy global shortcuts: |
1946 | 1955 | var loadRS = mw.lang.loadRS; |
— | — | @@ -2190,11 +2199,11 @@ |
2191 | 2200 | ( function( $ ) { |
2192 | 2201 | |
2193 | 2202 | /** |
2194 | | - * Set a given selector html to the loading spiner: |
| 2203 | + * Set a given selector html to the loading spinner: |
2195 | 2204 | */ |
2196 | | - $.fn.loadingSpiner = function() { |
| 2205 | + $.fn.loadingSpinner = function() { |
2197 | 2206 | if ( this.selector ) { |
2198 | | - $j( this.selector ).html( mw.loading_spiner() ); |
| 2207 | + $j( this.selector ).html( mw.loading_spinner() ); |
2199 | 2208 | } |
2200 | 2209 | } |
2201 | 2210 | |
— | — | @@ -2511,7 +2520,7 @@ |
2512 | 2521 | * @param msg text text of the loader msg |
2513 | 2522 | */ |
2514 | 2523 | $.addLoaderDialog = function( msg_txt ) { |
2515 | | - $.addDialog( msg_txt, msg_txt + '<br>' + mw.loading_spiner() ); |
| 2524 | + $.addDialog( msg_txt, msg_txt + '<br>' + mw.loading_spinner() ); |
2516 | 2525 | } |
2517 | 2526 | |
2518 | 2527 | /** |
— | — | @@ -2572,6 +2581,8 @@ |
2573 | 2582 | |
2574 | 2583 | /** |
2575 | 2584 | * Utility functions that override globals |
| 2585 | +* |
| 2586 | +* Will be depreciated once we move all XML parsing to jQuery calls |
2576 | 2587 | */ |
2577 | 2588 | |
2578 | 2589 | if ( typeof DOMParser == "undefined" ) { |
Index: branches/js2-work/phase3/js2/mwEmbed/jsScriptLoader.php |
— | — | @@ -5,7 +5,8 @@ |
6 | 6 | */ |
7 | 7 | |
8 | 8 | |
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 ) |
10 | 11 | $wgScriptCacheDirectory = realpath( dirname( __FILE__ ) ) . '/php/script-cache'; |
11 | 12 | |
12 | 13 | // Check if we are being invoked in a MediaWiki context or stand alone usage: |
— | — | @@ -44,7 +45,7 @@ |
45 | 46 | if ( $this->sFileCache->isFileCached() ) { |
46 | 47 | // Just output headers so we can use PHP's @readfile:: |
47 | 48 | $this->outputJsHeaders(); |
48 | | - $this->sFileCache->outputFromFileCache(); |
| 49 | + $this->sFileCache->loadFromFileCache(); |
49 | 50 | return true; |
50 | 51 | } |
51 | 52 | return false; |
— | — | @@ -233,7 +234,7 @@ |
234 | 235 | * true if client accepts gzip encoded response |
235 | 236 | * false if client does not accept gzip encoded response |
236 | 237 | */ |
237 | | - function clientAcceptsGzip() { |
| 238 | + static function clientAcceptsGzip() { |
238 | 239 | $m = array(); |
239 | 240 | if( isset( $_SERVER['HTTP_ACCEPT_ENCODING'] ) ){ |
240 | 241 | if( preg_match( |
— | — | @@ -248,8 +249,9 @@ |
249 | 250 | } |
250 | 251 | return false; |
251 | 252 | } |
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. |
254 | 256 | */ |
255 | 257 | function postProcRequestVars(){ |
256 | 258 | global $wgContLanguageCode, $wgEnableScriptMinify, $wgJSAutoloadClasses, |
— | — | @@ -274,7 +276,7 @@ |
275 | 277 | //make sure its a valid lang code: |
276 | 278 | $this->langCode = preg_replace( "/[^A-Za-z]/", '', $_GET['uselang']); |
277 | 279 | }else{ |
278 | | - //set english as default |
| 280 | + //set English as default |
279 | 281 | $this->langCode = 'en'; |
280 | 282 | } |
281 | 283 | $this->langCode = self::checkForCommonsLanguageFormHack( $this->langCode ); |
— | — | @@ -326,7 +328,6 @@ |
327 | 329 | } |
328 | 330 | } |
329 | 331 | |
330 | | - |
331 | 332 | // Add the language code to the rKey: |
332 | 333 | $this->requestKey .= '_' . $wgContLanguageCode; |
333 | 334 | |
— | — | @@ -487,8 +488,9 @@ |
488 | 489 | //return the js str unmodified if we did not transform with the localisation. |
489 | 490 | return $str; |
490 | 491 | } |
| 492 | + |
491 | 493 | /** |
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 ) |
493 | 495 | * |
494 | 496 | * @param {String} $str Javascript string to grab msg text from |
495 | 497 | * @return {Array} Array with start and end points character indexes |
— | — | @@ -564,6 +566,7 @@ |
565 | 567 | |
566 | 568 | return FormatJson::decode( '{' . substr($str, $inx['s'], ($inx['e']-$inx['s'])) . '}', true); |
567 | 569 | } |
| 570 | + |
568 | 571 | /** |
569 | 572 | * Updates an array of messages with the wfMsgGetKey value |
570 | 573 | * |
— | — | @@ -581,6 +584,7 @@ |
582 | 585 | $jmsg[ $msgKey ] = wfMsgGetKey( $msgKey, true, $langCode, false ); |
583 | 586 | } |
584 | 587 | } |
| 588 | + |
585 | 589 | /** |
586 | 590 | * Replace a string of json msgs with the translated json msgs. |
587 | 591 | * |
— | — | @@ -630,9 +634,10 @@ |
631 | 635 | } |
632 | 636 | |
633 | 637 | /** |
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 |
635 | 640 | * |
636 | | - * @return unknown |
| 641 | + * @return {String} file path |
637 | 642 | */ |
638 | 643 | public function getCacheFileName() { |
639 | 644 | global $wgUseGzip, $wgScriptCacheDirectory; |
— | — | @@ -649,22 +654,29 @@ |
650 | 655 | if( is_file( $this->filename ) ) |
651 | 656 | return $this->filename; |
652 | 657 | |
| 658 | + // Check for non-config based gzip version already there? |
653 | 659 | if( is_file( $this->filename . '.gz') ){ |
654 | 660 | $this->filename .= '.gz'; |
655 | 661 | return $this->filename; |
656 | 662 | } |
657 | | - //check the update the name based on the $wgUseGzip config var |
| 663 | + //Update the name based on the $wgUseGzip config var |
658 | 664 | if ( isset($wgUseGzip) && $wgUseGzip ) |
659 | 665 | $this->filename.='.gz'; |
660 | 666 | |
| 667 | + return $this->filename; |
661 | 668 | } |
662 | | - |
| 669 | + /** |
| 670 | + * Checks if file is cached |
| 671 | + */ |
663 | 672 | public function isFileCached() { |
664 | 673 | return file_exists( $this->filename ); |
665 | 674 | } |
666 | 675 | |
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' ) { |
669 | 681 | header( 'Content-Encoding: gzip' ); |
670 | 682 | readfile( $this->filename ); |
671 | 683 | return true; |
— | — | @@ -677,19 +689,10 @@ |
678 | 690 | } |
679 | 691 | return true; |
680 | 692 | } |
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 | + */ |
694 | 697 | public function saveToFileCache( &$text ) { |
695 | 698 | global $wgUseFileCache, $wgUseGzip; |
696 | 699 | if ( !$wgUseFileCache ) { |
— | — | @@ -718,7 +721,9 @@ |
719 | 722 | } |
720 | 723 | return true; |
721 | 724 | } |
722 | | - |
| 725 | + /** |
| 726 | + * Checks cache directories and makes the dirs if not present |
| 727 | + */ |
723 | 728 | protected function checkCacheDirs() { |
724 | 729 | $mydir2 = substr( $this->filename, 0, strrpos( $this->filename, '/' ) ); # subdirectory level 2 |
725 | 730 | $mydir1 = substr( $mydir2, 0, strrpos( $mydir2, '/' ) ); # subdirectory level 1 |
Index: branches/js2-work/phase3/js2/mwEmbed/libTimedText/mvTextInterface.js |
— | — | @@ -352,7 +352,7 @@ |
353 | 353 | 'right:0px;bottom:0px;' + |
354 | 354 | 'height:' + ( this.pe.height) + |
355 | 355 | 'px;overflow:auto;"><span style="display:none;" id="mv_txt_load_' + this.pe.id + '">' + |
356 | | - mw.loading_spiner() + '</span>' + |
| 356 | + mw.loading_spinner() + '</span>' + |
357 | 357 | '</div>'; |
358 | 358 | }, |
359 | 359 | getTsSelect:function() { |