r69109 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69108‎ | r69109 | r69110 >
Date:20:40, 6 July 2010
Author:adam
Status:ok
Tags:
Comment:
Fix for bug 23921. In the process fixing an apparent bug in our browser blacklisting code
Modified paths:
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.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)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.browser.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/usability.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/Vector/Modules/SimpleSearch/SimpleSearch.js
@@ -18,6 +18,7 @@
1919 'ltr': {
2020 // SimpleSearch is broken in Opera < 9.6
2121 'opera': [['>=', 9.6]],
 22+ 'docomo': false,
2223 'blackberry': false,
2324 'ipod': false,
2425 'iphone': false
@@ -25,6 +26,7 @@
2627 // Right-to-left languages
2728 'rtl': {
2829 'opera': [['>=', 9.6]],
 30+ 'docomo': false,
2931 'blackberry': false,
3032 'ipod': false,
3133 'iphone': false
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.hooks.php
@@ -17,13 +17,13 @@
1818 array( 'src' => 'Modules/ExpandableSearch/ExpandableSearch.js', 'version' => 5 ),
1919 array( 'src' => 'Modules/EditWarning/EditWarning.js', 'version' => 10 ),
2020 array( 'src' => 'Modules/FooterCleanup/FooterCleanup.js', 'version' => 5 ),
21 - array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 21 ),
 21+ array( 'src' => 'Modules/SimpleSearch/SimpleSearch.js', 'version' => 22 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'Vector.combined.js', 'version' => 64 ),
 24+ array( 'src' => 'Vector.combined.js', 'version' => 65 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'Vector.combined.min.js', 'version' => 65 ),
 27+ array( 'src' => 'Vector.combined.min.js', 'version' => 66 ),
2828 ),
2929 );
3030 static $modules = array(
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.js
@@ -528,6 +528,7 @@
529529 'ltr': {
530530 // SimpleSearch is broken in Opera < 9.6
531531 'opera': [['>=', 9.6]],
 532+ 'docomo': false,
532533 'blackberry': false,
533534 'ipod': false,
534535 'iphone': false
@@ -535,6 +536,7 @@
536537 // Right-to-left languages
537538 'rtl': {
538539 'opera': [['>=', 9.6]],
 540+ 'docomo': false,
539541 'blackberry': false,
540542 'ipod': false,
541543 'iphone': false
Index: trunk/extensions/UsabilityInitiative/Vector/Vector.combined.min.js
@@ -25,7 +25,7 @@
2626 +transclusionCount
2727 +'</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(wgVectorEnabledModules.simplesearch&&skin=='vector'&&typeof os_autoload_inputs!=='undefined'&&os_autoload_forms!=='undefined'){os_autoload_inputs=[];os_autoload_forms=[];}
2828 $j(document).ready(function(){if(!wgVectorEnabledModules.simplesearch||wgVectorPreferences.simplesearch.disablesuggest||skin!='vector'){return true;}
29 -var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'blackberry':false,'ipod':false,'iphone':false},'rtl':{'opera':[['>=',9.6]],'blackberry':false,'ipod':false,'iphone':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;}
 29+var mod={'browsers':{'ltr':{'opera':[['>=',9.6]],'docomo':false,'blackberry':false,'ipod':false,'iphone':false},'rtl':{'opera':[['>=',9.6]],'docomo':false,'blackberry':false,'ipod':false,'iphone':false}}};if(!$j.wikiEditor.isSupported(mod)){return true;}
3030 $j('div#simpleSearch > input#searchInput').each(function(){$j('<label />').text(mw.usability.getMsg('vector-simplesearch-search')).css({'display':'none','position':'absolute','color':'#999999','cursor':'text','margin':'0 4px','top':'6px','line-height':'13px'}).css(($j('body').is('.rtl')?'right':'left'),0).mousedown(function(){$j(this).parent().find('input#searchInput').focus();return false;}).appendTo($j(this).parent());if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}}).bind('keypress',function(){if($j(this).parent().find('label:visible').size()>0)
3131 $j(this).parent().find('label').fadeOut(100);}).focus(function(){$j(this).parent().find('label').fadeOut(100);}).blur(function(){if($j(this).val()==''){$j(this).parent().find('label').fadeIn(100);}});$j(document).bind('dragend',function(event){if($j('div#simpleSearch > label:visible').size()>0&&$j('div#simpleSearch > input#searchInput').val().length>0)
3232 $j('div#simpleSearch > label').fadeOut(100);});$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,positionFromLeft:$j('body').is('.rtl'),highlightInput:true}).bind('paste cut',function(e){$j(this).trigger('keypress');});$j('#searchInput').suggestions({result:{select:function($textbox){$textbox.closest('form').submit();}},special:{render:function(query){if($j(this).children().size()==0){$j(this).show()
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -54,20 +54,20 @@
5555 'base_sets' => array(
5656 'raw' => array(
5757 // Common UsabilityInitiative funtions
58 - array( 'src' => 'js/usability.js', 'version' => 3 ),
 58+ array( 'src' => 'js/usability.js', 'version' => 4 ),
5959
6060 // Core functionality of extension scripts
6161 array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ),
62 - array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 15 ),
63 - array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 8 ),
 62+ array( 'src' => 'js/plugins/jquery.autoEllipsis.js', 'version' => 16 ),
 63+ array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 9 ),
6464 array( 'src' => 'js/plugins/jquery.collapsibleTabs.js', 'version' => 6 ),
6565 array( 'src' => 'js/plugins/jquery.color.js', 'version' => 1 ),
6666 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 4 ),
6767 array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ),
6868 array( 'src' => 'js/plugins/jquery.expandableField.js', 'version' => 17 ),
69 - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 31 ),
 69+ array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 32 ),
7070 array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 36 ),
71 - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 195 ),
 71+ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 196 ),
7272 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 53 ),
7373 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 71 ),
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 28 ),
@@ -82,10 +82,10 @@
8383 array( 'src' => 'js/thirdparty/contentCollector.js', 'version' => 2 ),
8484 ),
8585 'combined' => array(
86 - array( 'src' => 'js/plugins.combined.js', 'version' => 447 ),
 86+ array( 'src' => 'js/plugins.combined.js', 'version' => 448 ),
8787 ),
8888 'minified' => array(
89 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 457 ),
 89+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 458 ),
9090 ),
9191 ),
9292 );
Index: trunk/extensions/UsabilityInitiative/js/usability.js
@@ -92,6 +92,10 @@
9393 mw.usability.testBrowser = function( map ) {
9494 // Check over each browser condition to determine if we are running in a compatible client
9595 var browser = map[$j( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$j.browser.name];
 96+ // if the browser is set to a boolean value, return that value
 97+ if ( typeof browser == 'boolean' ) {
 98+ return browser;
 99+ }
96100 if ( typeof browser !== 'object' ) {
97101 // Unknown, so we assume it's working
98102 return true;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.browser.js
@@ -65,7 +65,7 @@
6666 ['PLAYSTATION 3', 'PS3']
6767 ]) : a).toLowerCase();
6868
69 - $.browser = $.extend((!z) ? $.browser : {}, c(a, /(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari|ipod|iphone|blackberry|ps3)/, [], /(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari|ps3)(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\)|\s|$)/));
 69+ $.browser = $.extend((!z) ? $.browser : {}, c(a, /(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari|ipod|iphone|blackberry|ps3|docomo)/, [], /(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari|ps3)(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\)|\s|$)/));
7070
7171 $.layout = c(a, /(gecko|konqueror|msie|opera|webkit)/, [
7272 ['konqueror', 'khtml'],
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -92,6 +92,10 @@
9393 mw.usability.testBrowser = function( map ) {
9494 // Check over each browser condition to determine if we are running in a compatible client
9595 var browser = map[$j( 'body' ).is( '.rtl' ) ? 'rtl' : 'ltr'][$j.browser.name];
 96+ // if the browser is set to a boolean value, return that value
 97+ if ( typeof browser == 'boolean' ) {
 98+ return browser;
 99+ }
96100 if ( typeof browser !== 'object' ) {
97101 // Unknown, so we assume it's working
98102 return true;
@@ -420,7 +424,7 @@
421425 ['PLAYSTATION 3', 'PS3']
422426 ]) : a).toLowerCase();
423427
424 - $.browser = $.extend((!z) ? $.browser : {}, c(a, /(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari|ipod|iphone|blackberry|ps3)/, [], /(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari|ps3)(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\)|\s|$)/));
 428+ $.browser = $.extend((!z) ? $.browser : {}, c(a, /(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari|ipod|iphone|blackberry|ps3|docomo)/, [], /(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari|ps3)(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\)|\s|$)/));
425429
426430 $.layout = c(a, /(gecko|konqueror|msie|opera|webkit)/, [
427431 ['konqueror', 'khtml'],
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -4,7 +4,8 @@
55 mw.usability.load=function(deps,callback){var needJUI=false;for(var i=0;i<deps.length&&!needJUI;i++){if(deps[i]=='$j.ui'){needJUI=true;}}
66 if(needJUI&&typeof $j.ui=='undefined'){$j.getScript(wgScriptPath+'/extensions/UsabilityInitiative/js/js2stopgap/jui.combined.min.js',callback);}else{callback();}};mw.usability.addMessages=function(messages){for(var key in messages){this.messages[key]=messages[key];}};mw.usability.getMsg=function(key,args){if(!(key in this.messages)){return'['+key+']';}
77 var msg=this.messages[key];if(typeof args=='object'||typeof args=='array'){for(var argKey in args){msg=msg.replace('\$'+(parseInt(argKey)+1),args[argKey]);}}else if(typeof args=='string'||typeof args=='number'){msg=msg.replace('$1',args);}
8 -return msg;};mw.usability.testBrowser=function(map){var browser=map[$j('body').is('.rtl')?'rtl':'ltr'][$j.browser.name];if(typeof browser!=='object'){return true;}
 8+return msg;};mw.usability.testBrowser=function(map){var browser=map[$j('body').is('.rtl')?'rtl':'ltr'][$j.browser.name];if(typeof browser=='boolean'){return browser;}
 9+if(typeof browser!=='object'){return true;}
910 for(var condition in browser){var op=browser[condition][0];var val=browser[condition][1];if(val===false){return false;}else if(typeof val=='string'){if(!(eval('$j.browser.version'+op+'"'+val+'"'))){return false;}}else if(typeof val=='number'){if(!(eval('$j.browser.versionNumber'+op+val))){return false;}}}
1011 return true;};mw.usability.getMaxTabIndex=function(){var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI){maxTI=ti;}});return maxTI;};(function($){$.whileAsync=function(opts)
1112 {var delay=Math.abs(opts.delay)||10,bulk=isNaN(opts.bulk)?500:Math.abs(opts.bulk),test=opts.test||function(){return true;},loop=opts.loop||function(){},end=opts.end||function(){};(function(){var t=false,begin=new Date();while(t=test())
@@ -35,7 +36,7 @@
3637 return r;},c=function(i,a,b,c){var r={name:m((a.exec(i)||[u,u])[1],b)};r[r.name]=true;r.version=(c.exec(i)||[x,x,x,x])[3];if(r.name.match(/safari/)&&r.version>400){r.version='2.0';}
3738 if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';}
3839 if(r.name==='opera'&&$.browser.version>=9.8){r.version=i.match(/version\/([0-9\.]*)/i)[1]||10;}
39 -r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome|PLAYSTATION 3/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape'],['PLAYSTATION 3','PS3']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari|ipod|iphone|blackberry|ps3)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari|ps3)(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\)|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);(function($){$.fn.collapsibleTabs=function($$options){if(!this.length)return this;var $settings=$.extend({},$.collapsibleTabs.defaults,$$options);this.each(function(){var $this=$(this);$.collapsibleTabs.instances=($.collapsibleTabs.instances.length==0?$this:$.collapsibleTabs.instances.add($this));$this.data('collapsibleTabsSettings',$settings);$this.children($settings.collapsible).each(function(){$.collapsibleTabs.addData($(this));});});if(!$.collapsibleTabs.boundEvent){$(window).delayedBind('500','resize',function(){$.collapsibleTabs.handleResize();});}
 40+r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome|PLAYSTATION 3/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape'],['PLAYSTATION 3','PS3']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari|ipod|iphone|blackberry|ps3|docomo)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari|ps3)(\/|\;?\s|)([a-z0-9\.\+]*?)(\;|dev|rel|\)|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery);(function($){$.fn.collapsibleTabs=function($$options){if(!this.length)return this;var $settings=$.extend({},$.collapsibleTabs.defaults,$$options);this.each(function(){var $this=$(this);$.collapsibleTabs.instances=($.collapsibleTabs.instances.length==0?$this:$.collapsibleTabs.instances.add($this));$this.data('collapsibleTabsSettings',$settings);$this.children($settings.collapsible).each(function(){$.collapsibleTabs.addData($(this));});});if(!$.collapsibleTabs.boundEvent){$(window).delayedBind('500','resize',function(){$.collapsibleTabs.handleResize();});}
4041 $.collapsibleTabs.handleResize();return this;};$.collapsibleTabs={instances:[],boundEvent:null,defaults:{expandedContainer:'#p-views ul',collapsedContainer:'#p-cactions ul',collapsible:'li.collapsible',shifting:false,expandCondition:function(eleWidth){return($('#left-navigation').position().left+$('#left-navigation').width())<($('#right-navigation').position().left-eleWidth);},collapseCondition:function(){return($('#left-navigation').position().left+$('#left-navigation').width())>$('#right-navigation').position().left;}},addData:function($collapsible){var $settings=$collapsible.parent().data('collapsibleTabsSettings');$collapsible.data('collapsibleTabsSettings',{'expandedContainer':$settings.expandedContainer,'collapsedContainer':$settings.collapsedContainer,'expandedWidth':$collapsible.width(),'prevElement':$collapsible.prev()});},getSettings:function($collapsible){var $settings=$collapsible.data('collapsibleTabsSettings');if(typeof $settings=='undefined'){$.collapsibleTabs.addData($collapsible);$settings=$collapsible.data('collapsibleTabsSettings');}
4142 return $settings;},handleResize:function(e){$.collapsibleTabs.instances.each(function(){var $this=$(this),data=$.collapsibleTabs.getSettings($this);if(data.shifting)return;if($this.children(data.collapsible).length>0&&data.collapseCondition()){$this.trigger("beforeTabCollapse");$.collapsibleTabs.moveToCollapsed($this.children(data.collapsible+':last'));}
4243 if($(data.collapsedContainer+' '+data.collapsible).length>0&&data.expandCondition($.collapsibleTabs.getSettings($(data.collapsedContainer).children(data.collapsible+":first")).expandedWidth)){$this.trigger("beforeTabExpand");$.collapsibleTabs.moveToExpanded(data.collapsedContainer+" "+data.collapsible+':first');}});},moveToCollapsed:function(ele){var $moving=$(ele);var data=$.collapsibleTabs.getSettings($moving);var dataExp=$.collapsibleTabs.getSettings(data.expandedContainer);dataExp.shifting=true;$moving.remove().prependTo(data.collapsedContainer).data('collapsibleTabsSettings',data);dataExp.shifting=false;$.collapsibleTabs.handleResize();},moveToExpanded:function(ele){var $moving=$(ele);var data=$.collapsibleTabs.getSettings($moving);var dataExp=$.collapsibleTabs.getSettings(data.expandedContainer);dataExp.shifting=true;$moving.remove().insertAfter(data.prevElement).data('collapsibleTabsSettings',data);dataExp.shifting=false;$.collapsibleTabs.handleResize();}};})(jQuery);(function(jQuery){jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end);}

Status & tagging log