r58445 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r58444‎ | r58445 | r58446 >
Date:21:48, 2 November 2009
Author:adam
Status:deferred
Tags:
Comment:
Improvements to the collapsible TOC. Switching the side the arrow is on and altering a few css rules to prevent scrollbars from causing problems.
Modified paths:
  • /trunk/extensions/UsabilityInitiative/NavigableTOC/NavigableTOC.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.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.toc.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css
@@ -78,10 +78,16 @@
7979
8080 /* these first two should probably be conditionally applied */
8181 /* suggestions for doing that welcome */
 82+.wikiEditor-ui-toc {
 83+ overflow-y:hidden;
 84+ position:relative;
 85+}
8286 .wikiEditor-ui-toc ul {
83 - width:132px;
84 - float:left;
 87+ overflow-y:auto;
 88+ overflow-x:hidden;
 89+ height:100%;
8590 }
 91+
8692 .wikiEditor-ui-toc ul ul {
8793 float:none;
8894 width:auto;
@@ -89,7 +95,9 @@
9096 #wikiEditor-ui-toc-collapse {
9197 height:100%;
9298 width:18px;
93 - float:left;
 99+ position:absolute;
 100+ top:0;
 101+ left:0;
94102 }
95103 .wikiEditor-ui-toc-collapse-open {
96104 background:#f3f3f3 url(../images/wikiEditor/toc/close.png) 4px 50% no-repeat;
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -183,10 +183,16 @@
184184
185185 /* these first two should probably be conditionally applied */
186186 /* suggestions for doing that welcome */
 187+.wikiEditor-ui-toc {
 188+ overflow-y:hidden;
 189+ position:relative;
 190+}
187191 .wikiEditor-ui-toc ul {
188 - width:132px;
189 - float:left;
 192+ overflow-y:auto;
 193+ overflow-x:hidden;
 194+ height:100%;
190195 }
 196+
191197 .wikiEditor-ui-toc ul ul {
192198 float:none;
193199 width:auto;
@@ -194,7 +200,9 @@
195201 #wikiEditor-ui-toc-collapse {
196202 height:100%;
197203 width:18px;
198 - float:left;
 204+ position:absolute;
 205+ top:0;
 206+ left:0;
199207 }
200208 .wikiEditor-ui-toc-collapse-open {
201209 background:#f3f3f3 url(../images/wikiEditor/toc/close.png) 4px 50% no-repeat;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -165,9 +165,14 @@
166166 padding-bottom:0.5em;
167167 border-bottom:solid 1px #DDDDDD;
168168 }
 169+.wikiEditor-ui-toc{
 170+overflow-y:hidden;
 171+position:relative;
 172+}
169173 .wikiEditor-ui-toc ul{
170 -width:132px;
171 -float:left;
 174+overflow-y:auto;
 175+overflow-x:hidden;
 176+height:100%;
172177 }
173178 .wikiEditor-ui-toc ul ul{
174179 float:none;
@@ -176,7 +181,9 @@
177182 #wikiEditor-ui-toc-collapse{
178183 height:100%;
179184 width:18px;
180 -float:left;
 185+position:absolute;
 186+top:0;
 187+left:0;
181188 }
182189 .wikiEditor-ui-toc-collapse-open{
183190 background:#f3f3f3 url(../images/wikiEditor/toc/close.png) 4px 50% no-repeat;
@@ -500,4 +507,4 @@
501508 background-color:white;
502509 text-decoration:none;
503510 border-color:#a8d7f9;
504 -}
\ No newline at end of file
 511+}
Index: trunk/extensions/UsabilityInitiative/NavigableTOC/NavigableTOC.php
@@ -30,7 +30,7 @@
3131 $wgNavigableTOCCollapseEnable = true;
3232
3333 // Bump the version number every time you change any of the .css/.js files
34 -$wgNavigableTOCStyleVersion = 4;
 34+$wgNavigableTOCStyleVersion = 5;
3535
3636 /* Setup */
3737
Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -22,15 +22,15 @@
2323 array( 'src' => 'css/wikiEditor.css', 'version' => 4 ),
2424 array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 7 ),
2525 array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 2 ),
26 - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 8 ),
 26+ array( 'src' => 'css/wikiEditor.toc.css', 'version' => 9 ),
2727 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ),
2828 ),
2929 'combined' => array(
30 - array( 'src' => 'css/combined.css', 'version' => 14 ),
 30+ array( 'src' => 'css/combined.css', 'version' => 15 ),
3131 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ),
3232 ),
3333 'minified' => array(
34 - array( 'src' => 'css/combined.min.css', 'version' => 14 ),
 34+ array( 'src' => 'css/combined.min.css', 'version' => 15 ),
3535 array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ),
3636 ),
3737 )
@@ -72,7 +72,7 @@
7373 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ),
7474 array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 18 ),
7575 array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 8 ),
76 - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 25 ),
 76+ array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 26 ),
7777 array( 'src' => 'js/plugins/jquery.wikiEditor.code.js', 'version' => 1 ),
7878 ),
7979 'combined' => array(
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js
@@ -162,6 +162,7 @@
163163 return list;
164164 }
165165 function buildCollapseBar() {
 166+ $('.wikiEditor-ui-toc ul').css('width', '148px').css('margin-left', '19px').css('border-left', '1px solid #DDDDDD');
166167 var $collapseBar = $( '<div />' )
167168 .addClass( 'wikiEditor-ui-toc-collapse-open' )
168169 .attr( 'id', 'wikiEditor-ui-toc-collapse' )
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -2395,6 +2395,7 @@
23962396 return list;
23972397 }
23982398 function buildCollapseBar() {
 2399+ $('.wikiEditor-ui-toc ul').css('width', '148px').css('margin-left', '19px').css('border-left', '1px solid #DDDDDD');
23992400 var $collapseBar = $( '<div />' )
24002401 .addClass( 'wikiEditor-ui-toc-collapse-open' )
24012402 .attr( 'id', 'wikiEditor-ui-toc-collapse' )
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -154,7 +154,7 @@
155155 div.html('&nbsp;');var item=$('<li></li>').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));}
156156 list.append(item);}
157157 return list;}
158 -function buildCollapseBar(){var $collapseBar=$('<div />').addClass('wikiEditor-ui-toc-collapse-open').attr('id','wikiEditor-ui-toc-collapse').data('oWidth',$.wikiEditor.modules.toc.defaults.width).bind('mouseup',function(){var $e=$(this);var close=$e.hasClass('wikiEditor-ui-toc-collapse-open');if(close){$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-open');$e.parent().animate({'width':$e.outerWidth()},'fast',function(){$(this).find('ul:first').hide();}).prev().animate({'marginRight':$e.outerWidth()+1},'fast',function(){$('#wikiEditor-ui-toc-collapse').addClass('wikiEditor-ui-toc-collapse-closed');});}else{$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-closed');$e.siblings().show().parent().animate({'width':$e.data('oWidth')},'fast').prev().animate({'marginRight':$e.data('oWidth')},'fast',function(){$('#wikiEditor-ui-toc-collapse').addClass('wikiEditor-ui-toc-collapse-open');});}});return $collapseBar;}
 158+function buildCollapseBar(){$('.wikiEditor-ui-toc ul').css('width','148px').css('margin-left','19px').css('border-left','1px solid #DDDDDD');var $collapseBar=$('<div />').addClass('wikiEditor-ui-toc-collapse-open').attr('id','wikiEditor-ui-toc-collapse').data('oWidth',$.wikiEditor.modules.toc.defaults.width).bind('mouseup',function(){var $e=$(this);var close=$e.hasClass('wikiEditor-ui-toc-collapse-open');if(close){$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-open');$e.parent().animate({'width':$e.outerWidth()},'fast',function(){$(this).find('ul:first').hide();}).prev().animate({'marginRight':$e.outerWidth()+1},'fast',function(){$('#wikiEditor-ui-toc-collapse').addClass('wikiEditor-ui-toc-collapse-closed');});}else{$('#wikiEditor-ui-toc-collapse').removeClass('wikiEditor-ui-toc-collapse-closed');$e.siblings().show().parent().animate({'width':$e.data('oWidth')},'fast').prev().animate({'marginRight':$e.data('oWidth')},'fast',function(){$('#wikiEditor-ui-toc-collapse').addClass('wikiEditor-ui-toc-collapse-open');});}});return $collapseBar;}
159159 var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}[^=\n][^\n]*={1,6}\s*$/gm);var offset=0;headings=$.makeArray(headings);for(var h=0;h<headings.length;h++){text=$.trim(headings[h]);var position=wikitext.indexOf(text,offset);if(position>=offset){offset=position+text.length;}else if(position==-1){continue;}
160160 var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}}
161161 var endLevel=0;for(var c=text.length-1;c>=0;c--){if(text.charAt(c)=='='){endLevel++;}else{break;}}

Status & tagging log