r74206 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74205‎ | r74206 | r74207 >
Date:14:43, 3 October 2010
Author:dale
Status:deferred
Tags:
Comment:
bug 25369 added & and ? checks for diff to avoid page rewrite when non-view page is displayed
Modified paths:
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -49,7 +49,7 @@
5050 if( !mw.ready){
5151 mw.ready = function( fn ){
5252 preMwEmbedReady.push( fn );
53 - }
 53+ };
5454 }
5555 // Setup a preMwEmbedConfig var
5656 if( ! preMwEmbedConfig ) {
@@ -65,7 +65,7 @@
6666 preMwEmbedConfig[ i ] = set[i];
6767 }
6868 }
69 - }
 69+ };
7070 }
7171
7272
@@ -103,6 +103,7 @@
104104 // Add media wizard ( only if not on a sequence page
105105 if ( wgAction == 'edit' || wgAction == 'submit' ) {
106106 if( wgPageName.indexOf( "Sequence:" ) != 0 ){
 107+ // Add a timeout to give a chance for wikieditor to build out.
107108 setTimeout(function(){
108109 loadMwEmbed( [
109110 'mw.RemoteSearchDriver',
@@ -124,7 +125,11 @@
125126 // Timed text display:
126127 if ( wgPageName.indexOf( "TimedText:" ) === 0
127128 &&
128 - document.URL.indexOf('&diff=') == -1) {
 129+ ( document.URL.indexOf('&diff=') == -1
 130+ &&
 131+ document.URL.indexOf('?diff=') == -1
 132+ )
 133+ ){
129134 if( wgAction == 'view' ){
130135 var orgBody = mwSetPageToLoading();
131136 //load the "player" ( includes call to loadMwEmbed )
@@ -152,7 +157,11 @@
153158 // If on a view page set content to "loading"
154159 if( ( wgAction == 'view' || wgAction == 'edit' )
155160 &&
156 - document.URL.indexOf('&diff=') == -1
 161+ (
 162+ document.URL.indexOf('&diff=') == -1
 163+ &&
 164+ document.URL.indexOf('?diff=') == -1
 165+ )
157166 ){
158167 if( wgAction == 'view' ){
159168 var catLinksHtml = document.getElementById('catlinks');
@@ -180,7 +189,7 @@
181190 window.mwSequencerRemote.drawUI();
182191
183192 //setTimeout(function(){
184 - })
 193+ });
185194 }
186195
187196 }
@@ -208,7 +217,7 @@
209218 ];
210219 var scriptUrl = mwEmbedHostPath + '/remotes/' + scriptName + '?' + mwGetReqArgs();
211220 loadMwEmbed(libraries, function() {
212 - mw.load( scriptUrl )
 221+ mw.load( scriptUrl );
213222 } );
214223 return ;
215224 }
@@ -255,7 +264,7 @@
256265 'titleKey' : sequenceTitle,
257266 'target' : '#bodyContent'
258267 });
259 - window.mwSequencerRemote.showViewFlattenedFile()
 268+ window.mwSequencerRemote.showViewFlattenedFile();
260269 }
261270
262271 // Do utility rewrite of OggHandler content:
@@ -511,7 +520,7 @@
512521 // Issue an async request to rewrite the next clip
513522 if ( vidIdList.length != 0 ) {
514523 setTimeout( function() {
515 - procVidId( vidIdList.pop() )
 524+ procVidId( vidIdList.pop() );
516525 }, 1 );
517526 }
518527 }
@@ -534,7 +543,7 @@
535544 reqStr = s.src.substr( s.src.indexOf( '?' ) );
536545 scriptPath = s.src.substr( 0, s.src.indexOf( '?' ) ).replace( '/mediaWiki.js', '' );
537546 } else {
538 - scriptPath = s.src.replace( '/mediaWiki.js', '' )
 547+ scriptPath = s.src.replace( '/mediaWiki.js', '' );
539548 }
540549 // Use the external_media_wizard path:
541550 return [scriptPath + '/..', reqStr];
@@ -577,7 +586,7 @@
578587 callback = classSet;
579588 }
580589 if ( typeof MW_EMBED_VERSION != 'undefined' ) {
581 - mw.load( classSet, callback)
 590+ mw.load( classSet, callback);
582591 return ;
583592 }
584593 // Inject mwEmbed
@@ -642,10 +651,10 @@
643652 // Load the class set as part of mwReady callback
644653 mw.load( classSet, function(){
645654 callback();
646 - })
 655+ });
647656 });
648657 }
649 - }
 658+ };
650659 waitForJQueryUpgrade();
651660 }
652661 }
@@ -667,7 +676,7 @@
668677 // All enabled pages should check if we have the gadget already installed
669678 // if not offer a convenient button
670679 mwCheckForGadget();
671 - })
 680+ });
672681 }
673682 }
674683 /**
@@ -775,8 +784,8 @@
776785 $j('#gadget-form-loader')
777786 .text( gM( 'mwe-enable-gadget-done' ) );
778787 }
779 - } )
780 - })
 788+ } );
 789+ });
781790 }
782791 function mwGetFormFromPage( pageHTML ){
783792 var form = {};
@@ -811,7 +820,7 @@
812821 function mwCheckObjectPath ( libVar ) {
813822 if ( !libVar )
814823 return false;
815 - var objPath = libVar.split( '.' )
 824+ var objPath = libVar.split( '.' );
816825 var cur_path = '';
817826 for ( var p = 0; p < objPath.length; p++ ) {
818827 cur_path = ( cur_path == '' ) ? cur_path + objPath[p] : cur_path + '.' + objPath[p];

Status & tagging log