r61208 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61207‎ | r61208 | r61209 >
Date:18:33, 18 January 2010
Author:catrope
Status:ok
Tags:
Comment:
UsabilityInitiative: Fix JS error in FooterCleanup, add it to the Makefile
Modified paths:
  • /trunk/extensions/UsabilityInitiative/Makefile (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Modules/FooterCleanup/FooterCleanup.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Modules/FooterCleanup/FooterCleanup.js
@@ -17,7 +17,7 @@
1818 .replace( /\)|\(/g, '' )
1919 )
2020 .change( function() {
21 - if ( $j( this ).val().length == 0 )
 21+ if ( $j( this ).val().length == 0 ) {
2222 $j( this )
2323 .addClass( 'inline-hint' )
2424 .val( $j( this ).data( 'hint' ) );
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -15,14 +15,14 @@
1616 array( 'src' => 'Modules/CollapsibleNav/CollapsibleNav.js', 'version' => 6 ),
1717 array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 6 ),
1818 array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 5 ),
19 - array( 'src' => 'Modules/FooterCleanup/FooterCleanup.js', 'version' => 2 ),
 19+ array( 'src' => 'Modules/FooterCleanup/FooterCleanup.js', 'version' => 3 ),
2020 array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 5 ),
2121 ),
2222 'combined' => array(
23 - array( 'src' => 'Vector.combined.js', 'version' => 15 ),
 23+ array( 'src' => 'Vector.combined.js', 'version' => 16 ),
2424 ),
2525 'minified' => array(
26 - array( 'src' => 'Vector.combined.min.js', 'version' => 15 ),
 26+ array( 'src' => 'Vector.combined.min.js', 'version' => 16 ),
2727 ),
2828 );
2929 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -161,6 +161,77 @@
162162 });
163163 //Global storage of fallback for onbeforeunload hook
164164 var fallbackWindowOnBeforeUnload = null;
 165+/* Prototype code to demonstrate proposed edit page footer cleanups */
 166+/* First draft and will be changing greatly */
 167+
 168+mw.ready( function() {
 169+ if( !wgVectorEnabledModules.footercleanup ) {
 170+ return true;
 171+ }
 172+ $j( '#editpage-copywarn' )
 173+ .add( '.editOptions' )
 174+ .wrapAll( '<div id="editpage-bottom"></div>' );
 175+ $j( '#wpSummary' )
 176+ .data( 'hint',
 177+ $j( '#wpSummaryLabel span small' )
 178+ .remove()
 179+ .text()
 180+ // FIXME - Not a long-term solution. This change should be done in the message itself
 181+ .replace( /\)|\(/g, '' )
 182+ )
 183+ .change( function() {
 184+ if ( $j( this ).val().length == 0 ) {
 185+ $j( this )
 186+ .addClass( 'inline-hint' )
 187+ .val( $j( this ).data( 'hint' ) );
 188+ } else {
 189+ $j( this ).removeClass( 'inline-hint' );
 190+ }
 191+ } )
 192+ .focus( function() {
 193+ if ( $j( this ).val() == $j( this ).data( 'hint' ) ) {
 194+ $j( this )
 195+ .removeClass( 'inline-hint' )
 196+ .val( "" );
 197+ }
 198+ })
 199+ .blur( function() { $j( this ).trigger( 'change' ); } )
 200+ .trigger( 'change' );
 201+ $j( '#wpSummary' )
 202+ .add( '.editCheckboxes' )
 203+ .wrapAll( '<div id="editpage-summary-fields"></div>' );
 204+
 205+ $j( '#editpage-specialchars' ).remove();
 206+
 207+ // transclusions
 208+ // FIXME - bad CSS styling here with double class selectors. Should address here.
 209+ var transclusionCount = $j( '.templatesUsed ul li' ).size();
 210+ $j( '.templatesUsed ul' )
 211+ .wrap( '<div id="transclusions-list" class="collapsible-list collapsed"></div>' )
 212+ .parent()
 213+ // FIXME: i18n, remove link from message and let community add link to transclusion page if it exists
 214+ .prepend( '<label>This page contains <a href="http://en.wikipedia.org/wiki/transclusion">transclusions</a> of <strong>'
 215+ + transclusionCount
 216+ + '</strong> other pages.</label>');
 217+ $j( '.mw-templatesUsedExplanation' ).remove();
 218+
 219+ $j( '.collapsible-list label' )
 220+ .click( function() {
 221+ $j( this )
 222+ .parent()
 223+ .toggleClass( 'expanded' )
 224+ .toggleClass( 'collapsed' )
 225+ .find( 'ul' )
 226+ .slideToggle( 'fast' );
 227+ return false;
 228+ })
 229+ .trigger( 'click' );
 230+ $j( '#wpPreview, #wpDiff, .editHelp, #editpage-specialchars' )
 231+ .remove();
 232+ $j( '#mw-editform-cancel' )
 233+ .remove()
 234+ .appendTo('.editButtons');
 235+} );
165236 /* JavaScript for SimpleSearch extension */
166237
167238 // Disable mwsuggest.js on searchInput
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -7,6 +7,9 @@
88 $j('#wpTextbox1, #wpSummary').each(function(){$j(this).data('origtext',$j(this).val());});fallbackWindowOnBeforeUnload=window.onbeforeunload;window.onbeforeunload=function(){var fallbackResult=null;if(fallbackWindowOnBeforeUnload){fallbackResult=fallbackWindowOnBeforeUnload();}
99 if(fallbackResult!==null){return fallbackResult;}
1010 if(wgAction=='submit'||$j('#wpTextbox1').data('origtext')!=$j('#wpTextbox1').val()||$j('#wpSummary').data('origtext')!=$j('#wpSummary').val()){return gM('vector-editwarning-warning');}}
11 -$j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;if(typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];}
 11+$j('form').submit(function(){window.onbeforeunload=fallbackWindowOnBeforeUnload;});});var fallbackWindowOnBeforeUnload=null;mw.ready(function(){if(!wgVectorEnabledModules.footercleanup){return true;}
 12+$j('#editpage-copywarn').add('.editOptions').wrapAll('<div id="editpage-bottom"></div>');$j('#wpSummary').data('hint',$j('#wpSummaryLabel span small').remove().text().replace(/\)|\(/g,'')).change(function(){if($j(this).val().length==0){$j(this).addClass('inline-hint').val($j(this).data('hint'));}else{$j(this).removeClass('inline-hint');}}).focus(function(){if($j(this).val()==$j(this).data('hint')){$j(this).removeClass('inline-hint').val("");}}).blur(function(){$j(this).trigger('change');}).trigger('change');$j('#wpSummary').add('.editCheckboxes').wrapAll('<div id="editpage-summary-fields"></div>');$j('#editpage-specialchars').remove();var transclusionCount=$j('.templatesUsed ul li').size();$j('.templatesUsed ul').wrap('<div id="transclusions-list" class="collapsible-list collapsed"></div>').parent().prepend('<label>This page contains <a href="http://en.wikipedia.org/wiki/transclusion">transclusions</a> of <strong>'
 13++transclusionCount
 14++'</strong> other pages.</label>');$j('.mw-templatesUsedExplanation').remove();$j('.collapsible-list label').click(function(){$j(this).parent().toggleClass('expanded').toggleClass('collapsed').find('ul').slideToggle('fast');return false;}).trigger('click');$j('#wpPreview, #wpDiff, .editHelp, #editpage-specialchars').remove();$j('#mw-editform-cancel').remove().appendTo('.editButtons');});if(typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];}
1215 mw.ready(function(){if(!wgVectorEnabledModules.simplesearch||skin!='vector'){return true;}
1316 $j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(gM('vector-simplesearch-search')).css({'display':'none','position':'absolute','bottom':0,'padding':'0.25em','color':'#999999','cursor':'text'}).css(($j('body').is('.rtl')?'right':'left'),0).click(function(){$j(this).parent().find('input#searchInput').focus();}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').show();}}).focus(function(){$j(this).parent().find('label').hide();}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').show();}});$j('#searchInput, #searchInput2, #powerSearchText, #searchText').suggestions({fetch:function(query){var $this=$j(this);var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':query,'namespace':0,'suggest':''},dataType:'json',success:function(data){$this.suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request&&typeof request.abort=='function'){request.abort();$j(this).removeData('request');}},result:{select:function($textbox){$textbox.closest('form').submit();}},delay:120});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){var perfectMatch=false;$j(this).closest('.suggestions').find('.suggestions-results div').each(function(){if($j(this).data('text')==query){perfectMatch=true;}});if(perfectMatch){if($j(this).children().size()==0){$j(this).show();$label=$j('<div />').addClass('special-label').text(gM('vector-simplesearch-containing')).appendTo($j(this));$query=$j('<div />').addClass('special-query').text(query).appendTo($j(this));$query.autoEllipsis();}else{$j(this).find('.special-query').empty().text(query).autoEllipsis();}}else{$j(this).hide();$j(this).empty();}},select:function($textbox){$textbox.closest('form').append($j('<input />').attr({'type':'hidden','name':'fulltext','value':1}));$textbox.closest('form').submit();}},$region:$j('#simpleSearch')});});
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/Makefile
@@ -48,6 +48,7 @@
4949 Vector/Modules/CollapsibleNav/CollapsibleNav.js\
5050 Vector/Modules/CollapsibleTabs/CollapsibleTabs.js\
5151 Vector/Modules/EditWarning/EditWarning.js\
 52+ Vector/Modules/FooterCleanup/FooterCleanup.js\
5253 Vector/Modules/SimpleSearch/SimpleSearch.js
5354
5455 all: \

Status & tagging log