r59208 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59207‎ | r59208 | r59209 >
Date:19:55, 18 November 2009
Author:catrope
Status:deferred
Tags:
Comment:
wmf-deployment: Usability fix: forgot jquery.collapsibletabs.js in the Makefile
Modified paths:
  • /branches/wmf-deployment/extensions/UsabilityInitiative/Makefile (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)

Diff [purge]

Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -222,7 +222,100 @@
223223 $.browserTest(navigator.userAgent);
224224 })(jQuery);
225225
226 -/**
 226+( function( $ ) {
 227+
 228+$.fn.collapsibleTabs = function( $$options ) {
 229+ // return if the function is called on an empty jquery object
 230+ if( !this.length ) return this;
 231+ //merge options into the defaults
 232+ var $settings = $.extend( {}, $.collapsibleTabs.defaults, $$options );
 233+
 234+ this.each( function() {
 235+ var $this = $( this );
 236+ // add the element to our array of collapsible managers
 237+ $.collapsibleTabs.instances = ( $.collapsibleTabs.instances.length == 0 ? $this : $.collapsibleTabs.instances.add( $this ) );
 238+ // attach the settings to the elements
 239+ $this.data( 'collapsibleTabsSettings', $settings );
 240+ // attach data to our collapsible elements
 241+ $this.children( $settings.collapsible ).each(function() {
 242+ var $collapsible = $(this);
 243+ $collapsible.data('collapsibleTabsSettings', {
 244+ 'expandedContainer': $settings.expandedContainer,
 245+ 'collapsedContainer': $settings.collapsedContainer,
 246+ 'expandedWidth': $collapsible.width(),
 247+ 'prevElement': $collapsible.prev()
 248+ });
 249+ } );
 250+ } );
 251+
 252+ // if we haven't already bound our resize hanlder, bind it now
 253+ if(!$.collapsibleTabs.boundEvent) $(window).delayedBind('500','resize', function(){ $.collapsibleTabs.handleResize(); });
 254+ // call our resize handler to setup the page
 255+ $.collapsibleTabs.handleResize();
 256+ return this;
 257+};
 258+
 259+$.collapsibleTabs = {
 260+ instances: [],
 261+ boundEvent: null,
 262+ defaults: {
 263+ expandedContainer: '#p-views ul',
 264+ collapsedContainer: '#p-cactions ul',
 265+ collapsible: 'li.collapsible',
 266+ shifting: false,
 267+ expandCondition: function(eleWidth) {
 268+ return ( $('#left-navigation').position().left + $('#left-navigation').width())
 269+ < ($('#right-navigation').position().left - eleWidth);
 270+ },
 271+ collapseCondition: function() {
 272+ return ( $('#left-navigation').position().left + $('#left-navigation').width())
 273+ > $('#right-navigation').position().left;
 274+ }
 275+ },
 276+ handleResize: function(e){
 277+ $.collapsibleTabs.instances.each(function() {
 278+ var $this = $(this), data = $this.data('collapsibleTabsSettings');
 279+ if(data.shifting) return;
 280+
 281+ // if the two navigations are colliding
 282+ if( $this.children(data.collapsible).length > 0 && data.collapseCondition() ) {
 283+
 284+ $this.trigger("beforeTabCollapse");
 285+ // move the element to the dropdown menu
 286+ $.collapsibleTabs.moveToCollapsed($this.children(data.collapsible+':last'));
 287+ }
 288+
 289+ // if there are still moveable items in the dropdown menu,
 290+ // and there is sufficient space to place them in the tab container
 291+ if($(data.collapsedContainer + ' ' + data.collapsible ).length > 0
 292+ && data.expandCondition( $(data.collapsedContainer).children(
 293+ data.collapsible+":first").data('collapsibleTabsSettings').expandedWidth)) {
 294+ //move the element from the dropdown to the tab
 295+ $this.trigger("beforeTabExpand");
 296+ $.collapsibleTabs.moveToExpanded( data.collapsedContainer + " " + data.collapsible + ':first' );
 297+ }
 298+ });
 299+ },
 300+ moveToCollapsed: function( ele ) {
 301+ var $moving = $(ele);
 302+ var data = $moving.data('collapsibleTabsSettings');
 303+ $(data.expandedContainer).data('collapsibleTabsSettings').shifting = true;
 304+ $moving.remove().prependTo(data.collapsedContainer).data('collapsibleTabsSettings', data);
 305+ $(data.expandedContainer).data('collapsibleTabsSettings').shifting = false;
 306+ $.collapsibleTabs.handleResize();
 307+ },
 308+ moveToExpanded: function( ele ) {
 309+ var $moving = $(ele);
 310+ var data = $moving.data('collapsibleTabsSettings');
 311+ $(data.expandedContainer).data('collapsibleTabsSettings').shifting = true;
 312+ // remove this element from where it's at and put it in the dropdown menu
 313+ $moving.remove().insertAfter(data.prevElement).data('collapsibleTabsSettings', data);
 314+ $(data.expandedContainer).data('collapsibleTabsSettings').shifting = false;
 315+ $.collapsibleTabs.handleResize();
 316+ }
 317+};
 318+
 319+} )( jQuery );/**
227320 * Cookie plugin
228321 *
229322 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
Index: branches/wmf-deployment/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -18,7 +18,8 @@
1919 $text.attr('title',text);}});};})(jQuery);(function($){$.browserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i<h.length;i=i+1){r=r.replace(h[i][0],h[i][1]);}
2020 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';}
2121 if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';}
22 -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/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\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);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
 22+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/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\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(){var $collapsible=$(this);$collapsible.data('collapsibleTabsSettings',{'expandedContainer':$settings.expandedContainer,'collapsedContainer':$settings.collapsedContainer,'expandedWidth':$collapsible.width(),'prevElement':$collapsible.prev()});});});if(!$.collapsibleTabs.boundEvent)$(window).delayedBind('500','resize',function(){$.collapsibleTabs.handleResize();});$.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;}},handleResize:function(e){$.collapsibleTabs.instances.each(function(){var $this=$(this),data=$this.data('collapsibleTabsSettings');if(data.shifting)return;if($this.children(data.collapsible).length>0&&data.collapseCondition()){$this.trigger("beforeTabCollapse");$.collapsibleTabs.moveToCollapsed($this.children(data.collapsible+':last'));}
 23+if($(data.collapsedContainer+' '+data.collapsible).length>0&&data.expandCondition($(data.collapsedContainer).children(data.collapsible+":first").data('collapsibleTabsSettings').expandedWidth)){$this.trigger("beforeTabExpand");$.collapsibleTabs.moveToExpanded(data.collapsedContainer+" "+data.collapsible+':first');}});},moveToCollapsed:function(ele){var $moving=$(ele);var data=$moving.data('collapsibleTabsSettings');$(data.expandedContainer).data('collapsibleTabsSettings').shifting=true;$moving.remove().prependTo(data.collapsedContainer).data('collapsibleTabsSettings',data);$(data.expandedContainer).data('collapsibleTabsSettings').shifting=false;$.collapsibleTabs.handleResize();},moveToExpanded:function(ele){var $moving=$(ele);var data=$moving.data('collapsibleTabsSettings');$(data.expandedContainer).data('collapsibleTabsSettings').shifting=true;$moving.remove().insertAfter(data.prevElement).data('collapsibleTabsSettings',data);$(data.expandedContainer).data('collapsibleTabsSettings').shifting=false;$.collapsibleTabs.handleResize();}};})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
2324 var expires='';if(options.expires&&(typeof options.expires=='number'||options.expires.toUTCString)){var date;if(typeof options.expires=='number'){date=new Date();date.setTime(date.getTime()+(options.expires*24*60*60*1000));}else{date=options.expires;}
2425 expires='; expires='+date.toUTCString();}
2526 var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
Index: branches/wmf-deployment/extensions/UsabilityInitiative/Makefile
@@ -20,6 +20,7 @@
2121 js/plugins/jquery.async.js\
2222 js/plugins/jquery.autoEllipse.js\
2323 js/plugins/jquery.browser.js\
 24+ js/plugins/jquery.collapsibleTabs.js\
2425 js/plugins/jquery.cookie.js\
2526 js/plugins/jquery.delayedBind.js\
2627 js/plugins/jquery.namespaceSelect.js\

Status & tagging log