r55280 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55279‎ | r55280 | r55281 >
Date:22:05, 18 August 2009
Author:tparscal
Status:deferred
Tags:
Comment:
Added direction to compatibility check, taking IE7 with RTL out of the compatable set. Also fixed a layout issue with the TOC.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css (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.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.css
@@ -26,20 +26,18 @@
2727 width: 100%;
2828 line-height: 1em;
2929 background-color: #f3f3f3;
 30+ border: solid silver 1px;
3031 }
3132 body.rtl .wikiEditor-ui {
3233 float: right;
3334 }
3435 .wikiEditor-ui .wikiEditor-ui-bottom {
35 - position: relative;
36 - border: solid silver 1px;
37 - border-top-width: 0;
3836 width: 100%;
3937 }
4038 .wikiEditor-ui .wikiEditor-ui-top {
4139 position: relative;
42 - border: solid silver 1px;
4340 width: 100%;
 41+ border-bottom: solid silver 1px;
4442 }
4543 .ui-dialog-content fieldset table td {
4644 padding: 0.25em;
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toolbar.css
@@ -18,16 +18,11 @@
1919 display: none;
2020 float: left;
2121 width: 100%;
22 - margin-left: -1px;
23 - border-left: solid silver 1px;
24 - border-right: solid silver 1px;
2522 border-top: solid 1px #DDDDDD;
2623 background-color: #F3F3F3;
2724 }
2825 body.rtl .wikiEditor-ui-toolbar .sections .section {
2926 float: right;
30 - margin-left: auto;
31 - margin-right: -1px;
3227 }
3328 .wikiEditor-ui-toolbar .sections .loading {
3429 padding-top: 0.5em;
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css
@@ -1,19 +1,22 @@
22 /* wikiEditor toc module */
33
 4+.wikiEditor-ui-text {
 5+ border-right: solid silver 1px;
 6+}
 7+body.rtl .wikiEditor-ui-text {
 8+ border-right: none;
 9+ border-left: solid silver 1px;
 10+}
411 .wikiEditor-ui-toc {
5 - /* width is set dynamically */
6 - position: absolute;
7 - right: -1px;
8 - top: 0;
 12+ /* height and width are set dynamically */
 13+ float: right;
914 padding: 0;
10 - border-left: solid silver 1px;
1115 overflow: auto;
1216 }
1317 body.rtl .wikiEditor-ui-toc {
1418 right: auto;
1519 left: -1px;
1620 border-left: none;
17 - border-right: solid silver 1px;
1821 }
1922 .wikiEditor-ui-toc ul {
2023 padding: 0;
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -26,39 +26,40 @@
2727 width: 100%;
2828 line-height: 1em;
2929 background-color: #f3f3f3;
 30+ border: solid silver 1px;
3031 }
3132 body.rtl .wikiEditor-ui {
3233 float: right;
3334 }
3435 .wikiEditor-ui .wikiEditor-ui-bottom {
35 - position: relative;
36 - border: solid silver 1px;
37 - border-top-width: 0;
3836 width: 100%;
3937 }
4038 .wikiEditor-ui .wikiEditor-ui-top {
4139 position: relative;
42 - border: solid silver 1px;
4340 width: 100%;
 41+ border-bottom: solid silver 1px;
4442 }
4543 .ui-dialog-content fieldset table td {
4644 padding: 0.25em;
4745 }/* wikiEditor toc module */
4846
 47+.wikiEditor-ui-text {
 48+ border-right: solid silver 1px;
 49+}
 50+body.rtl .wikiEditor-ui-text {
 51+ border-right: none;
 52+ border-left: solid silver 1px;
 53+}
4954 .wikiEditor-ui-toc {
50 - /* width is set dynamically */
51 - position: absolute;
52 - right: -1px;
53 - top: 0;
 55+ /* height and width are set dynamically */
 56+ float: right;
5457 padding: 0;
55 - border-left: solid silver 1px;
5658 overflow: auto;
5759 }
5860 body.rtl .wikiEditor-ui-toc {
5961 right: auto;
6062 left: -1px;
6163 border-left: none;
62 - border-right: solid silver 1px;
6364 }
6465 .wikiEditor-ui-toc ul {
6566 padding: 0;
@@ -107,16 +108,11 @@
108109 display: none;
109110 float: left;
110111 width: 100%;
111 - margin-left: -1px;
112 - border-left: solid silver 1px;
113 - border-right: solid silver 1px;
114112 border-top: solid 1px #DDDDDD;
115113 background-color: #F3F3F3;
116114 }
117115 body.rtl .wikiEditor-ui-toolbar .sections .section {
118116 float: right;
119 - margin-left: auto;
120 - margin-right: -1px;
121117 }
122118 .wikiEditor-ui-toolbar .sections .loading {
123119 padding-top: 0.5em;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -21,37 +21,38 @@
2222 width:100%;
2323 line-height:1em;
2424 background-color:#f3f3f3;
 25+border:solid silver 1px;
2526 }
2627 body.rtl .wikiEditor-ui{
2728 float:right;
2829 }
2930 .wikiEditor-ui .wikiEditor-ui-bottom{
30 -position:relative;
31 -border:solid silver 1px;
32 -border-top-width:0;
3331 width:100%;
3432 }
3533 .wikiEditor-ui .wikiEditor-ui-top{
3634 position:relative;
37 -border:solid silver 1px;
3835 width:100%;
 36+border-bottom:solid silver 1px;
3937 }
4038 .ui-dialog-content fieldset table td{
4139 padding:0.25em;
4240 }
 41+.wikiEditor-ui-text{
 42+border-right:solid silver 1px;
 43+}
 44+body.rtl .wikiEditor-ui-text{
 45+border-right:none;
 46+border-left:solid silver 1px;
 47+}
4348 .wikiEditor-ui-toc{
44 -position:absolute;
45 -right:-1px;
46 -top:0;
 49+float:right;
4750 padding:0;
48 -border-left:solid silver 1px;
4951 overflow:auto;
5052 }
5153 body.rtl .wikiEditor-ui-toc{
5254 right:auto;
5355 left:-1px;
5456 border-left:none;
55 -border-right:solid silver 1px;
5657 }
5758 .wikiEditor-ui-toc ul{
5859 padding:0;
@@ -97,16 +98,11 @@
9899 display:none;
99100 float:left;
100101 width:100%;
101 -margin-left:-1px;
102 -border-left:solid silver 1px;
103 -border-right:solid silver 1px;
104102 border-top:solid 1px #DDDDDD;
105103 background-color:#F3F3F3;
106104 }
107105 body.rtl .wikiEditor-ui-toolbar .sections .section{
108106 float:right;
109 -margin-left:auto;
110 -margin-right:-1px;
111107 }
112108 .wikiEditor-ui-toolbar .sections .loading{
113109 padding-top:0.5em;
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js
@@ -16,8 +16,14 @@
1717 'modules': {},
1818 'instances': [],
1919 'isSupported': function() {
20 - var supportedBrowsers = { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 };
21 - return ( $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name] );
 20+ function isSupported( supportedBrowsers ) {
 21+ return $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name];
 22+ }
 23+ var supportedBrowsers = {
 24+ 'ltr': { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 },
 25+ 'rtl': { 'msie': 8, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }
 26+ };
 27+ return isSupported( supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] );
2228 }
2329 };
2430 $.fn.wikiEditor = function() {
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -34,10 +34,11 @@
3535 );
3636 // Make some css modifications to make room for the toc on the right...
3737 // Perhaps this could be configurable?
38 - context.modules.$toc.css( 'width', '12em' );
39 - context.$ui.find( '.wikiEditor-ui-text' ).css(
40 - ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em'
41 - );
 38+ context.modules.$toc
 39+ .css( 'width', '12em' )
 40+ .css( 'marginTop', -( context.$ui.find( '.wikiEditor-ui-bottom' ).height() ) );
 41+ context.$ui.find( '.wikiEditor-ui-text' )
 42+ .css( ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' );
4243 // Add the TOC to the document
4344 $.wikiEditor.modules.toc.fn.build( context );
4445 $.wikiEditor.modules.toc.fn.update( context );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -1041,8 +1041,14 @@
10421042 'modules': {},
10431043 'instances': [],
10441044 'isSupported': function() {
1045 - var supportedBrowsers = { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 };
1046 - return ( $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name] );
 1045+ function isSupported( supportedBrowsers ) {
 1046+ return $.browser.name in supportedBrowsers && $.browser.versionNumber >= supportedBrowsers[$.browser.name];
 1047+ }
 1048+ var supportedBrowsers = {
 1049+ 'ltr': { 'msie': 7, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 },
 1050+ 'rtl': { 'msie': 8, 'firefox': 2, 'opera': 9, 'safari': 3, 'chrome': 1, 'camino': 1 }
 1051+ };
 1052+ return isSupported( supportedBrowsers[$( 'body.rtl' ).size() ? 'rtl' : 'ltr'] );
10471053 }
10481054 };
10491055 $.fn.wikiEditor = function() {
@@ -1182,10 +1188,11 @@
11831189 );
11841190 // Make some css modifications to make room for the toc on the right...
11851191 // Perhaps this could be configurable?
1186 - context.modules.$toc.css( 'width', '12em' );
1187 - context.$ui.find( '.wikiEditor-ui-text' ).css(
1188 - ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em'
1189 - );
 1192+ context.modules.$toc
 1193+ .css( 'width', '12em' )
 1194+ .css( 'marginTop', -( context.$ui.find( '.wikiEditor-ui-bottom' ).height() ) );
 1195+ context.$ui.find( '.wikiEditor-ui-text' )
 1196+ .css( ( $( 'body.rtl' ).size() ? 'marginLeft' : 'marginRight' ), '12em' );
11901197 // Add the TOC to the document
11911198 $.wikiEditor.modules.toc.fn.build( context );
11921199 $.wikiEditor.modules.toc.fn.update( context );
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -108,14 +108,15 @@
109109 return($.os.name=='mac'?13:($.os.name=='linux'?15:16))*row;}
110110 return this.each(function(){$(this).focus();if(this.selectionStart||this.selectionStart=='0'){this.selectionStart=pos;this.selectionEnd=pos;$(this).scrollTop(getCaretScrollPosition(this));}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();var oldPos=$(this).getCaretPosition();var goBack=false;if(oldPos==pos){pos++;goBack=true;}
111111 range.moveToElementText(this);range.collapse();range.move('character',pos);range.select();this.scrollTop+=range.offsetTop;if(goBack){range.move('character',-1);range.select();}}
112 -$(this).trigger('scrollToPosition');});}});})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'isSupported':function(){var supportedBrowsers={'msie':7,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1};return($.browser.name in supportedBrowsers&&$.browser.versionNumber>=supportedBrowsers[$.browser.name]);}};$.fn.wikiEditor=function(){var context=$(this).data('context');if(typeof context!=='undefined'){arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);}
 112+$(this).trigger('scrollToPosition');});}});})(jQuery);(function($){$.wikiEditor={'modules':{},'instances':[],'isSupported':function(){function isSupported(supportedBrowsers){return $.browser.name in supportedBrowsers&&$.browser.versionNumber>=supportedBrowsers[$.browser.name];}
 113+var supportedBrowsers={'ltr':{'msie':7,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1},'rtl':{'msie':8,'firefox':2,'opera':9,'safari':3,'chrome':1,'camino':1}};return isSupported(supportedBrowsers[$('body.rtl').size()?'rtl':'ltr']);}};$.fn.wikiEditor=function(){var context=$(this).data('context');if(typeof context!=='undefined'){arguments=$.makeArray(arguments);if(arguments.length>0){var call=arguments.shift();if(call in context.api){context.api[call](context,arguments[0]==undefined?{}:arguments[0]);}
113114 return $(this).data('context',context);}
114115 return $(this);}
115116 var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
116117 if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}
117118 if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);}
118119 context.$textarea.scrollToCaretPosition(0);return $(this).data('context',context);};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;}
119 -context.modules.$toc=$('<div></div>').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');$.wikiEditor.modules.toc.fn.build(context,config);context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css('width','12em');context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.$textarea.bind('keyup encapsulateSelection',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});});},update:function(context){context.modules.$toc.find('a').removeClass('currentSelection');var position=context.$textarea.getCaretPosition();var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
 120+context.modules.$toc=$('<div></div>').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');$.wikiEditor.modules.toc.fn.build(context,config);context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css('width','12em').css('marginTop',-(context.$ui.find('.wikiEditor-ui-bottom').height()));context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.$textarea.bind('keyup encapsulateSelection',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});});},update:function(context){context.modules.$toc.find('a').removeClass('currentSelection');var position=context.$textarea.getCaretPosition();var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
120121 section=Math.max(0,section);}
121122 context.modules.$toc.find('a.section-'+section).addClass('currentSelection');}},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
122123 sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}}

Follow-up revisions

RevisionCommit summaryAuthorDate
r55284wmf-deployment: Merge parts of r55269 and r55280: autodetect whether the brow...catrope22:39, 18 August 2009

Status & tagging log