r59546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59545‎ | r59546 | r59547 >
Date:15:17, 29 November 2009
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: EditWarning: (bug 21682) Check for wgAction == 'submit' instead of visibility of preview element, rearrange checks for performance
Modified paths:
  • /trunk/extensions/UsabilityInitiative/Vector/Modules/EditWarning/EditWarning.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/EditWarning/EditWarning.js
@@ -26,9 +26,9 @@
2727 // Check if the current values of some form elements are the same as
2828 // the original values
2929 if(
30 - $j( '#wpTextbox1' ).data( 'origtext' ) != $j( '#wpTextbox1' ).val()
31 - || $j( '#wpSummary' ).data( 'origtext' ) != $j( '#wpSummary' ).val()
32 - || $j( '#wikiPreview' ).is( ':visible' )
 30+ wgAction == 'submit' ||
 31+ $j( '#wpTextbox1' ).data( 'origtext' ) != $j( '#wpTextbox1' ).val() ||
 32+ $j( '#wpSummary' ).data( 'origtext' ) != $j( '#wpSummary' ).val()
3333 ) {
3434 // Return our message
3535 return gM( 'vector-editwarning-warning' );
@@ -41,4 +41,4 @@
4242 });
4343 });
4444 //Global storage of fallback for onbeforeunload hook
45 -var fallbackWindowOnBeforeUnload = null;
\ No newline at end of file
 45+var fallbackWindowOnBeforeUnload = null;
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -13,14 +13,14 @@
1414 static $scripts = array(
1515 'raw' => array(
1616 array( 'src' => 'Modules/CollapsibleTabs/CollapsibleTabs.js', 'version' => 4 ),
17 - array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 1 ),
 17+ array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 2 ),
1818 array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 2 ),
1919 ),
2020 'combined' => array(
21 - array( 'src' => 'Vector.combined.js', 'version' => 4 ),
 21+ array( 'src' => 'Vector.combined.js', 'version' => 5 ),
2222 ),
2323 'minified' => array(
24 - array( 'src' => 'Vector.combined.min.js', 'version' => 4 ),
 24+ array( 'src' => 'Vector.combined.min.js', 'version' => 5 ),
2525 ),
2626 );
2727 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -103,9 +103,9 @@
104104 // Check if the current values of some form elements are the same as
105105 // the original values
106106 if(
107 - $j( '#wpTextbox1' ).data( 'origtext' ) != $j( '#wpTextbox1' ).val()
108 - || $j( '#wpSummary' ).data( 'origtext' ) != $j( '#wpSummary' ).val()
109 - || $j( '#wikiPreview' ).is( ':visible' )
 107+ wgAction == 'submit' ||
 108+ $j( '#wpTextbox1' ).data( 'origtext' ) != $j( '#wpTextbox1' ).val() ||
 109+ $j( '#wpSummary' ).data( 'origtext' ) != $j( '#wpSummary' ).val()
110110 ) {
111111 // Return our message
112112 return gM( 'vector-editwarning-warning' );
@@ -118,7 +118,8 @@
119119 });
120120 });
121121 //Global storage of fallback for onbeforeunload hook
122 -var fallbackWindowOnBeforeUnload = null;/* JavaScript for SimpleSearch extension */
 122+var fallbackWindowOnBeforeUnload = null;
 123+/* JavaScript for SimpleSearch extension */
123124
124125 // Disable mwsuggest.js on searchInput
125126 if ( typeof os_autoload_inputs !== 'undefined' && os_autoload_forms !== 'undefined' ) {
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -4,7 +4,7 @@
55 $j("#p-cactions h5").animate({'width':'1px'},370,function(){$j(this).attr('style','').parent().addClass("emptyPortlet").removeClass("filledPortlet");});}).collapsibleTabs({expandCondition:function(eleWidth){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width()+1)<($j('#left-navigation').position().left-eleWidth);}else{return($j('#left-navigation').position().left+$j('#left-navigation').width()+1)<($j('#right-navigation').position().left-eleWidth);}},collapseCondition:function(){if(rtl){return($j('#right-navigation').position().left+$j('#right-navigation').width())>$j('#left-navigation').position().left;}else{return($j('#left-navigation').position().left+$j('#left-navigation').width())>$j('#right-navigation').position().left;}}});});js2AddOnloadHook(function(){if(!wgVectorPreferences||!(wgVectorPreferences.editwarning&&wgVectorPreferences.editwarning.enable)){return true;}
66 $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();}
77 if(fallbackResult!==null){return fallbackResult;}
8 -if($j('#wpTextbox1').data('origtext')!=$j('#wpTextbox1').val()||$j('#wpSummary').data('origtext')!=$j('#wpSummary').val()||$j('#wikiPreview').is(':visible')){return gM('vector-editwarning-warning');}}
 8+if(wgAction=='submit'||$j('#wpTextbox1').data('origtext')!=$j('#wpTextbox1').val()||$j('#wpSummary').data('origtext')!=$j('#wpSummary').val()){return gM('vector-editwarning-warning');}}
99 $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=[];}
1010 js2AddOnloadHook(function(){if(skin!='vector'){return;}
1111 $j('div#simpleSearch > input#searchInput').each(function(){$j('<label></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.autoEllipse();}else{$j(this).find('.special-query').empty().text(query).autoEllipse();}}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

Follow-up revisions

RevisionCommit summaryAuthorDate
r62206bug 21682, add estimated time remainingneilk23:29, 9 February 2010

Status & tagging log