http://www.mediawiki.org/wiki/Special:Code/MediaWiki/58445
Revision: 58445 Author: adam Date: 2009-11-02 21:48:42 +0000 (Mon, 02 Nov 2009) Log Message: ----------- 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 trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php trunk/extensions/UsabilityInitiative/css/combined.css trunk/extensions/UsabilityInitiative/css/combined.min.css trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js trunk/extensions/UsabilityInitiative/js/plugins.combined.js trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js Modified: trunk/extensions/UsabilityInitiative/NavigableTOC/NavigableTOC.php =================================================================== --- trunk/extensions/UsabilityInitiative/NavigableTOC/NavigableTOC.php 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/NavigableTOC/NavigableTOC.php 2009-11-02 21:48:42 UTC (rev 58445) @@ -30,7 +30,7 @@ $wgNavigableTOCCollapseEnable = true; // Bump the version number every time you change any of the .css/.js files -$wgNavigableTOCStyleVersion = 4; +$wgNavigableTOCStyleVersion = 5; /* Setup */ Modified: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php =================================================================== --- trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php 2009-11-02 21:48:42 UTC (rev 58445) @@ -22,15 +22,15 @@ array( 'src' => 'css/wikiEditor.css', 'version' => 4 ), array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 7 ), array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 2 ), - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 8 ), + array( 'src' => 'css/wikiEditor.toc.css', 'version' => 9 ), array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), ), 'combined' => array( - array( 'src' => 'css/combined.css', 'version' => 14 ), + array( 'src' => 'css/combined.css', 'version' => 15 ), array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), ), 'minified' => array( - array( 'src' => 'css/combined.min.css', 'version' => 14 ), + array( 'src' => 'css/combined.min.css', 'version' => 15 ), array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), ), ) @@ -72,7 +72,7 @@ array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ), array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 18 ), array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 8 ), - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 25 ), + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 26 ), array( 'src' => 'js/plugins/jquery.wikiEditor.code.js', 'version' => 1 ), ), 'combined' => array( Modified: trunk/extensions/UsabilityInitiative/css/combined.css =================================================================== --- trunk/extensions/UsabilityInitiative/css/combined.css 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/css/combined.css 2009-11-02 21:48:42 UTC (rev 58445) @@ -183,10 +183,16 @@ /* these first two should probably be conditionally applied */ /* suggestions for doing that welcome */ +.wikiEditor-ui-toc { + overflow-y:hidden; + position:relative; +} .wikiEditor-ui-toc ul { - width:132px; - float:left; + overflow-y:auto; + overflow-x:hidden; + height:100%; } + .wikiEditor-ui-toc ul ul { float:none; width:auto; @@ -194,7 +200,9 @@ #wikiEditor-ui-toc-collapse { height:100%; width:18px; - float:left; + position:absolute; + top:0; + left:0; } .wikiEditor-ui-toc-collapse-open { background:#f3f3f3 url(../images/wikiEditor/toc/close.png) 4px 50% no-repeat; Modified: trunk/extensions/UsabilityInitiative/css/combined.min.css =================================================================== --- trunk/extensions/UsabilityInitiative/css/combined.min.css 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/css/combined.min.css 2009-11-02 21:48:42 UTC (rev 58445) @@ -165,9 +165,14 @@ padding-bottom:0.5em; border-bottom:solid 1px #DDDDDD; } +.wikiEditor-ui-toc{ +overflow-y:hidden; +position:relative; +} .wikiEditor-ui-toc ul{ -width:132px; -float:left; +overflow-y:auto; +overflow-x:hidden; +height:100%; } .wikiEditor-ui-toc ul ul{ float:none; @@ -176,7 +181,9 @@ #wikiEditor-ui-toc-collapse{ height:100%; width:18px; -float:left; +position:absolute; +top:0; +left:0; } .wikiEditor-ui-toc-collapse-open{ background:#f3f3f3 url(../images/wikiEditor/toc/close.png) 4px 50% no-repeat; @@ -500,4 +507,4 @@ background-color:white; text-decoration:none; border-color:#a8d7f9; -} \ No newline at end of file +} Modified: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css =================================================================== --- trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css 2009-11-02 21:48:42 UTC (rev 58445) @@ -78,10 +78,16 @@ /* these first two should probably be conditionally applied */ /* suggestions for doing that welcome */ +.wikiEditor-ui-toc { + overflow-y:hidden; + position:relative; +} .wikiEditor-ui-toc ul { - width:132px; - float:left; + overflow-y:auto; + overflow-x:hidden; + height:100%; } + .wikiEditor-ui-toc ul ul { float:none; width:auto; @@ -89,7 +95,9 @@ #wikiEditor-ui-toc-collapse { height:100%; width:18px; - float:left; + position:absolute; + top:0; + left:0; } .wikiEditor-ui-toc-collapse-open { background:#f3f3f3 url(../images/wikiEditor/toc/close.png) 4px 50% no-repeat; Modified: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js 2009-11-02 21:48:42 UTC (rev 58445) @@ -162,6 +162,7 @@ return list; } 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' ) Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/js/plugins.combined.js 2009-11-02 21:48:42 UTC (rev 58445) @@ -2395,6 +2395,7 @@ return list; } 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' ) Modified: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js =================================================================== --- trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js 2009-11-02 21:35:05 UTC (rev 58444) +++ trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js 2009-11-02 21:48:42 UTC (rev 58445) @@ -154,7 +154,7 @@ div.html(' ');var item=$('<li></li>').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} list.append(item);} return list;} -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;} +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;} 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;} var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}} var endLevel=0;for(var c=text.length-1;c>=0;c--){if(text.charAt(c)=='='){endLevel++;}else{break;}} _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs