r78563 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78562‎ | r78563 | r78564 >
Date:14:35, 18 December 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r78559
Modified paths:
  • /trunk/extensions/Push/includes/Push_Tab.php (modified) (history)
  • /trunk/extensions/Push/includes/ext.push.tab.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Push/includes/Push_Tab.php
@@ -329,7 +329,7 @@
330330 ' ' .
331331 Html::rawElement(
332332 'div',
333 - array( 'style' => 'display:inline; opacity:0', 'id' => 'txtTemplateList' ),
 333+ array( 'style' => 'display:none; opacity:0', 'id' => 'txtTemplateList' ),
334334 count( $templates ) > 0 ?
335335 wfMsgExt( 'push-tab-used-templates', 'parseinline', $wgLang->listToText( $templates ), count( $templates ) ) :
336336 htmlspecialchars( wfMsg( 'push-tab-no-used-templates' ) )
@@ -376,7 +376,7 @@
377377 ' ' .
378378 Html::rawElement(
379379 'div',
380 - array( 'style' => 'display:inline; opacity:0', 'id' => 'txtFileList' ),
 380+ array( 'style' => 'display:none; opacity:0', 'id' => 'txtFileList' ),
381381 ''
382382 )
383383 )
Index: trunk/extensions/Push/includes/ext.push.tab.js
@@ -24,9 +24,6 @@
2525 }
2626
2727 var pages;
28 - var imageRequestMade = false;
29 - var images = false;
30 - var imagePushRequests = [];
3128
3229 $.each($(".push-button"), function(i,v) {
3330 getRemoteArticleInfo( $(v).attr( 'targetid' ), $(v).attr( 'pushtarget' ) );
@@ -53,10 +50,6 @@
5451 $(this).attr( 'pushtarget' ),
5552 $(this).attr( 'targetname' )
5653 );
57 -
58 - if ( $('#checkIncFiles').length != 0 && $('#checkIncFiles').attr('checked') && !imageRequestMade ) {
59 - getIncludedImages();
60 - }
6154 });
6255
6356 $('#push-all-button').click(function() {
@@ -69,8 +62,14 @@
7063
7164 $('#divIncTemplates').hover(
7265 function() {
 66+ var isHidden = $('#txtTemplateList').css( 'opacity' ) == 0;
 67+
 68+ if ( isHidden ) {
 69+ $('#txtTemplateList').css( 'display', 'inline' );
 70+ }
 71+
7372 $('#txtTemplateList').fadeTo(
74 - ( $('#txtTemplateList').css( 'opacity' ) == 0 ? 'slow' : 'fast' ),
 73+ isHidden? 'slow' : 'fast',
7574 1
7675 );
7776 },
@@ -88,6 +87,7 @@
8988 var isHidden = $('#txtFileList').css( 'opacity' ) == 0;
9089
9190 if ( isHidden ) {
 91+ $('#txtFileList').css( 'display', 'inline' );
9292 setIncludeFilesText();
9393 }
9494
@@ -189,57 +189,15 @@
190190
191191 function setButtonToImgPush( button, targetUrl, targetName ) {
192192 button.innerHTML = mediaWiki.msg( 'push-button-pushing-files' );
193 - imagePushRequests.push( { 'sender': button, 'targetUrl': targetUrl, 'targetName': targetName } );
194 - startImagesPush();
 193+ initiateImagePush( button, targetUrl, targetName );
195194 }
196195
197 - function getIncludedImages() {
198 - imageRequestMade = true;
 196+ function initiateImagePush( sender, targetUrl, targetName ) {
 197+ var images = window.wgPushPageFiles.concat( window.wgPushTemplateFiles );
199198
200199 $.getJSON(
201200 wgScriptPath + '/api.php',
202201 {
203 - 'action': 'query',
204 - 'prop': 'images',
205 - 'format': 'json',
206 - 'titles': pages.join( '|' ),
207 - },
208 - function( data ) {
209 - if ( data.query ) {
210 - images = [];
211 -
212 - for ( page in data.query.pages ) {
213 - if ( data.query.pages[page].images ) {
214 - for ( var i = data.query.pages[page].images.length - 1; i >= 0; i-- ) {
215 - if ( $.inArray( data.query.pages[page].images[i].title, images ) == -1 ) {
216 - images.push( data.query.pages[page].images[i].title );
217 - }
218 - }
219 - }
220 - }
221 -
222 - startImagesPush();
223 - }
224 - else {
225 - alert( mediaWiki.msg( 'push-tab-err-fileinfo' ) );
226 - }
227 - }
228 - );
229 - }
230 -
231 - function startImagesPush() {
232 - if ( images !== false ) {
233 - var req;
234 - while ( req = imagePushRequests.pop() ) {
235 - initiateImagePush( req.sender, req.targetUrl, req.targetName );
236 - }
237 - }
238 - }
239 -
240 - function initiateImagePush( sender, targetUrl, targetName ) {
241 - $.getJSON(
242 - wgScriptPath + '/api.php',
243 - {
244202 'action': 'pushimages',
245203 'format': 'json',
246204 'images': images.join( '|' ),

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78559Work on file inclusion optionjeroendedauw12:33, 18 December 2010

Status & tagging log