r63126 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63125‎ | r63126 | r63127 >
Date:18:26, 1 March 2010
Author:tparscal
Status:ok
Tags:
Comment:
Fixed some remnants of a failed experiment (zoomBox) now using highlightLine. Also added color plugin to makefile.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/Makefile (modified) (history)
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.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.wikiEditor.html (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -77,7 +77,7 @@
7878 array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 36 ),
7979 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 52 ),
8080 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 19 ),
81 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 95 ),
 81+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 96 ),
8282 array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 11 ),
8383 array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 28 ),
8484 array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 3 ),
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -459,7 +459,7 @@
460460 'startContainer': wrapper
461461 } );
462462 // Bring user's eyes to the point we've now jumped to
463 - context.fn.zoomBox( $( wrapper ) );
 463+ context.fn.highlightLine( $( wrapper ) );
464464 // Highlight the clicked link
465465 $.wikiEditor.modules.toc.fn.unhighlight( context );
466466 $( this ).addClass( 'current' );
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.html
@@ -106,12 +106,6 @@
107107 /*display: -webkit-box; -- presumably not needed now that this is a <p> without display: inline; */
108108 /*font-weight: bold; -- not sure about this styling just yet */
109109 }
110 - .wikiEditor-zoomBox {
111 - border: solid 5px silver;
112 - z-index: 99;
113 - position: absolute;
114 - display: none;
115 - }
116110 </style>
117111 </head>
118112 <body></body>
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -5446,7 +5446,130 @@
54475447 }
54485448 };
54495449
5450 -} )( jQuery );/**
 5450+} )( jQuery );/*
 5451+ * jQuery Color Animations
 5452+ * Copyright 2007 John Resig
 5453+ * Released under the MIT and GPL licenses.
 5454+ */
 5455+
 5456+(function(jQuery){
 5457+
 5458+ // We override the animation for all of these color styles
 5459+ jQuery.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'color', 'outlineColor'], function(i,attr){
 5460+ jQuery.fx.step[attr] = function(fx){
 5461+ if ( fx.state == 0 ) {
 5462+ fx.start = getColor( fx.elem, attr );
 5463+ fx.end = getRGB( fx.end );
 5464+ }
 5465+
 5466+ fx.elem.style[attr] = "rgb(" + [
 5467+ Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
 5468+ Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
 5469+ Math.max(Math.min( parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2]), 255), 0)
 5470+ ].join(",") + ")";
 5471+ }
 5472+ });
 5473+
 5474+ // Color Conversion functions from highlightFade
 5475+ // By Blair Mitchelmore
 5476+ // http://jquery.offput.ca/highlightFade/
 5477+
 5478+ // Parse strings looking for color tuples [255,255,255]
 5479+ function getRGB(color) {
 5480+ var result;
 5481+
 5482+ // Check if we're already dealing with an array of colors
 5483+ if ( color && color.constructor == Array && color.length == 3 )
 5484+ return color;
 5485+
 5486+ // Look for rgb(num,num,num)
 5487+ if (result = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
 5488+ return [parseInt(result[1]), parseInt(result[2]), parseInt(result[3])];
 5489+
 5490+ // Look for rgb(num%,num%,num%)
 5491+ if (result = /rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
 5492+ return [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];
 5493+
 5494+ // Look for #a0b1c2
 5495+ if (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
 5496+ return [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];
 5497+
 5498+ // Look for #fff
 5499+ if (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
 5500+ return [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];
 5501+
 5502+ // Otherwise, we're most likely dealing with a named color
 5503+ return colors[jQuery.trim(color).toLowerCase()];
 5504+ }
 5505+
 5506+ function getColor(elem, attr) {
 5507+ var color;
 5508+
 5509+ do {
 5510+ color = jQuery.curCSS(elem, attr);
 5511+
 5512+ // Keep going until we find an element that has color, or we hit the body
 5513+ if ( color != '' && color != 'transparent' || jQuery.nodeName(elem, "body") )
 5514+ break;
 5515+
 5516+ attr = "backgroundColor";
 5517+ } while ( elem = elem.parentNode );
 5518+
 5519+ return getRGB(color);
 5520+ };
 5521+
 5522+ // Some named colors to work with
 5523+ // From Interface by Stefan Petre
 5524+ // http://interface.eyecon.ro/
 5525+
 5526+ var colors = {
 5527+ aqua:[0,255,255],
 5528+ azure:[240,255,255],
 5529+ beige:[245,245,220],
 5530+ black:[0,0,0],
 5531+ blue:[0,0,255],
 5532+ brown:[165,42,42],
 5533+ cyan:[0,255,255],
 5534+ darkblue:[0,0,139],
 5535+ darkcyan:[0,139,139],
 5536+ darkgrey:[169,169,169],
 5537+ darkgreen:[0,100,0],
 5538+ darkkhaki:[189,183,107],
 5539+ darkmagenta:[139,0,139],
 5540+ darkolivegreen:[85,107,47],
 5541+ darkorange:[255,140,0],
 5542+ darkorchid:[153,50,204],
 5543+ darkred:[139,0,0],
 5544+ darksalmon:[233,150,122],
 5545+ darkviolet:[148,0,211],
 5546+ fuchsia:[255,0,255],
 5547+ gold:[255,215,0],
 5548+ green:[0,128,0],
 5549+ indigo:[75,0,130],
 5550+ khaki:[240,230,140],
 5551+ lightblue:[173,216,230],
 5552+ lightcyan:[224,255,255],
 5553+ lightgreen:[144,238,144],
 5554+ lightgrey:[211,211,211],
 5555+ lightpink:[255,182,193],
 5556+ lightyellow:[255,255,224],
 5557+ lime:[0,255,0],
 5558+ magenta:[255,0,255],
 5559+ maroon:[128,0,0],
 5560+ navy:[0,0,128],
 5561+ olive:[128,128,0],
 5562+ orange:[255,165,0],
 5563+ pink:[255,192,203],
 5564+ purple:[128,0,128],
 5565+ violet:[128,0,128],
 5566+ red:[255,0,0],
 5567+ silver:[192,192,192],
 5568+ white:[255,255,255],
 5569+ yellow:[255,255,0]
 5570+ };
 5571+
 5572+})(jQuery);
 5573+/**
54515574 * Cookie plugin
54525575 *
54535576 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
@@ -10176,7 +10299,7 @@
1017710300 'startContainer': wrapper
1017810301 } );
1017910302 // Bring user's eyes to the point we've now jumped to
10180 - context.fn.zoomBox( $( wrapper ) );
 10303+ context.fn.highlightLine( $( wrapper ) );
1018110304 // Highlight the clicked link
1018210305 $.wikiEditor.modules.toc.fn.unhighlight( context );
1018310306 $( this ).addClass( 'current' );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -373,7 +373,15 @@
374374 if(r.name==='opera'&&$.browser.version>=9.8){r.version=i.match(/version\/([0-9\.]*)/i)[1]||10;}
375375 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();});}
376376 $.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'));}
377 -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;}
 377+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);(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);}
 378+fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")";}});function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)
 379+return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color))
 380+return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])];if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color))
 381+return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55];if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))
 382+return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)];if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))
 383+return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)];return colors[jQuery.trim(color).toLowerCase()];}
 384+function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body"))
 385+break;attr="backgroundColor";}while(elem=elem.parentNode);return getRGB(color);};var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};})(jQuery);jQuery.cookie=function(name,value,options){if(typeof value!='undefined'){options=options||{};if(value===null){value='';options.expires=-1;}
378386 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;}
379387 expires='; expires='+date.toUTCString();}
380388 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;}}}
@@ -692,7 +700,7 @@
693701 sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}}
694702 return sections;}
695703 function buildList(structure){var list=$('<ul />');for(i in structure){var div=$('<div />').addClass('section-'+structure[i].index).data('index',structure[i].index).mousedown(function(){return false;}).click(function(event){var wrapper=context.$content.find('.wikiEditor-toc-section-'+$(this).data('index'));if(wrapper.size()==0)
696 -wrapper=context.$content;context.fn.scrollToTop(wrapper,true);context.$textarea.textSelection('setSelection',{'start':0,'startContainer':wrapper});context.fn.zoomBox($(wrapper));$.wikiEditor.modules.toc.fn.unhighlight(context);$(this).addClass('current');if(typeof $.trackAction!='undefined')
 704+wrapper=context.$content;context.fn.scrollToTop(wrapper,true);context.$textarea.textSelection('setSelection',{'start':0,'startContainer':wrapper});context.fn.highlightLine($(wrapper));$.wikiEditor.modules.toc.fn.unhighlight(context);$(this).addClass('current');if(typeof $.trackAction!='undefined')
697705 $.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text);if(structure[i].text=='')
698706 div.html('&nbsp;');var item=$('<li />').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
699707 list.append(item);}
Index: trunk/extensions/UsabilityInitiative/Makefile
@@ -23,6 +23,7 @@
2424 js/plugins/jquery.autoEllipsis.js\
2525 js/plugins/jquery.browser.js\
2626 js/plugins/jquery.collapsibleTabs.js\
 27+ js/plugins/jquery.color.js\
2728 js/plugins/jquery.cookie.js\
2829 js/plugins/jquery.delayedBind.js\
2930 js/plugins/jquery.namespaceSelect.js\

Status & tagging log