Index: branches/usability/acaifix/CollapsibleTabs/CollapsibleTabs.php |
— | — | @@ -0,0 +1,41 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Usability Initiative CollapsibleTabs extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * |
| 9 | + * This file contains the include file for the CollapsibleTabs portion of the |
| 10 | + * UsabilityInitiative extension of MediaWiki. |
| 11 | + * |
| 12 | + * Usage: Include the following line in your LocalSettings.php |
| 13 | + * require_once( "$IP/extensions/UsabilityInitiative/CollapsibleTabs/CollapsibleTabs.php" ); |
| 14 | + * |
| 15 | + * @author Adam Miller <amiller@wikimedia.org> |
| 16 | + * @license GPL v2 or later |
| 17 | + * @version 0.0.7 |
| 18 | + */ |
| 19 | + |
| 20 | +/* Configuration */ |
| 21 | +// Bump the version number every time you change any of the .css/.js files |
| 22 | +$wgCollapsibleTabsStyleVersion = 8; |
| 23 | + |
| 24 | +/* Setup */ |
| 25 | + |
| 26 | +// Credits |
| 27 | +$wgExtensionCredits['other'][] = array( |
| 28 | + 'path' => __FILE__, |
| 29 | + 'name' => 'CollapsibleTabs', |
| 30 | + 'author' => 'Adam Miller', |
| 31 | + 'version' => '0.0.7', |
| 32 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:CollapsibleTabs', |
| 33 | + 'descriptionmsg' => 'collapsibletabs-desc', |
| 34 | +); |
| 35 | +// Includes parent extension |
| 36 | +require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative.php" ); |
| 37 | + |
| 38 | +// Adds Autoload Classes |
| 39 | +$wgAutoloadClasses['CollapsibleTabsHooks'] = |
| 40 | + dirname( __FILE__ ) . '/CollapsibleTabs.hooks.php'; |
| 41 | + |
| 42 | +$wgHooks['AjaxAddScript'][] = 'CollapsibleTabsHooks::initialize'; |
Property changes on: branches/usability/acaifix/CollapsibleTabs/CollapsibleTabs.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 43 | + native |
Index: branches/usability/acaifix/CollapsibleTabs/CollapsibleTabs.hooks.php |
— | — | @@ -0,0 +1,25 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Hooks for Usability Initiative Collapsing Tabs extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +class CollapsibleTabsHooks { |
| 11 | + |
| 12 | + /* Static Functions */ |
| 13 | + |
| 14 | + /** |
| 15 | + * intialize hook |
| 16 | + */ |
| 17 | + public static function initialize( $out ) { |
| 18 | + global $wgCollapsibleTabsStyleVersion; |
| 19 | + UsabilityInitiativeHooks::initialize(); |
| 20 | + UsabilityInitiativeHooks::addScript( |
| 21 | + 'CollapsibleTabs/CollapsibleTabs.js', $wgCollapsibleTabsStyleVersion |
| 22 | + ); |
| 23 | + return true; |
| 24 | + } |
| 25 | + |
| 26 | +} |
Property changes on: branches/usability/acaifix/CollapsibleTabs/CollapsibleTabs.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 27 | + native |
Index: branches/usability/acaifix/CollapsibleTabs/CollapsibleTabs.js |
— | — | @@ -0,0 +1,72 @@ |
| 2 | +js2AddOnloadHook( function() { |
| 3 | + |
| 4 | + var rtl = $j( 'body.rtl' ).size() ? true : false; |
| 5 | + |
| 6 | + //Overloading the moveToCollapsed function to animate the transition |
| 7 | + $j.collapsibleTabs.moveToCollapsed = function( ele ) { |
| 8 | + var $moving = $j(ele); |
| 9 | + $j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = true; |
| 10 | + var data = $moving.data('collapsibleTabsSettings'); |
| 11 | + // Remove the element from where it's at and put it in the dropdown menu |
| 12 | + var target = $moving.data('collapsibleTabsSettings').collapsedContainer; |
| 13 | + $moving.css("position", "relative").css( ( rtl ? 'left' : 'right'), 0 ); |
| 14 | + $moving.animate({width: '1px'},"normal",function(){ |
| 15 | + $j(this).hide(); |
| 16 | + // add the placeholder |
| 17 | + $j('<span class="placeholder" style="display:none;"></span>').insertAfter(this); |
| 18 | + $j(this).remove().prependTo(target).data('collapsibleTabsSettings', data); |
| 19 | + $j(this).attr('style', 'display:list-item;'); |
| 20 | + $j($j(ele).data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = false; |
| 21 | + $j.collapsibleTabs.handleResize(); |
| 22 | + }); |
| 23 | + }; |
| 24 | + |
| 25 | + // Overloading the moveToExpanded function to animate the transition |
| 26 | + $j.collapsibleTabs.moveToExpanded = function( ele ) { |
| 27 | + var $moving = $j(ele); |
| 28 | + $j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = true; |
| 29 | + var data = $moving.data('collapsibleTabsSettings'); |
| 30 | + // grab the next appearing placeholder so we can use it for replacing |
| 31 | + var $target = $j($moving.data('collapsibleTabsSettings').expandedContainer).find('span.placeholder:first'); |
| 32 | + var expandedWidth = $moving.data('collapsibleTabsSettings').expandedWidth; |
| 33 | + $moving.css("position", "relative").css( ( rtl ? 'right' : 'left'), 0 ).css('width','1px'); |
| 34 | + $target.replaceWith($moving.remove().css('width','1px').data('collapsibleTabsSettings', data) |
| 35 | + .animate({width: expandedWidth+"px"}, "normal", function(){ |
| 36 | + $j(this).attr('style', 'display:block;'); |
| 37 | + $j($moving.data('collapsibleTabsSettings').expandedContainer).data('collapsibleTabsSettings').shifting = false; |
| 38 | + $j.collapsibleTabs.handleResize(); |
| 39 | + })); |
| 40 | + }; |
| 41 | + |
| 42 | + // Bind callback functions to animate our drop down menu in and out |
| 43 | + // and then call the collapsibleTabs function on the menu |
| 44 | + $j('#p-views ul').bind("beforeTabCollapse", function(){ |
| 45 | + if($j('#p-cactions').css('display')=='none') |
| 46 | + $j("#p-cactions").addClass("filledPortlet").removeClass("emptyPortlet") |
| 47 | + .find('h5').css('width','1px').animate({'width':'26px'}, 390); |
| 48 | + }).bind("beforeTabExpand", function(){ |
| 49 | + if($j('#p-cactions li').length==1) |
| 50 | + $j("#p-cactions h5").animate({'width':'1px'},370, function(){ |
| 51 | + $j(this).attr('style','').parent().addClass("emptyPortlet").removeClass("filledPortlet"); |
| 52 | + }); |
| 53 | + }).collapsibleTabs({ |
| 54 | + expandCondition: function(eleWidth) { |
| 55 | + if( rtl ){ |
| 56 | + return ( $j('#right-navigation').position().left + $j('#right-navigation').width()) |
| 57 | + < ($j('#left-navigation').position().left - eleWidth); |
| 58 | + } else { |
| 59 | + return ( $j('#left-navigation').position().left + $j('#left-navigation').width()) |
| 60 | + < ($j('#right-navigation').position().left - eleWidth); |
| 61 | + } |
| 62 | + }, |
| 63 | + collapseCondition: function() { |
| 64 | + if( rtl ){ |
| 65 | + return ( $j('#right-navigation').position().left + $j('#right-navigation').width()) |
| 66 | + > $j('#left-navigation').position().left; |
| 67 | + } else { |
| 68 | + return ( $j('#left-navigation').position().left + $j('#left-navigation').width()) |
| 69 | + > $j('#right-navigation').position().left; |
| 70 | + } |
| 71 | + } |
| 72 | + }); |
| 73 | +}); |
\ No newline at end of file |
Property changes on: branches/usability/acaifix/CollapsibleTabs/CollapsibleTabs.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 74 | + native |
Index: branches/usability/acaifix/UsabilityInitiative.hooks.php |
— | — | @@ -20,17 +20,17 @@ |
21 | 21 | 'raw' => array( |
22 | 22 | array( 'src' => 'css/suggestions.css', 'version' => 6 ), |
23 | 23 | array( 'src' => 'css/wikiEditor.css', 'version' => 4 ), |
24 | | - array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 6 ), |
| 24 | + array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 7 ), |
25 | 25 | array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 2 ), |
26 | | - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 6 ), |
| 26 | + array( 'src' => 'css/wikiEditor.toc.css', 'version' => 10 ), |
27 | 27 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), |
28 | 28 | ), |
29 | 29 | 'combined' => array( |
30 | | - array( 'src' => 'css/combined.css', 'version' => 11 ), |
| 30 | + array( 'src' => 'css/combined.css', 'version' => 16 ), |
31 | 31 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), |
32 | 32 | ), |
33 | 33 | 'minified' => array( |
34 | | - array( 'src' => 'css/combined.min.css', 'version' => 11 ), |
| 34 | + array( 'src' => 'css/combined.min.css', 'version' => 16 ), |
35 | 35 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2' ), |
36 | 36 | ), |
37 | 37 | ) |
— | — | @@ -58,23 +58,24 @@ |
59 | 59 | 'base_sets' => array( |
60 | 60 | 'raw' => array( |
61 | 61 | array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ), |
62 | | - array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 3 ), |
| 62 | + array( 'src' => 'js/plugins/jquery.autoEllipse.js', 'version' => 4 ), |
63 | 63 | array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 3 ), |
| 64 | + array( 'src' => 'js/plugins/jquery.collapsibleTabs.js', 'version' => 5 ), |
64 | 65 | array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ), |
65 | 66 | array( 'src' => 'js/plugins/jquery.delayedBind.js', 'version' => 1 ), |
66 | 67 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
67 | | - array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 4 ), |
68 | | - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 16 ), |
| 68 | + array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
| 69 | + array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 17 ), |
69 | 70 | array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 12 ), |
70 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 12 ), |
71 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 5 ), |
72 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 20 ), |
| 71 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 18 ), |
| 72 | + array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 8 ), |
| 73 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 27 ), |
73 | 74 | ), |
74 | 75 | 'combined' => array( |
75 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 44 ), |
| 76 | + array( 'src' => 'js/plugins.combined.js', 'version' => 60 ), |
76 | 77 | ), |
77 | 78 | 'minified' => array( |
78 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 44 ), |
| 79 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 60 ), |
79 | 80 | ), |
80 | 81 | ), |
81 | 82 | ); |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/indent.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/format-subscript.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/format-bold.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/png24/format-big.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/png24/format-italic.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/png24/format-small.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/png24/insert-newline.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/png24/format-subscript.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/png24/format-bold.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/png24/format-superscript.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/format-indent.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: branches/usability/acaifix/images/wikiEditor/toolbar/format-indent.png |
___________________________________________________________________ |
Added: svn:mime-type |
82 | 83 | + application/octet-stream |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/format-superscript.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/format-big.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/format-italic.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/images/wikiEditor/toolbar/format-small.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Index: branches/usability/acaifix/EditToolbar/EditToolbar.js |
— | — | @@ -147,10 +147,12 @@ |
148 | 148 | 'heading-2' : { |
149 | 149 | labelMsg: 'edittoolbar-tool-heading-2', |
150 | 150 | action: { |
151 | | - type: 'encapsulate', |
| 151 | + type: 'replace', |
152 | 152 | options: { |
153 | 153 | pre: "==", |
154 | 154 | periMsg: 'edittoolbar-tool-heading-example', |
| 155 | + periRegex: /^(={1,6})(.*?)\1\s*$/, |
| 156 | + periRegexReplace: "\$2", |
155 | 157 | post: "==" |
156 | 158 | } |
157 | 159 | } |
— | — | @@ -158,9 +160,11 @@ |
159 | 161 | 'heading-3' : { |
160 | 162 | labelMsg: 'edittoolbar-tool-heading-3', |
161 | 163 | action: { |
162 | | - type: 'encapsulate', |
| 164 | + type: 'replace', |
163 | 165 | options: { |
164 | | - pre: "===", |
| 166 | + pre: "===", |
| 167 | + periRegex: /^(={1,6})(.*?)\1\s*$/, |
| 168 | + periRegexReplace: "\$2", |
165 | 169 | periMsg: 'edittoolbar-tool-heading-example', |
166 | 170 | post: "===" |
167 | 171 | } |
— | — | @@ -169,9 +173,11 @@ |
170 | 174 | 'heading-4' : { |
171 | 175 | labelMsg: 'edittoolbar-tool-heading-4', |
172 | 176 | action: { |
173 | | - type: 'encapsulate', |
| 177 | + type: 'replace', |
174 | 178 | options: { |
175 | | - pre: "====", |
| 179 | + pre: "====", |
| 180 | + periRegex: /^(={1,6})(.*?)\1\s*$/, |
| 181 | + periRegexReplace: "\$2", |
176 | 182 | periMsg: 'edittoolbar-tool-heading-example', |
177 | 183 | post: "====" |
178 | 184 | } |
— | — | @@ -180,9 +186,11 @@ |
181 | 187 | 'heading-5' : { |
182 | 188 | labelMsg: 'edittoolbar-tool-heading-5', |
183 | 189 | action: { |
184 | | - type: 'encapsulate', |
| 190 | + type: 'replace', |
185 | 191 | options: { |
186 | | - pre: "=====", |
| 192 | + pre: "=====", |
| 193 | + periRegex: /^(={1,6})(.*?)\1\s*$/, |
| 194 | + periRegexReplace: "\$2", |
187 | 195 | periMsg: 'edittoolbar-tool-heading-example', |
188 | 196 | post: "=====" |
189 | 197 | } |
— | — | @@ -222,6 +230,19 @@ |
223 | 231 | ownline: true |
224 | 232 | } |
225 | 233 | } |
| 234 | + }, |
| 235 | + 'indent': { |
| 236 | + labelMsg: 'edittoolbar-tool-indent', |
| 237 | + type: 'button', |
| 238 | + icon: 'format-indent.png', |
| 239 | + action: { |
| 240 | + type: 'encapsulate', |
| 241 | + options: { |
| 242 | + pre: ":", |
| 243 | + post: "", |
| 244 | + ownline: true |
| 245 | + } |
| 246 | + } |
226 | 247 | } |
227 | 248 | } |
228 | 249 | }, |
— | — | @@ -820,14 +841,17 @@ |
821 | 842 | 'format': 'json' |
822 | 843 | }, |
823 | 844 | success: function( data ) { |
824 | | - // TODO: What happens if data.query.pageids is undefined? |
825 | | - var page = data.query.pages[data.query.pageids[0]]; |
826 | | - var status = 'exists'; |
827 | | - if ( typeof page.missing != 'undefined' ) |
828 | | - status = 'notexists'; |
829 | | - else if ( typeof page.invalid != 'undefined' ) |
| 845 | + var status; |
| 846 | + if ( typeof data.query == 'undefined' ) { |
830 | 847 | status = 'invalid'; |
831 | | - |
| 848 | + } else { |
| 849 | + var page = data.query.pages[data.query.pageids[0]]; |
| 850 | + status = 'exists'; |
| 851 | + if ( typeof page.missing != 'undefined' ) |
| 852 | + status = 'notexists'; |
| 853 | + else if ( typeof page.invalid != 'undefined' ) |
| 854 | + status = 'invalid'; |
| 855 | + } |
832 | 856 | cache[target] = status; |
833 | 857 | updateWidget( status ); |
834 | 858 | } |
— | — | @@ -1190,12 +1214,12 @@ |
1191 | 1215 | <div id="edittoolbar-replace-emptysearch" rel="edittoolbar-tool-replace-emptysearch"></div>\ |
1192 | 1216 | <div id="edittoolbar-replace-invalidregex"></div>\ |
1193 | 1217 | </div>\ |
1194 | | - <fieldset><table><tr>\ |
| 1218 | + <fieldset><table style="width: 100%;"><tr>\ |
1195 | 1219 | <td><label for="edittoolbar-replace-search" rel="edittoolbar-tool-replace-search"></label></td>\ |
1196 | | - <td><input type="text" id="edittoolbar-replace-search" /></td>\ |
| 1220 | + <td><input type="text" id="edittoolbar-replace-search" style="width: 100%;" /></td>\ |
1197 | 1221 | </tr><tr>\ |
1198 | 1222 | <td><label for="edittoolbar-replace-replace" rel="edittoolbar-tool-replace-replace"></label></td>\ |
1199 | | - <td><input type="text" id="edittoolbar-replace-replace" /></td>\ |
| 1223 | + <td><input type="text" id="edittoolbar-replace-replace" style="width: 100%;" /></td>\ |
1200 | 1224 | </tr></table><table><tr>\ |
1201 | 1225 | <td><input type="checkbox" id="edittoolbar-replace-case" /></td>\ |
1202 | 1226 | <td><label for="edittoolbar-replace-case" rel="edittoolbar-tool-replace-case"></label></td>\ |
— | — | @@ -1226,7 +1250,7 @@ |
1227 | 1251 | return; |
1228 | 1252 | } |
1229 | 1253 | var replaceStr = $j( '#edittoolbar-replace-replace' ).val(); |
1230 | | - var flags = ''; |
| 1254 | + var flags = 'm'; |
1231 | 1255 | var matchCase = $j( '#edittoolbar-replace-case' ).is( ':checked' ); |
1232 | 1256 | var isRegex = $j( '#edittoolbar-replace-regex' ).is( ':checked' ); |
1233 | 1257 | if ( !matchCase ) { |
— | — | @@ -1318,8 +1342,8 @@ |
1319 | 1343 | $j(this).data( 'offset', 0 ); |
1320 | 1344 | $j( '#edittoolbar-replace-search' ).focus(); |
1321 | 1345 | $j( '#edittoolbar-replace-nomatch, #edittoolbar-replace-success, #edittoolbar-replace-emptysearch, #edittoolbar-replace-invalidregex' ).hide(); |
1322 | | - if ( !( $j(this).data( 'dialogkeypressset' ) ) ) { |
1323 | | - $j(this).data( 'dialogkeypressset', true ); |
| 1346 | + if ( !( $j(this).data( 'onetimeonlystuff' ) ) ) { |
| 1347 | + $j(this).data( 'onetimeonlystuff', true ); |
1324 | 1348 | // Execute the action associated with the first button |
1325 | 1349 | // when the user presses Enter |
1326 | 1350 | $j(this).closest( '.ui-dialog' ).keypress( function( e ) { |
— | — | @@ -1328,6 +1352,11 @@ |
1329 | 1353 | e.preventDefault(); |
1330 | 1354 | } |
1331 | 1355 | }); |
| 1356 | + // Make tabbing to a button and pressing |
| 1357 | + // Enter do what people expect |
| 1358 | + $j(this).closest( '.ui-dialog' ).find( 'button' ).focus( function() { |
| 1359 | + $j(this).closest( '.ui-dialog' ).data( 'dialogaction', this ); |
| 1360 | + }); |
1332 | 1361 | } |
1333 | 1362 | var dialog = $j(this).closest( '.ui-dialog' ); |
1334 | 1363 | $j(this).data( 'context' ).$textarea.bind( 'keypress.srdialog', function( e ) { |
Index: branches/usability/acaifix/EditToolbar/EditToolbar.i18n.php |
— | — | @@ -42,6 +42,7 @@ |
43 | 43 | 'edittoolbar-tool-link-int-target-status-loading' => 'Checking page existence...', |
44 | 44 | 'edittoolbar-tool-link-int-invalid' => 'The title you specified is invalid.', |
45 | 45 | 'edittoolbar-tool-link-ext-invalid' => 'The URL you specified is invalid.', |
| 46 | + 'edittoolbar-tool-link-empty' => "You didn't enter anything to link to.", |
46 | 47 | 'edittoolbar-tool-file' => 'Embedded file', |
47 | 48 | 'edittoolbar-tool-file-pre' => '$1{{ns:file}}:', |
48 | 49 | 'edittoolbar-tool-file-example' => 'Example.jpg', |
Index: branches/usability/acaifix/EditToolbar/EditToolbar.php |
— | — | @@ -13,13 +13,13 @@ |
14 | 14 | * |
15 | 15 | * @author Trevor Parscal <tparscal@wikimedia.org>, Roan Kattouw <roan.kattouw@gmail.com> |
16 | 16 | * @license GPL v2 or later |
17 | | - * @version 0.1.1 |
| 17 | + * @version 0.1.3 |
18 | 18 | */ |
19 | 19 | |
20 | 20 | /* Configuration */ |
21 | 21 | |
22 | 22 | // Bump the version number every time you change any of the .css/.js files |
23 | | -$wgEditToolbarStyleVersion = 58; |
| 23 | +$wgEditToolbarStyleVersion = 72; |
24 | 24 | |
25 | 25 | // Set this to true to simply override the stock toolbar for everyone |
26 | 26 | $wgEditToolbarGlobalEnable = false; |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | 'path' => __FILE__, |
50 | 50 | 'name' => 'EditToolbar', |
51 | 51 | 'author' => 'Trevor Parscal', |
52 | | - 'version' => '0.1.1', |
| 52 | + 'version' => '0.1.3', |
53 | 53 | 'url' => 'http://www.mediawiki.org/wiki/Extension:UsabilityInitiative', |
54 | 54 | 'descriptionmsg' => 'edittoolbar-desc', |
55 | 55 | ); |
Index: branches/usability/acaifix/EditToolbar/EditToolbar.hooks.php |
— | — | @@ -60,6 +60,7 @@ |
61 | 61 | 'edittoolbar-tool-link-int-target-status-loading', |
62 | 62 | 'edittoolbar-tool-link-int-invalid', |
63 | 63 | 'edittoolbar-tool-link-ext-invalid', |
| 64 | + 'edittoolbar-tool-link-empty', |
64 | 65 | 'edittoolbar-tool-file', |
65 | 66 | 'edittoolbar-tool-file-pre', |
66 | 67 | 'edittoolbar-tool-file-example', |
Index: branches/usability/acaifix/js/plugins/jquery.suggestions.js |
— | — | @@ -163,7 +163,7 @@ |
164 | 164 | * @param updateTextbox If true, put the suggestion in the textbox |
165 | 165 | */ |
166 | 166 | highlight: function( context, result, updateTextbox ) { |
167 | | - var selected = context.data.$container.find( '.suggestions-result-current' ) |
| 167 | + var selected = context.data.$container.find( '.suggestions-result-current' ); |
168 | 168 | if ( !result.get || selected.get( 0 ) != result.get( 0 ) ) { |
169 | 169 | if ( result == 'prev' ) { |
170 | 170 | result = selected.prev(); |
— | — | @@ -232,6 +232,12 @@ |
233 | 233 | case 13: |
234 | 234 | context.data.$container.hide(); |
235 | 235 | preventDefault = wasVisible; |
| 236 | + if ( typeof context.config.result.select == 'function' ) { |
| 237 | + context.config.result.select.call( |
| 238 | + context.data.$container.find( '.suggestions-result-current' ), |
| 239 | + context.data.$textbox |
| 240 | + ); |
| 241 | + } |
236 | 242 | break; |
237 | 243 | default: |
238 | 244 | $.suggestions.update( context, true ); |
Index: branches/usability/acaifix/js/plugins/jquery.textSelection.js |
— | — | @@ -3,12 +3,17 @@ |
4 | 4 | */ |
5 | 5 | ( function( $ ) { $.fn.extend( { |
6 | 6 | |
| 7 | +/** |
| 8 | + * Get the currently selected text in this textarea. Will focus the textarea |
| 9 | + * in some browsers (IE/Opera) |
| 10 | + */ |
7 | 11 | getSelection: function() { |
8 | 12 | var e = this.jquery ? this[0] : this; |
9 | 13 | var retval = ''; |
10 | 14 | if ( e.style.display == 'none' ) { |
11 | 15 | // Do nothing |
12 | 16 | } else if ( document.selection && document.selection.createRange ) { |
| 17 | + e.focus(); |
13 | 18 | var range = document.selection.createRange(); |
14 | 19 | retval = range.text; |
15 | 20 | } else if ( e.selectionStart || e.selectionStart == '0' ) { |
Index: branches/usability/acaifix/js/plugins/jquery.wikiEditor.toolbar.js |
— | — | @@ -222,6 +222,13 @@ |
223 | 223 | parts[part] = ( action.options[part] || '' ) |
224 | 224 | } |
225 | 225 | } |
| 226 | + if ( 'periRegex' in action.options && 'periRegexReplace' in action.options ) { |
| 227 | + var selection = context.$textarea.getSelection(); |
| 228 | + if ( selection != '' ) { |
| 229 | + parts.peri = selection.replace( action.options.periRegex, |
| 230 | + action.options.periRegexReplace ); |
| 231 | + } |
| 232 | + } |
226 | 233 | context.$textarea.encapsulateSelection( |
227 | 234 | parts.pre, parts.peri, parts.post, action.options.ownline, action.type == 'replace' |
228 | 235 | ); |
— | — | @@ -326,25 +333,23 @@ |
327 | 334 | .text( label ) |
328 | 335 | .attr( 'rel', id ) |
329 | 336 | .data( 'context', context ) |
330 | | - .click( |
331 | | - function() { |
332 | | - |
333 | | - $(this).parent().parent().find( '.page' ).hide(); |
334 | | - $(this).parent().parent().find( '.page-' + $(this).attr( 'rel' ) ).show(); |
335 | | - $(this).siblings().removeClass( 'current' ); |
336 | | - $(this).addClass( 'current' ); |
337 | | - var section = $(this).parent().parent().attr( 'rel' ); |
338 | | - |
339 | | - //click tracking |
340 | | - if($.trackAction != undefined){ |
341 | | - $.trackAction(section + '.' + $(this).attr('rel')); |
342 | | - } |
343 | | - |
344 | | - $.cookie( |
345 | | - 'wikiEditor-' + $(this).data( 'context' ).instance + '-booklet-' + section + '-page', |
346 | | - $(this).attr( 'rel' ) |
347 | | - ); |
348 | | - } ); |
| 337 | + .bind( 'mousedown', function() { |
| 338 | + $(this).parent().parent().find( '.page' ).hide(); |
| 339 | + $(this).parent().parent().find( '.page-' + $(this).attr( 'rel' ) ).show(); |
| 340 | + $(this).siblings().removeClass( 'current' ); |
| 341 | + $(this).addClass( 'current' ); |
| 342 | + var section = $(this).parent().parent().attr( 'rel' ); |
| 343 | + |
| 344 | + //click tracking |
| 345 | + if($.trackAction != undefined){ |
| 346 | + $.trackAction(section + '.' + $(this).attr('rel')); |
| 347 | + } |
| 348 | + |
| 349 | + $.cookie( |
| 350 | + 'wikiEditor-' + $(this).data( 'context' ).instance + '-booklet-' + section + '-page', |
| 351 | + $(this).attr( 'rel' ) |
| 352 | + ); |
| 353 | + } ); |
349 | 354 | }, |
350 | 355 | buildPage : function( context, id, page ) { |
351 | 356 | var $page = $( '<div />' ).attr( { |
— | — | @@ -451,22 +456,34 @@ |
452 | 457 | .attr( 'href', '#' ) |
453 | 458 | .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
454 | 459 | .data( 'context', context ) |
455 | | - .click( function() { |
| 460 | + .bind( 'mouseup', function( e ) { |
| 461 | + $(this).blur(); |
| 462 | + } ) |
| 463 | + .bind( 'mousedown', function( e ) { |
| 464 | + // Only act when the primary mouse button was pressed |
| 465 | + if ( e.button !== 0 ) { |
| 466 | + return true; |
| 467 | + } |
456 | 468 | var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
457 | 469 | var $section = |
458 | 470 | $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
459 | | - $(this).blur(); |
460 | 471 | var show = $section.css( 'display' ) == 'none'; |
461 | 472 | $previousSections = $section.parent().find( '.section:visible' ); |
462 | 473 | $previousSections.css( 'position', 'absolute' ); |
463 | 474 | $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
464 | 475 | $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
| 476 | + $sections.css('overflow', 'hidden'); |
465 | 477 | if ( show ) { |
466 | 478 | $section.fadeIn( 'fast' ); |
467 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 479 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() { |
| 480 | + $(this).css('overflow', 'visible').css('height', 'auto'); |
| 481 | + } ); |
468 | 482 | $(this).addClass( 'current' ); |
469 | 483 | } else { |
470 | | - $sections.animate( { 'height': 0 } ); |
| 484 | + $sections.css('height', $section.outerHeight() ) |
| 485 | + .animate( { 'height': 0 }, $section.outerHeight() * 2, function() { |
| 486 | + $(this).css('overflow', 'visible'); |
| 487 | + } ); |
471 | 488 | } |
472 | 489 | // Click tracking |
473 | 490 | if($.trackAction != undefined){ |
— | — | @@ -477,8 +494,8 @@ |
478 | 495 | 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
479 | 496 | show ? $section.attr( 'rel' ) : null |
480 | 497 | ); |
481 | | - return false; |
482 | 498 | } ) |
| 499 | + .click( function() { return false; } ) |
483 | 500 | ); |
484 | 501 | }, |
485 | 502 | buildSection : function( context, id, section ) { |
— | — | @@ -567,7 +584,7 @@ |
568 | 585 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
569 | 586 | var $section = s.$sections.find( '.section:visible' ); |
570 | 587 | if ( $section.size() ) { |
571 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 588 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
572 | 589 | } |
573 | 590 | } |
574 | 591 | } ); |
Index: branches/usability/acaifix/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -1,6 +1,4 @@ |
2 | | -/** |
3 | | - * TOC Module for wikiEditor |
4 | | - */ |
| 2 | +/* TOC Module for wikiEditor */ |
5 | 3 | ( function( $ ) { $.wikiEditor.modules.toc = { |
6 | 4 | |
7 | 5 | /** |
— | — | @@ -41,7 +39,7 @@ |
42 | 40 | // Add the TOC to the document |
43 | 41 | $.wikiEditor.modules.toc.fn.build( context, config ); |
44 | 42 | context.$textarea |
45 | | - .delayedBind( 1000, 'keyup encapsulateSelection change', |
| 43 | + .delayedBind( 250, 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
46 | 44 | function( event ) { |
47 | 45 | var context = $(this).data( 'wikiEditor-context' ); |
48 | 46 | $(this).eachAsync( { |
— | — | @@ -53,25 +51,16 @@ |
54 | 52 | } ); |
55 | 53 | } |
56 | 54 | ) |
57 | | - .bind( 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
58 | | - function( event ) { |
59 | | - var context = $(this).data( 'wikiEditor-context' ); |
60 | | - $(this).eachAsync( { |
61 | | - bulk: 0, |
62 | | - loop: function() { |
63 | | - $.wikiEditor.modules.toc.fn.update( context ); |
64 | | - } |
65 | | - } ); |
66 | | - } |
67 | | - ) |
68 | 55 | .blur( function() { |
69 | 56 | var context = $(this).data( 'wikiEditor-context' ); |
| 57 | + context.$textarea.delayedBindCancel( 250, |
| 58 | + 'mouseup scrollToPosition focus keyup encapsulateSelection change' ); |
70 | 59 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
71 | 60 | }); |
72 | 61 | }, |
73 | 62 | |
74 | 63 | unhighlight: function( context ) { |
75 | | - context.modules.$toc.find( 'a' ).removeClass( 'currentSelection' ); |
| 64 | + context.modules.$toc.find( 'div' ).removeClass( 'current' ); |
76 | 65 | }, |
77 | 66 | /** |
78 | 67 | * Highlight the section the cursor is currently within |
— | — | @@ -95,8 +84,8 @@ |
96 | 85 | } |
97 | 86 | section = Math.max( 0, section ); |
98 | 87 | } |
99 | | - var sectionLink = context.modules.$toc.find( 'a.section-' + section ); |
100 | | - sectionLink.addClass( 'currentSelection' ); |
| 88 | + var sectionLink = context.modules.$toc.find( 'div.section-' + section ); |
| 89 | + sectionLink.addClass( 'current' ); |
101 | 90 | |
102 | 91 | // Scroll the highlighted link into view if necessary |
103 | 92 | var relTop = sectionLink.offset().top - context.modules.$toc.offset().top; |
— | — | @@ -145,26 +134,26 @@ |
146 | 135 | * @param {Object} structure Structured outline |
147 | 136 | */ |
148 | 137 | function buildList( structure ) { |
149 | | - var list = $( '<ul />' ); |
| 138 | + var list = $( '<ul></ul>' ); |
150 | 139 | for ( i in structure ) { |
151 | | - var item = $( '<li />' ) |
152 | | - .append( |
153 | | - $( '<a />' ) |
154 | | - .attr( 'href', '#' ) |
155 | | - .addClass( 'section-' + structure[i].index ) |
156 | | - .data( 'textbox', context.$textarea ) |
157 | | - .data( 'position', structure[i].position ) |
158 | | - .click( function( event ) { |
159 | | - $(this).data( 'textbox' ) |
160 | | - .focus() |
161 | | - .setSelection( $(this).data( 'position' ) ) |
162 | | - .scrollToCaretPosition( true ); |
163 | | - if ( typeof $.trackAction != 'undefined' ) |
164 | | - $.trackAction( 'ntoc.heading' ); |
165 | | - event.preventDefault(); |
166 | | - } ) |
167 | | - .text( structure[i].text ) |
168 | | - ); |
| 140 | + var div = $( '<div></div>' ) |
| 141 | + .attr( 'href', '#' ) |
| 142 | + .addClass( 'section-' + structure[i].index ) |
| 143 | + .data( 'textbox', context.$textarea ) |
| 144 | + .data( 'position', structure[i].position ) |
| 145 | + .bind( 'mousedown', function( event ) { |
| 146 | + $(this).data( 'textbox' ) |
| 147 | + .focus() |
| 148 | + .setSelection( $(this).data( 'position' ) ) |
| 149 | + .scrollToCaretPosition( true ); |
| 150 | + if ( typeof $.trackAction != 'undefined' ) |
| 151 | + $.trackAction( 'ntoc.heading' ); |
| 152 | + event.preventDefault(); |
| 153 | + } ) |
| 154 | + .text( structure[i].text ); |
| 155 | + if ( structure[i].text == '' ) |
| 156 | + div.html( ' ' ); |
| 157 | + var item = $( '<li></li>' ).append( div ); |
169 | 158 | if ( structure[i].sections !== undefined ) { |
170 | 159 | item.append( buildList( structure[i].sections ) ); |
171 | 160 | } |
— | — | @@ -175,7 +164,7 @@ |
176 | 165 | // Build outline from wikitext |
177 | 166 | var outline = []; |
178 | 167 | var wikitext = $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ); |
179 | | - var headings = wikitext.match( /^={1,6}.+={1,6}\s*$/gm ); |
| 168 | + var headings = wikitext.match( /^={1,6}[^=\n][^\n]*={1,6}\s*$/gm ); |
180 | 169 | var offset = 0; |
181 | 170 | headings = $.makeArray( headings ); |
182 | 171 | for ( var h = 0; h < headings.length; h++ ) { |
— | — | @@ -235,18 +224,11 @@ |
236 | 225 | // Recursively build the structure and add special item for |
237 | 226 | // section 0, if needed |
238 | 227 | var structure = buildStructure( outline ); |
239 | | - if ( $( 'input[name=wpSection]' ).val() == '' ) |
| 228 | + if ( $( 'input[name=wpSection]' ).val() == '' ) { |
240 | 229 | structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } ); |
| 230 | + } |
241 | 231 | context.modules.$toc.html( buildList( structure ) ); |
242 | | - |
243 | | - context.modules.$toc.find( 'ul' ).css( 'width', '10em' ); |
244 | | - |
245 | | - var links = context.modules.$toc.find( 'ul a' ); |
246 | | - // Highlighted links are wider; autoEllipse links in |
247 | | - // highlighted state |
248 | | - links.addClass( 'currentSelection' ); |
249 | | - links.autoEllipse( { 'position': 'right', 'tooltip': true } ); |
250 | | - links.removeClass( 'currentSelection' ); |
| 232 | + context.modules.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } ); |
251 | 233 | // Cache the outline for later use |
252 | 234 | context.data.outline = outline; |
253 | 235 | } |
Index: branches/usability/acaifix/js/plugins/jquery.wikiEditor.editor.js |
— | — | @@ -0,0 +1,202 @@ |
| 2 | +/** |
| 3 | + * TOC Module for wikiEditor |
| 4 | + */ |
| 5 | +( function( $ ) { $.wikiEditor.modules.$editor = { |
| 6 | + |
| 7 | +/** |
| 8 | + * API accessible functions |
| 9 | + */ |
| 10 | +api: { |
| 11 | + // |
| 12 | +}, |
| 13 | +/** |
| 14 | + * |
| 15 | + */ |
| 16 | +languages: { |
| 17 | + csharp : 'C#', |
| 18 | + css : 'CSS', |
| 19 | + generic : 'Generic', |
| 20 | + html : 'HTML', |
| 21 | + java : 'Java', |
| 22 | + javascript : 'JavaScript', |
| 23 | + perl : 'Perl', |
| 24 | + ruby : 'Ruby', |
| 25 | + php : 'PHP', |
| 26 | + text : 'Text', |
| 27 | + sql : 'SQL', |
| 28 | + vbscript : 'VBScript' |
| 29 | +}, |
| 30 | +/** |
| 31 | + * Internally used functions |
| 32 | + */ |
| 33 | +fn: { |
| 34 | + create: function( context, config ) { |
| 35 | + context.$textarea |
| 36 | + .attr( 'disabled', true ) |
| 37 | + .css( 'overflow', 'hidden' ); |
| 38 | + context.modules.editor.$iframe = $( '<iframe></iframe>' ) |
| 39 | + .css( { |
| 40 | + 'width': context.$textarea.css( 'width' ), |
| 41 | + 'height': context.$textarea.css( 'height' ), |
| 42 | + 'border': '1px solid gray', |
| 43 | + 'visibility': 'hidden', |
| 44 | + 'position': 'absolute' |
| 45 | + }); |
| 46 | + .attr( 'frameborder', 0 ) |
| 47 | + context.$textarea |
| 48 | + .css( 'overflow', 'auto' ); |
| 49 | + |
| 50 | + |
| 51 | + var self = document.createElement('iframe'); |
| 52 | + |
| 53 | + self.textarea = obj; |
| 54 | + self.textarea.disabled = true; |
| 55 | + self.textarea.style.overflow = 'hidden'; |
| 56 | + |
| 57 | + self.style.height = self.textarea.clientHeight +'px'; |
| 58 | + self.style.width = self.textarea.clientWidth +'px'; |
| 59 | + self.textarea.style.overflow = 'auto'; |
| 60 | + |
| 61 | + self.style.border = '1px solid gray'; |
| 62 | + self.frameBorder = 0; // remove IE internal iframe border |
| 63 | + self.style.visibility = 'hidden'; |
| 64 | + self.style.position = 'absolute'; |
| 65 | + |
| 66 | + |
| 67 | + self.editor = self.contentWindow.CodePress; |
| 68 | + self.editor.body = self.contentWindow.document.getElementsByTagName('body')[0]; |
| 69 | + self.editor.setCode(self.textarea.value); |
| 70 | + self.setOptions(); |
| 71 | + self.editor.syntaxHighlight('init'); |
| 72 | + self.textarea.style.display = 'none'; |
| 73 | + self.style.position = 'static'; |
| 74 | + self.style.visibility = 'visible'; |
| 75 | + self.style.display = 'inline'; |
| 76 | + }, |
| 77 | + language: function( context, language ) { |
| 78 | + if ( language != undefined ) { |
| 79 | + if(obj) self.textarea.value = document.getElementById(obj) ? document.getElementById(obj).value : obj; |
| 80 | + if(!self.textarea.disabled) return; |
| 81 | + self.language = language ? language : self.getLanguage(); |
| 82 | + self.src = CodePress.path+'codepress.html?language='+self.language+'&ts='+(new Date).getTime(); |
| 83 | + if(self.attachEvent) self.attachEvent('onload',self.initialize); |
| 84 | + else self.addEventListener('load',self.initialize,false); |
| 85 | + |
| 86 | + var config = { "language": "generic", "engine": null }; |
| 87 | + var language = "generic"; var engine = "older"; |
| 88 | + var ua = navigator.userAgent; |
| 89 | + var ts = (new Date).getTime(); // timestamp to avoid cache |
| 90 | + var lh = location.href; |
| 91 | + |
| 92 | + if(ua.match('MSIE')) engine = 'msie'; |
| 93 | + else if(ua.match('KHTML')) engine = 'khtml'; |
| 94 | + else if(ua.match('Opera')) engine = 'opera'; |
| 95 | + else if(ua.match('Gecko')) engine = 'gecko'; |
| 96 | + if(lh.match('language=')) language = lh.replace(/.*language=(.*?)(&.*)?$/,'$1'); |
| 97 | + |
| 98 | + html = '\ |
| 99 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>\ |
| 100 | +<head><title>wikiEditor</title><meta name="description" content="wikiEditor" /><script type="text/javascript">\ |
| 101 | + <link type="text/css" href="codepress.css?ts='+ts+'" rel="stylesheet" />\ |
| 102 | + <link type="text/css" href="languages/'+language+'.css?ts='+ts+'" rel="stylesheet" id="cp-lang-style" />\ |
| 103 | + <script type="text/javascript" src="engines/'+engine+'.js?ts='+ts+'"></script>\ |
| 104 | + <script type="text/javascript" src="languages/'+language+'.js?ts='+ts+'"></script>\ |
| 105 | +</head>\ |
| 106 | +'; |
| 107 | + |
| 108 | +<script type="text/javascript"> |
| 109 | +if(engine == "msie" || engine == "gecko") document.write('<body><pre> </pre></body>'); |
| 110 | +else if(engine == "opera") document.write('<body></body>'); |
| 111 | +// else if(engine == "khtml") document.write('<body> </body>'); |
| 112 | +</script> |
| 113 | + |
| 114 | +</html> |
| 115 | + |
| 116 | + |
| 117 | + '; |
| 118 | + |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | + |
| 128 | + |
| 129 | + |
| 130 | + |
| 131 | + |
| 132 | + |
| 133 | + } else { |
| 134 | + for (language in CodePress.languages) |
| 135 | + if(self.options.match('\\b'+language+'\\b')) |
| 136 | + return CodePress.languages[language] ? language : 'generic'; |
| 137 | + } |
| 138 | + }, |
| 139 | + options: function( context, options ) { |
| 140 | + if ( options != undefined ) { |
| 141 | + $.extend( context.modules.editor.options, options ); |
| 142 | + } else { |
| 143 | + return context.modules.editor.options; |
| 144 | + } |
| 145 | + }, |
| 146 | + code: function( context, code ) { |
| 147 | + if ( code !== undefined ) { |
| 148 | + // Set |
| 149 | + self.textarea.disabled ? self.editor.setCode(code) : self.textarea.value = code; |
| 150 | + } else { |
| 151 | + // Get |
| 152 | + return self.textarea.disabled ? self.editor.getCode() : self.textarea.value; |
| 153 | + } |
| 154 | + }, |
| 155 | + // toggleReadOnly |
| 156 | + lock: function( context ) { |
| 157 | + self.textarea.readOnly = true; |
| 158 | + if(self.style.display != 'none') // prevent exception on FF + iframe with display:none |
| 159 | + self.editor.readOnly( true ); |
| 160 | + }, |
| 161 | + unlock: function( context ) { |
| 162 | + self.textarea.readOnly = false; |
| 163 | + if(self.style.display != 'none') // prevent exception on FF + iframe with display:none |
| 164 | + self.editor.readOnly( false ); |
| 165 | + }, |
| 166 | + // toggleEditor |
| 167 | + on: function( context ) { |
| 168 | + self.textarea.disabled = true; |
| 169 | + self.setCode(self.textarea.value); |
| 170 | + self.editor.syntaxHighlight('init'); |
| 171 | + self.style.display = 'inline'; |
| 172 | + self.textarea.style.display = 'none'; |
| 173 | + } |
| 174 | + off: function( context ) { |
| 175 | + self.textarea.value = self.getCode(); |
| 176 | + self.textarea.disabled = false; |
| 177 | + self.style.display = 'none'; |
| 178 | + self.textarea.style.display = 'inline'; |
| 179 | + } |
| 180 | + |
| 181 | + |
| 182 | + |
| 183 | + CodePress.run = function() { |
| 184 | + s = document.getElementsByTagName('script'); |
| 185 | + for(var i=0,n=s.length;i<n;i++) { |
| 186 | + if(s[i].src.match('codepress.js')) { |
| 187 | + CodePress.path = s[i].src.replace('codepress.js',''); |
| 188 | + } |
| 189 | + } |
| 190 | + t = document.getElementsByTagName('textarea'); |
| 191 | + for(var i=0,n=t.length;i<n;i++) { |
| 192 | + if(t[i].className.match('codepress')) { |
| 193 | + id = t[i].id; |
| 194 | + t[i].id = id+'_cp'; |
| 195 | + eval(id+' = new CodePress(t[i])'); |
| 196 | + t[i].parentNode.insertBefore(eval(id), t[i]); |
| 197 | + } |
| 198 | + } |
| 199 | + } |
| 200 | + |
| 201 | +} |
| 202 | + |
| 203 | +}; } ) ( jQuery ); |
\ No newline at end of file |
Property changes on: branches/usability/acaifix/js/plugins/jquery.wikiEditor.editor.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 204 | + native |
Index: branches/usability/acaifix/js/plugins/jquery.collapsibleTabs.js |
— | — | @@ -0,0 +1,94 @@ |
| 2 | +( function( $ ) { |
| 3 | + |
| 4 | +$.fn.collapsibleTabs = function( $$options ) { |
| 5 | + // return if the function is called on an empty jquery object |
| 6 | + if( !this.length ) return this; |
| 7 | + //merge options into the defaults |
| 8 | + var $settings = $.extend( {}, $.collapsibleTabs.defaults, $$options ); |
| 9 | + |
| 10 | + this.each( function() { |
| 11 | + var $this = $( this ); |
| 12 | + // add the element to our array of collapsible managers |
| 13 | + $.collapsibleTabs.instances = ( $.collapsibleTabs.instances.length == 0 ? $this : $.collapsibleTabs.instances.add( $this ) ); |
| 14 | + // attach the settings to the elements |
| 15 | + $this.data( 'collapsibleTabsSettings', $settings ); |
| 16 | + // attach data to our collapsible elements |
| 17 | + $this.children( $settings.collapsible ).each(function() { |
| 18 | + var $collapsible = $(this); |
| 19 | + $collapsible.data('collapsibleTabsSettings', { |
| 20 | + 'expandedContainer': $settings.expandedContainer, |
| 21 | + 'collapsedContainer': $settings.collapsedContainer, |
| 22 | + 'expandedWidth': $collapsible.width(), |
| 23 | + 'prevElement': $collapsible.prev() |
| 24 | + }); |
| 25 | + } ); |
| 26 | + } ); |
| 27 | + |
| 28 | + // if we haven't already bound our resize hanlder, bind it now |
| 29 | + if(!$.collapsibleTabs.boundEvent) $(window).delayedBind('500','resize', function(){ $.collapsibleTabs.handleResize(); }); |
| 30 | + // call our resize handler to setup the page |
| 31 | + $.collapsibleTabs.handleResize(); |
| 32 | + return this; |
| 33 | +}; |
| 34 | + |
| 35 | +$.collapsibleTabs = { |
| 36 | + instances: [], |
| 37 | + boundEvent: null, |
| 38 | + defaults: { |
| 39 | + expandedContainer: '#p-views ul', |
| 40 | + collapsedContainer: '#p-cactions ul', |
| 41 | + collapsible: 'li.collapsible', |
| 42 | + shifting: false, |
| 43 | + expandCondition: function(eleWidth) { |
| 44 | + return ( $('#left-navigation').position().left + $('#left-navigation').width()) |
| 45 | + < ($('#right-navigation').position().left - eleWidth); |
| 46 | + }, |
| 47 | + collapseCondition: function() { |
| 48 | + return ( $('#left-navigation').position().left + $('#left-navigation').width()) |
| 49 | + > $('#right-navigation').position().left; |
| 50 | + } |
| 51 | + }, |
| 52 | + handleResize: function(e){ |
| 53 | + $.collapsibleTabs.instances.each(function() { |
| 54 | + var $this = $(this), data = $this.data('collapsibleTabsSettings'); |
| 55 | + if(data.shifting) return; |
| 56 | + |
| 57 | + // if the two navigations are colliding |
| 58 | + if( $this.children(data.collapsible).length > 0 && data.collapseCondition() ) { |
| 59 | + |
| 60 | + $this.trigger("beforeTabCollapse"); |
| 61 | + // move the element to the dropdown menu |
| 62 | + $.collapsibleTabs.moveToCollapsed($this.children(data.collapsible+':last')); |
| 63 | + } |
| 64 | + |
| 65 | + // if there are still moveable items in the dropdown menu, |
| 66 | + // and there is sufficient space to place them in the tab container |
| 67 | + if($(data.collapsedContainer + ' ' + data.collapsible ).length > 0 |
| 68 | + && data.expandCondition( $(data.collapsedContainer).children( |
| 69 | + data.collapsible+":first").data('collapsibleTabsSettings').expandedWidth)) { |
| 70 | + //move the element from the dropdown to the tab |
| 71 | + $this.trigger("beforeTabExpand"); |
| 72 | + $.collapsibleTabs.moveToExpanded( data.collapsedContainer + " " + data.collapsible + ':first' ); |
| 73 | + } |
| 74 | + }); |
| 75 | + }, |
| 76 | + moveToCollapsed: function( ele ) { |
| 77 | + var $moving = $(ele); |
| 78 | + var data = $moving.data('collapsibleTabsSettings'); |
| 79 | + $(data.expandedContainer).data('collapsibleTabsSettings').shifting = true; |
| 80 | + $moving.remove().prependTo(data.collapsedContainer).data('collapsibleTabsSettings', data); |
| 81 | + $(data.expandedContainer).data('collapsibleTabsSettings').shifting = false; |
| 82 | + $.collapsibleTabs.handleResize(); |
| 83 | + }, |
| 84 | + moveToExpanded: function( ele ) { |
| 85 | + var $moving = $(ele); |
| 86 | + var data = $moving.data('collapsibleTabsSettings'); |
| 87 | + $(data.expandedContainer).data('collapsibleTabsSettings').shifting = true; |
| 88 | + // remove this element from where it's at and put it in the dropdown menu |
| 89 | + $moving.remove().insertAfter(data.prevElement).data('collapsibleTabsSettings', data); |
| 90 | + $(data.expandedContainer).data('collapsibleTabsSettings').shifting = false; |
| 91 | + $.collapsibleTabs.handleResize(); |
| 92 | + } |
| 93 | +}; |
| 94 | + |
| 95 | +} )( jQuery ); |
\ No newline at end of file |
Property changes on: branches/usability/acaifix/js/plugins/jquery.collapsibleTabs.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 96 | + native |
Index: branches/usability/acaifix/js/plugins/jquery.autoEllipse.js |
— | — | @@ -12,30 +12,28 @@ |
13 | 13 | var text = $(this).text(); |
14 | 14 | var $text = $( '<span />' ).text( text ).css( 'whiteSpace', 'nowrap' ); |
15 | 15 | $(this).empty().append( $text ); |
16 | | - if ( $text.outerWidth() > $(this).innerWidth() ) { |
| 16 | + if ( $text.width() > $(this).width() ) { |
17 | 17 | switch ( options.position ) { |
18 | 18 | case 'right': |
19 | | - // Use binary search-like technique for |
20 | | - // efficiency |
| 19 | + // Use binary search-like technique for efficiency |
21 | 20 | var l = 0, r = text.length; |
22 | | - var ow, iw; |
23 | 21 | do { |
24 | 22 | var m = Math.ceil( ( l + r ) / 2 ); |
25 | 23 | $text.text( text.substr( 0, m ) + '...' ); |
26 | | - ow = $text.outerWidth(); |
27 | | - iw = $(this).innerWidth(); |
28 | | - if ( ow > iw ) |
| 24 | + if ( $text.width() > $(this).width() ) { |
29 | 25 | // Text is too long |
30 | 26 | r = m - 1; |
31 | | - else |
| 27 | + } else { |
32 | 28 | l = m; |
| 29 | + } |
33 | 30 | } while ( l < r ); |
| 31 | + $text.text( text.substr( 0, l ) + '...' ); |
34 | 32 | break; |
35 | 33 | case 'center': |
36 | 34 | // TODO: Use binary search like for 'right' |
37 | 35 | var i = [Math.round( text.length / 2 ), Math.round( text.length / 2 )]; |
38 | 36 | var side = 1; // Begin with making the end shorter |
39 | | - while ( $text.outerWidth() > ( $(this).innerWidth() ) && i[0] > 0 ) { |
| 37 | + while ( $text.outerWidth() > ( $(this).width() ) && i[0] > 0 ) { |
40 | 38 | $text.text( text.substr( 0, i[0] ) + '...' + text.substr( i[1] ) ); |
41 | 39 | // Alternate between trimming the end and begining |
42 | 40 | if ( side == 0 ) { |
— | — | @@ -52,7 +50,7 @@ |
53 | 51 | case 'left': |
54 | 52 | // TODO: Use binary search like for 'right' |
55 | 53 | var r = 0; |
56 | | - while ( $text.outerWidth() > $(this).innerWidth() && r < text.length ) { |
| 54 | + while ( $text.outerWidth() > $(this).width() && r < text.length ) { |
57 | 55 | $text.text( '...' + text.substr( r ) ); |
58 | 56 | r++; |
59 | 57 | } |
Index: branches/usability/acaifix/js/plugins.combined.js |
— | — | @@ -90,30 +90,28 @@ |
91 | 91 | var text = $(this).text(); |
92 | 92 | var $text = $( '<span />' ).text( text ).css( 'whiteSpace', 'nowrap' ); |
93 | 93 | $(this).empty().append( $text ); |
94 | | - if ( $text.outerWidth() > $(this).innerWidth() ) { |
| 94 | + if ( $text.width() > $(this).width() ) { |
95 | 95 | switch ( options.position ) { |
96 | 96 | case 'right': |
97 | | - // Use binary search-like technique for |
98 | | - // efficiency |
| 97 | + // Use binary search-like technique for efficiency |
99 | 98 | var l = 0, r = text.length; |
100 | | - var ow, iw; |
101 | 99 | do { |
102 | 100 | var m = Math.ceil( ( l + r ) / 2 ); |
103 | 101 | $text.text( text.substr( 0, m ) + '...' ); |
104 | | - ow = $text.outerWidth(); |
105 | | - iw = $(this).innerWidth(); |
106 | | - if ( ow > iw ) |
| 102 | + if ( $text.width() > $(this).width() ) { |
107 | 103 | // Text is too long |
108 | 104 | r = m - 1; |
109 | | - else |
| 105 | + } else { |
110 | 106 | l = m; |
| 107 | + } |
111 | 108 | } while ( l < r ); |
| 109 | + $text.text( text.substr( 0, l ) + '...' ); |
112 | 110 | break; |
113 | 111 | case 'center': |
114 | 112 | // TODO: Use binary search like for 'right' |
115 | 113 | var i = [Math.round( text.length / 2 ), Math.round( text.length / 2 )]; |
116 | 114 | var side = 1; // Begin with making the end shorter |
117 | | - while ( $text.outerWidth() > ( $(this).innerWidth() ) && i[0] > 0 ) { |
| 115 | + while ( $text.outerWidth() > ( $(this).width() ) && i[0] > 0 ) { |
118 | 116 | $text.text( text.substr( 0, i[0] ) + '...' + text.substr( i[1] ) ); |
119 | 117 | // Alternate between trimming the end and begining |
120 | 118 | if ( side == 0 ) { |
— | — | @@ -130,7 +128,7 @@ |
131 | 129 | case 'left': |
132 | 130 | // TODO: Use binary search like for 'right' |
133 | 131 | var r = 0; |
134 | | - while ( $text.outerWidth() > $(this).innerWidth() && r < text.length ) { |
| 132 | + while ( $text.outerWidth() > $(this).width() && r < text.length ) { |
135 | 133 | $text.text( '...' + text.substr( r ) ); |
136 | 134 | r++; |
137 | 135 | } |
— | — | @@ -574,7 +572,7 @@ |
575 | 573 | * @param updateTextbox If true, put the suggestion in the textbox |
576 | 574 | */ |
577 | 575 | highlight: function( context, result, updateTextbox ) { |
578 | | - var selected = context.data.$container.find( '.suggestions-result-current' ) |
| 576 | + var selected = context.data.$container.find( '.suggestions-result-current' ); |
579 | 577 | if ( !result.get || selected.get( 0 ) != result.get( 0 ) ) { |
580 | 578 | if ( result == 'prev' ) { |
581 | 579 | result = selected.prev(); |
— | — | @@ -643,6 +641,12 @@ |
644 | 642 | case 13: |
645 | 643 | context.data.$container.hide(); |
646 | 644 | preventDefault = wasVisible; |
| 645 | + if ( typeof context.config.result.select == 'function' ) { |
| 646 | + context.config.result.select.call( |
| 647 | + context.data.$container.find( '.suggestions-result-current' ), |
| 648 | + context.data.$textbox |
| 649 | + ); |
| 650 | + } |
647 | 651 | break; |
648 | 652 | default: |
649 | 653 | $.suggestions.update( context, true ); |
— | — | @@ -827,12 +831,17 @@ |
828 | 832 | */ |
829 | 833 | ( function( $ ) { $.fn.extend( { |
830 | 834 | |
| 835 | +/** |
| 836 | + * Get the currently selected text in this textarea. Will focus the textarea |
| 837 | + * in some browsers (IE/Opera) |
| 838 | + */ |
831 | 839 | getSelection: function() { |
832 | 840 | var e = this.jquery ? this[0] : this; |
833 | 841 | var retval = ''; |
834 | 842 | if ( e.style.display == 'none' ) { |
835 | 843 | // Do nothing |
836 | 844 | } else if ( document.selection && document.selection.createRange ) { |
| 845 | + e.focus(); |
837 | 846 | var range = document.selection.createRange(); |
838 | 847 | retval = range.text; |
839 | 848 | } else if ( e.selectionStart || e.selectionStart == '0' ) { |
— | — | @@ -1745,6 +1754,13 @@ |
1746 | 1755 | parts[part] = ( action.options[part] || '' ) |
1747 | 1756 | } |
1748 | 1757 | } |
| 1758 | + if ( 'periRegex' in action.options && 'periRegexReplace' in action.options ) { |
| 1759 | + var selection = context.$textarea.getSelection(); |
| 1760 | + if ( selection != '' ) { |
| 1761 | + parts.peri = selection.replace( action.options.periRegex, |
| 1762 | + action.options.periRegexReplace ); |
| 1763 | + } |
| 1764 | + } |
1749 | 1765 | context.$textarea.encapsulateSelection( |
1750 | 1766 | parts.pre, parts.peri, parts.post, action.options.ownline, action.type == 'replace' |
1751 | 1767 | ); |
— | — | @@ -1849,25 +1865,23 @@ |
1850 | 1866 | .text( label ) |
1851 | 1867 | .attr( 'rel', id ) |
1852 | 1868 | .data( 'context', context ) |
1853 | | - .click( |
1854 | | - function() { |
1855 | | - |
1856 | | - $(this).parent().parent().find( '.page' ).hide(); |
1857 | | - $(this).parent().parent().find( '.page-' + $(this).attr( 'rel' ) ).show(); |
1858 | | - $(this).siblings().removeClass( 'current' ); |
1859 | | - $(this).addClass( 'current' ); |
1860 | | - var section = $(this).parent().parent().attr( 'rel' ); |
1861 | | - |
1862 | | - //click tracking |
1863 | | - if($.trackAction != undefined){ |
1864 | | - $.trackAction(section + '.' + $(this).attr('rel')); |
1865 | | - } |
1866 | | - |
1867 | | - $.cookie( |
1868 | | - 'wikiEditor-' + $(this).data( 'context' ).instance + '-booklet-' + section + '-page', |
1869 | | - $(this).attr( 'rel' ) |
1870 | | - ); |
1871 | | - } ); |
| 1869 | + .bind( 'mousedown', function() { |
| 1870 | + $(this).parent().parent().find( '.page' ).hide(); |
| 1871 | + $(this).parent().parent().find( '.page-' + $(this).attr( 'rel' ) ).show(); |
| 1872 | + $(this).siblings().removeClass( 'current' ); |
| 1873 | + $(this).addClass( 'current' ); |
| 1874 | + var section = $(this).parent().parent().attr( 'rel' ); |
| 1875 | + |
| 1876 | + //click tracking |
| 1877 | + if($.trackAction != undefined){ |
| 1878 | + $.trackAction(section + '.' + $(this).attr('rel')); |
| 1879 | + } |
| 1880 | + |
| 1881 | + $.cookie( |
| 1882 | + 'wikiEditor-' + $(this).data( 'context' ).instance + '-booklet-' + section + '-page', |
| 1883 | + $(this).attr( 'rel' ) |
| 1884 | + ); |
| 1885 | + } ); |
1872 | 1886 | }, |
1873 | 1887 | buildPage : function( context, id, page ) { |
1874 | 1888 | var $page = $( '<div />' ).attr( { |
— | — | @@ -1974,22 +1988,34 @@ |
1975 | 1989 | .attr( 'href', '#' ) |
1976 | 1990 | .text( $.wikiEditor.autoMsg( section, 'label' ) ) |
1977 | 1991 | .data( 'context', context ) |
1978 | | - .click( function() { |
| 1992 | + .bind( 'mouseup', function( e ) { |
| 1993 | + $(this).blur(); |
| 1994 | + } ) |
| 1995 | + .bind( 'mousedown', function( e ) { |
| 1996 | + // Only act when the primary mouse button was pressed |
| 1997 | + if ( e.button !== 0 ) { |
| 1998 | + return true; |
| 1999 | + } |
1979 | 2000 | var $sections = $(this).data( 'context' ).$ui.find( '.sections' ); |
1980 | 2001 | var $section = |
1981 | 2002 | $(this).data( 'context' ).$ui.find( '.section-' + $(this).parent().attr( 'rel' ) ); |
1982 | | - $(this).blur(); |
1983 | 2003 | var show = $section.css( 'display' ) == 'none'; |
1984 | 2004 | $previousSections = $section.parent().find( '.section:visible' ); |
1985 | 2005 | $previousSections.css( 'position', 'absolute' ); |
1986 | 2006 | $previousSections.fadeOut( 'fast', function() { $(this).css( 'position', 'relative' ); } ); |
1987 | 2007 | $(this).parent().parent().find( 'a' ).removeClass( 'current' ); |
| 2008 | + $sections.css('overflow', 'hidden'); |
1988 | 2009 | if ( show ) { |
1989 | 2010 | $section.fadeIn( 'fast' ); |
1990 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 2011 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2, function() { |
| 2012 | + $(this).css('overflow', 'visible').css('height', 'auto'); |
| 2013 | + } ); |
1991 | 2014 | $(this).addClass( 'current' ); |
1992 | 2015 | } else { |
1993 | | - $sections.animate( { 'height': 0 } ); |
| 2016 | + $sections.css('height', $section.outerHeight() ) |
| 2017 | + .animate( { 'height': 0 }, $section.outerHeight() * 2, function() { |
| 2018 | + $(this).css('overflow', 'visible'); |
| 2019 | + } ); |
1994 | 2020 | } |
1995 | 2021 | // Click tracking |
1996 | 2022 | if($.trackAction != undefined){ |
— | — | @@ -2000,8 +2026,8 @@ |
2001 | 2027 | 'wikiEditor-' + $(this).data( 'context' ).instance + '-toolbar-section', |
2002 | 2028 | show ? $section.attr( 'rel' ) : null |
2003 | 2029 | ); |
2004 | | - return false; |
2005 | 2030 | } ) |
| 2031 | + .click( function() { return false; } ) |
2006 | 2032 | ); |
2007 | 2033 | }, |
2008 | 2034 | buildSection : function( context, id, section ) { |
— | — | @@ -2090,7 +2116,7 @@ |
2091 | 2117 | s.$sections.append( $.wikiEditor.modules.toolbar.fn.buildSection( s.context, s.id, s.config ) ); |
2092 | 2118 | var $section = s.$sections.find( '.section:visible' ); |
2093 | 2119 | if ( $section.size() ) { |
2094 | | - $sections.animate( { 'height': $section.outerHeight() }, 'fast' ); |
| 2120 | + $sections.animate( { 'height': $section.outerHeight() }, $section.outerHeight() * 2 ); |
2095 | 2121 | } |
2096 | 2122 | } |
2097 | 2123 | } ); |
— | — | @@ -2098,9 +2124,7 @@ |
2099 | 2125 | } |
2100 | 2126 | |
2101 | 2127 | }; } )( jQuery ); |
2102 | | -/** |
2103 | | - * TOC Module for wikiEditor |
2104 | | - */ |
| 2128 | +/* TOC Module for wikiEditor */ |
2105 | 2129 | ( function( $ ) { $.wikiEditor.modules.toc = { |
2106 | 2130 | |
2107 | 2131 | /** |
— | — | @@ -2141,7 +2165,7 @@ |
2142 | 2166 | // Add the TOC to the document |
2143 | 2167 | $.wikiEditor.modules.toc.fn.build( context, config ); |
2144 | 2168 | context.$textarea |
2145 | | - .delayedBind( 1000, 'keyup encapsulateSelection change', |
| 2169 | + .delayedBind( 250, 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
2146 | 2170 | function( event ) { |
2147 | 2171 | var context = $(this).data( 'wikiEditor-context' ); |
2148 | 2172 | $(this).eachAsync( { |
— | — | @@ -2153,25 +2177,16 @@ |
2154 | 2178 | } ); |
2155 | 2179 | } |
2156 | 2180 | ) |
2157 | | - .bind( 'mouseup scrollToPosition focus keyup encapsulateSelection change', |
2158 | | - function( event ) { |
2159 | | - var context = $(this).data( 'wikiEditor-context' ); |
2160 | | - $(this).eachAsync( { |
2161 | | - bulk: 0, |
2162 | | - loop: function() { |
2163 | | - $.wikiEditor.modules.toc.fn.update( context ); |
2164 | | - } |
2165 | | - } ); |
2166 | | - } |
2167 | | - ) |
2168 | 2181 | .blur( function() { |
2169 | 2182 | var context = $(this).data( 'wikiEditor-context' ); |
| 2183 | + context.$textarea.delayedBindCancel( 250, |
| 2184 | + 'mouseup scrollToPosition focus keyup encapsulateSelection change' ); |
2170 | 2185 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
2171 | 2186 | }); |
2172 | 2187 | }, |
2173 | 2188 | |
2174 | 2189 | unhighlight: function( context ) { |
2175 | | - context.modules.$toc.find( 'a' ).removeClass( 'currentSelection' ); |
| 2190 | + context.modules.$toc.find( 'div' ).removeClass( 'current' ); |
2176 | 2191 | }, |
2177 | 2192 | /** |
2178 | 2193 | * Highlight the section the cursor is currently within |
— | — | @@ -2195,8 +2210,8 @@ |
2196 | 2211 | } |
2197 | 2212 | section = Math.max( 0, section ); |
2198 | 2213 | } |
2199 | | - var sectionLink = context.modules.$toc.find( 'a.section-' + section ); |
2200 | | - sectionLink.addClass( 'currentSelection' ); |
| 2214 | + var sectionLink = context.modules.$toc.find( 'div.section-' + section ); |
| 2215 | + sectionLink.addClass( 'current' ); |
2201 | 2216 | |
2202 | 2217 | // Scroll the highlighted link into view if necessary |
2203 | 2218 | var relTop = sectionLink.offset().top - context.modules.$toc.offset().top; |
— | — | @@ -2245,26 +2260,26 @@ |
2246 | 2261 | * @param {Object} structure Structured outline |
2247 | 2262 | */ |
2248 | 2263 | function buildList( structure ) { |
2249 | | - var list = $( '<ul />' ); |
| 2264 | + var list = $( '<ul></ul>' ); |
2250 | 2265 | for ( i in structure ) { |
2251 | | - var item = $( '<li />' ) |
2252 | | - .append( |
2253 | | - $( '<a />' ) |
2254 | | - .attr( 'href', '#' ) |
2255 | | - .addClass( 'section-' + structure[i].index ) |
2256 | | - .data( 'textbox', context.$textarea ) |
2257 | | - .data( 'position', structure[i].position ) |
2258 | | - .click( function( event ) { |
2259 | | - $(this).data( 'textbox' ) |
2260 | | - .focus() |
2261 | | - .setSelection( $(this).data( 'position' ) ) |
2262 | | - .scrollToCaretPosition( true ); |
2263 | | - if ( typeof $.trackAction != 'undefined' ) |
2264 | | - $.trackAction( 'ntoc.heading' ); |
2265 | | - event.preventDefault(); |
2266 | | - } ) |
2267 | | - .text( structure[i].text ) |
2268 | | - ); |
| 2266 | + var div = $( '<div></div>' ) |
| 2267 | + .attr( 'href', '#' ) |
| 2268 | + .addClass( 'section-' + structure[i].index ) |
| 2269 | + .data( 'textbox', context.$textarea ) |
| 2270 | + .data( 'position', structure[i].position ) |
| 2271 | + .bind( 'mousedown', function( event ) { |
| 2272 | + $(this).data( 'textbox' ) |
| 2273 | + .focus() |
| 2274 | + .setSelection( $(this).data( 'position' ) ) |
| 2275 | + .scrollToCaretPosition( true ); |
| 2276 | + if ( typeof $.trackAction != 'undefined' ) |
| 2277 | + $.trackAction( 'ntoc.heading' ); |
| 2278 | + event.preventDefault(); |
| 2279 | + } ) |
| 2280 | + .text( structure[i].text ); |
| 2281 | + if ( structure[i].text == '' ) |
| 2282 | + div.html( ' ' ); |
| 2283 | + var item = $( '<li></li>' ).append( div ); |
2269 | 2284 | if ( structure[i].sections !== undefined ) { |
2270 | 2285 | item.append( buildList( structure[i].sections ) ); |
2271 | 2286 | } |
— | — | @@ -2275,7 +2290,7 @@ |
2276 | 2291 | // Build outline from wikitext |
2277 | 2292 | var outline = []; |
2278 | 2293 | var wikitext = $.wikiEditor.fixOperaBrokenness( context.$textarea.val() ); |
2279 | | - var headings = wikitext.match( /^={1,6}.+={1,6}\s*$/gm ); |
| 2294 | + var headings = wikitext.match( /^={1,6}[^=\n][^\n]*={1,6}\s*$/gm ); |
2280 | 2295 | var offset = 0; |
2281 | 2296 | headings = $.makeArray( headings ); |
2282 | 2297 | for ( var h = 0; h < headings.length; h++ ) { |
— | — | @@ -2335,18 +2350,11 @@ |
2336 | 2351 | // Recursively build the structure and add special item for |
2337 | 2352 | // section 0, if needed |
2338 | 2353 | var structure = buildStructure( outline ); |
2339 | | - if ( $( 'input[name=wpSection]' ).val() == '' ) |
| 2354 | + if ( $( 'input[name=wpSection]' ).val() == '' ) { |
2340 | 2355 | structure.unshift( { 'text': wgPageName.replace(/_/g, ' '), 'level': 1, 'index': 0, 'position': 0 } ); |
| 2356 | + } |
2341 | 2357 | context.modules.$toc.html( buildList( structure ) ); |
2342 | | - |
2343 | | - context.modules.$toc.find( 'ul' ).css( 'width', '10em' ); |
2344 | | - |
2345 | | - var links = context.modules.$toc.find( 'ul a' ); |
2346 | | - // Highlighted links are wider; autoEllipse links in |
2347 | | - // highlighted state |
2348 | | - links.addClass( 'currentSelection' ); |
2349 | | - links.autoEllipse( { 'position': 'right', 'tooltip': true } ); |
2350 | | - links.removeClass( 'currentSelection' ); |
| 2358 | + context.modules.$toc.find( 'div' ).autoEllipse( { 'position': 'right', 'tooltip': true } ); |
2351 | 2359 | // Cache the outline for later use |
2352 | 2360 | context.data.outline = outline; |
2353 | 2361 | } |
Index: branches/usability/acaifix/js/plugins.combined.min.js |
— | — | @@ -11,10 +11,8 @@ |
12 | 12 | {var i=0,l=array.length,loop=opts.loop||function(){};$.whileAsync($.extend(opts,{test:function(){return i<l;},loop:function() |
13 | 13 | {var val=array[i];return loop.call(val,i++,val);}}));} |
14 | 14 | $.fn.eachAsync=function(opts) |
15 | | -{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.outerWidth()>$(this).innerWidth()){switch(options.position){case'right':var l=0,r=text.length;var ow,iw;do{var m=Math.ceil((l+r)/2);$text.text(text.substr(0,m)+'...');ow=$text.outerWidth();iw=$(this).innerWidth();if(ow>iw) |
16 | | -r=m-1;else |
17 | | -l=m;}while(l<r);break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).innerWidth())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
18 | | -break;case'left':var r=0;while($text.outerWidth()>$(this).innerWidth()&&r<text.length){$text.text('...'+text.substr(r));r++;} |
| 15 | +{$.eachAsync(this,opts);return this;}})(jQuery);(function($){$.fn.autoEllipse=function(options){$(this).each(function(){options=$.extend({'position':'center','tooltip':false},options);var text=$(this).text();var $text=$('<span />').text(text).css('whiteSpace','nowrap');$(this).empty().append($text);if($text.width()>$(this).width()){switch(options.position){case'right':var l=0,r=text.length;do{var m=Math.ceil((l+r)/2);$text.text(text.substr(0,m)+'...');if($text.width()>$(this).width()){r=m-1;}else{l=m;}}while(l<r);$text.text(text.substr(0,l)+'...');break;case'center':var i=[Math.round(text.length/2),Math.round(text.length/2)];var side=1;while($text.outerWidth()>($(this).width())&&i[0]>0){$text.text(text.substr(0,i[0])+'...'+text.substr(i[1]));if(side==0){i[0]--;side=1;}else{i[1]++;side=0;}} |
| 16 | +break;case'left':var r=0;while($text.outerWidth()>$(this).width()&&r<text.length){$text.text('...'+text.substr(r));r++;} |
19 | 17 | break;} |
20 | 18 | if(options.tooltip) |
21 | 19 | $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]);} |
— | — | @@ -35,15 +33,15 @@ |
36 | 34 | if(context.data.timerID!=null){clearTimeout(context.data.timerID);} |
37 | 35 | if(delayed){context.data.timerID=setTimeout(maybeFetch,context.config.delay);}else{maybeFetch();} |
38 | 36 | $.suggestions.special(context);},special:function(context){if(typeof context.config.special.render=='function'){setTimeout(function(){$special=context.data.$container.find('.suggestions-special');context.config.special.render.call($special,context.data.$textbox.val());},1);}},configure:function(context,property,value){switch(property){case'fetch':case'cancel':case'special':case'result':case'$region':context.config[property]=value;break;case'suggestions':context.config[property]=value;if(typeof context.data!=='undefined'){if(context.config.suggestions.length==0){context.data.$container.hide();}else{context.data.$container.show();context.data.$container.css({'top':context.config.$region.offset().top+context.config.$region.outerHeight(),'bottom':'auto','width':context.config.$region.outerWidth(),'height':'auto','left':context.config.$region.offset().left,'right':'auto'});var $results=context.data.$container.children('.suggestions-results');$results.empty();for(var i=0;i<context.config.suggestions.length;i++){$result=$('<div />').addClass('suggestions-result').attr('rel',i).data('text',context.config.suggestions[i]).appendTo($results);if(typeof context.config.result.render=='function'){context.config.result.render.call($result,context.config.suggestions[i]);}else{$result.text(context.config.suggestions[i]).autoEllipse();}}}} |
39 | | -break;case'maxRows':context.config[property]=Math.max(1,Math.min(100,value));break;case'delay':context.config[property]=Math.max(0,Math.min(12000,value));break;case'submitOnClick':context.config[property]=value?true:false;break;}},highlight:function(context,result,updateTextbox){var selected=context.data.$container.find('.suggestions-result-current') |
40 | | -if(!result.get||selected.get(0)!=result.get(0)){if(result=='prev'){result=selected.prev();}else if(result=='next'){if(selected.size()==0) |
| 37 | +break;case'maxRows':context.config[property]=Math.max(1,Math.min(100,value));break;case'delay':context.config[property]=Math.max(0,Math.min(12000,value));break;case'submitOnClick':context.config[property]=value?true:false;break;}},highlight:function(context,result,updateTextbox){var selected=context.data.$container.find('.suggestions-result-current');if(!result.get||selected.get(0)!=result.get(0)){if(result=='prev'){result=selected.prev();}else if(result=='next'){if(selected.size()==0) |
41 | 38 | result=context.data.$container.find('.suggestions-results div:first');else{result=selected.next();if(result.size()==0) |
42 | 39 | result=selected;}} |
43 | 40 | selected.removeClass('suggestions-result-current');result.addClass('suggestions-result-current');} |
44 | 41 | if(updateTextbox){if(result.size()==0){$.suggestions.restore(context);}else{context.data.$textbox.val(result.data('text'));context.data.$textbox.change();}} |
45 | 42 | $.suggestions.special(context);},keypress:function(e,context,key){var wasVisible=context.data.$container.is(':visible');var preventDefault=false;switch(key){case 40:if(wasVisible){$.suggestions.highlight(context,'next',true);}else{$.suggestions.update(context,false);} |
46 | 43 | context.data.$textbox.trigger('change');preventDefault=true;break;case 38:if(wasVisible){$.suggestions.highlight(context,'prev',true);} |
47 | | -context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 27:context.data.$container.hide();$.suggestions.restore(context);$.suggestions.cancel(context);context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 13:context.data.$container.hide();preventDefault=wasVisible;break;default:$.suggestions.update(context,true);break;} |
| 44 | +context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 27:context.data.$container.hide();$.suggestions.restore(context);$.suggestions.cancel(context);context.data.$textbox.trigger('change');preventDefault=wasVisible;break;case 13:context.data.$container.hide();preventDefault=wasVisible;if(typeof context.config.result.select=='function'){context.config.result.select.call(context.data.$container.find('.suggestions-result-current'),context.data.$textbox);} |
| 45 | +break;default:$.suggestions.update(context,true);break;} |
48 | 46 | if(preventDefault){e.preventDefault();e.stopImmediatePropagation();}}};$.fn.suggestions=function(){var returnValue=null;var args=arguments;$(this).each(function(){var context=$(this).data('suggestions-context');if(typeof context=='undefined'){context={config:{'fetch':function(){},'cancel':function(){},'special':{},'result':{},'$region':$(this),'suggestions':[],'maxRows':7,'delay':1200,'submitOnClick':false}};} |
49 | 47 | if(args.length>0){if(typeof args[0]=='object'){for(key in args[0]){$.suggestions.configure(context,key,args[0][key]);}}else if(typeof args[0]=='string'){if(args.length>1){$.suggestions.configure(context,args[0],args[1]);}else if(returnValue==null){returnValue=(args[0]in context.config?undefined:context.config[args[0]]);}}} |
50 | 48 | if(typeof context.data=='undefined'){context.data={'timerID':null,'prevText':null,'visibleResults':0,'mouseDownOn':$([]),'$textbox':$(this)};context.data.$container=$('<div />').css({'top':Math.round(context.data.$textbox.offset().top+context.data.$textbox.outerHeight()),'left':Math.round(context.data.$textbox.offset().left),'width':context.data.$textbox.outerWidth(),'display':'none'}).mouseover(function(e){$.suggestions.highlight(context,$(e.target).closest('.suggestions-results div'),false);}).addClass('suggestions').append($('<div />').addClass('suggestions-results').mousedown(function(e){context.data.mouseDownOn=$(e.target).closest('.suggestions-results div');}).mouseup(function(e){var $result=$(e.target).closest('.suggestions-results div');var $other=context.data.mouseDownOn;context.data.mouseDownOn=$([]);if($result.get(0)!=$other.get(0)){return;} |
— | — | @@ -52,7 +50,7 @@ |
53 | 51 | context.data.$container.hide();if(typeof context.config.special.select=='function'){context.config.special.select.call($special,context.data.$textbox);} |
54 | 52 | context.data.$textbox.focus();})).appendTo($('body'));$(this).attr('autocomplete','off').keydown(function(e){context.data.keypressed=(e.keyCode==undefined)?e.which:e.keyCode;context.data.keypressedCount=0;switch(context.data.keypressed){case 40:e.preventDefault();e.stopImmediatePropagation();break;case 38:case 27:case 13:if(context.data.$container.is(':visible')){e.preventDefault();e.stopImmediatePropagation();}}}).keypress(function(e){context.data.keypressedCount++;$.suggestions.keypress(e,context,context.data.keypressed);}).keyup(function(e){if(context.data.keypressedCount==0){$.suggestions.keypress(e,context,context.data.keypressed);}}).blur(function(){if(context.data.mouseDownOn.size()>0){return;} |
55 | 53 | context.data.$container.hide();$.suggestions.cancel(context);});} |
56 | | -$(this).data('suggestions-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.fn.extend({getSelection:function(){var e=this.jquery?this[0]:this;var retval='';if(e.style.display=='none'){}else if(document.selection&&document.selection.createRange){var range=document.selection.createRange();retval=range.text;}else if(e.selectionStart||e.selectionStart=='0'){retval=e.value.substring(e.selectionStart,e.selectionEnd);} |
| 54 | +$(this).data('suggestions-context',context);});return returnValue!==null?returnValue:$(this);};})(jQuery);(function($){$.fn.extend({getSelection:function(){var e=this.jquery?this[0]:this;var retval='';if(e.style.display=='none'){}else if(document.selection&&document.selection.createRange){e.focus();var range=document.selection.createRange();retval=range.text;}else if(e.selectionStart||e.selectionStart=='0'){retval=e.value.substring(e.selectionStart,e.selectionEnd);} |
57 | 55 | return retval;},encapsulateSelection:function(pre,peri,post,ownline,replace){return this.each(function(){function checkSelectedText(){if(!selText){selText=peri;isSample=true;}else if(replace){selText=peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';}} |
58 | 56 | var selText=$(this).getSelection();var isSample=false;if(this.style.display=='none'){}else if(this.selectionStart||this.selectionStart=='0'){$(this).focus();var startPos=this.selectionStart;var endPos=this.selectionEnd;checkSelectedText();if(ownline){if(startPos!=0&&this.value.charAt(startPos-1)!="\n"){pre="\n"+pre;} |
59 | 57 | if(this.value.charAt(endPos)!="\n"){post+="\n";}} |
— | — | @@ -113,6 +111,7 @@ |
114 | 112 | step=step.parent();} |
115 | 113 | rels.reverse();var id=rels.join('.');$.trackAction(id);} |
116 | 114 | switch(action.type){case'replace':case'encapsulate':var parts={'pre':'','peri':'','post':''};for(part in parts){if(part+'Msg'in action.options){parts[part]=gM(action.options[part+'Msg'],(action.options[part]||null));}else{parts[part]=(action.options[part]||'')}} |
| 115 | +if('periRegex'in action.options&&'periRegexReplace'in action.options){var selection=context.$textarea.getSelection();if(selection!=''){parts.peri=selection.replace(action.options.periRegex,action.options.periRegexReplace);}} |
117 | 116 | context.$textarea.encapsulateSelection(parts.pre,parts.peri,parts.post,action.options.ownline,action.type=='replace');break;case'callback':if(typeof action.execute=='function'){action.execute(context);} |
118 | 117 | break;case'dialog':context.$textarea.wikiEditor('openDialog',{'dialog':action.module});break;default:break;}},buildGroup:function(context,id,group){var $group=$('<div />').attr({'class':'group group-'+id,'rel':id});var label=$.wikiEditor.autoMsg(group,'label');if(label){$group.append('<div class="label">'+label+'</div>')} |
119 | 118 | if('tools'in group){for(tool in group.tools){$group.append($.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]));}} |
— | — | @@ -120,7 +119,7 @@ |
121 | 120 | var label=$.wikiEditor.autoMsg(tool,'label');switch(tool.type){case'button':var src=tool.icon;if(src.indexOf('http://')!==0&&src.indexOf('https://')!==0){src=$.wikiEditor.imgPath+'toolbar/'+src;} |
122 | 121 | $button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-button'});if('action'in tool){$button.data('action',tool.action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));return false;});} |
123 | 122 | return $button;case'select':var $select=$('<div />').attr({'rel':id,'class':'tool tool-select'}).click(function(){var $options=$(this).find('.options');$options.animate({'opacity':'toggle'},'fast');});$options=$('<div />').addClass('options');if('list'in tool){for(option in tool.list){var optionLabel=$.wikiEditor.autoMsg(tool.list[option],'label');$options.append($('<a />').data('action',tool.list[option].action).data('context',context).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'),$(this));}).text(optionLabel).addClass('option').attr('rel',option));}} |
124 | | -$select.append($('<div />').addClass('menu').append($options));$select.append($('<div />').addClass('label').text(label));return $select;default:return null;}},buildBookmark:function(context,id,page){var label=$.wikiEditor.autoMsg(page,'label');return $('<div />').text(label).attr('rel',id).data('context',context).click(function(){$(this).parent().parent().find('.page').hide();$(this).parent().parent().find('.page-'+$(this).attr('rel')).show();$(this).siblings().removeClass('current');$(this).addClass('current');var section=$(this).parent().parent().attr('rel');if($.trackAction!=undefined){$.trackAction(section+'.'+$(this).attr('rel'));} |
| 123 | +$select.append($('<div />').addClass('menu').append($options));$select.append($('<div />').addClass('label').text(label));return $select;default:return null;}},buildBookmark:function(context,id,page){var label=$.wikiEditor.autoMsg(page,'label');return $('<div />').text(label).attr('rel',id).data('context',context).bind('mousedown',function(){$(this).parent().parent().find('.page').hide();$(this).parent().parent().find('.page-'+$(this).attr('rel')).show();$(this).siblings().removeClass('current');$(this).addClass('current');var section=$(this).parent().parent().attr('rel');if($.trackAction!=undefined){$.trackAction(section+'.'+$(this).attr('rel'));} |
125 | 124 | $.cookie('wikiEditor-'+$(this).data('context').instance+'-booklet-'+section+'-page',$(this).attr('rel'));});},buildPage:function(context,id,page){var $page=$('<div />').attr({'class':'page page-'+id,'rel':id});switch(page.layout){case'table':$page.addClass('page-table');var html='<table cellpadding=0 cellspacing=0 '+'border=0 width="100%" class="table table-"'+id+'">';if('headings'in page){html+=$.wikiEditor.modules.toolbar.fn.buildHeading(context,page.headings)} |
126 | 125 | if('rows'in page){for(row in page.rows){html+=$.wikiEditor.modules.toolbar.fn.buildRow(context,page.rows[row])}} |
127 | 126 | $page.html(html);break;case'characters':$page.addClass('page-characters');$characters=$('<div />').data('context',context).data('actions',{});var actions=$characters.data('actions');if('language'in page){$characters.attr('lang',page.language);} |
— | — | @@ -132,28 +131,30 @@ |
133 | 132 | return html;},buildRow:function(context,row){var html='<tr>';for(cell in row){html+='<td class="cell cell-'+cell+'" valign="top"><span>'+ |
134 | 133 | $.wikiEditor.autoMsg(row[cell],['html','text'])+'</span></td>';} |
135 | 134 | html+='</tr>';return html;},buildCharacter:function(character,actions){if(typeof character=='string'){character={'label':character,'action':{'type':'encapsulate','options':{'pre':character}}};}else if(0 in character&&1 in character){character={'label':character[0],'action':{'type':'encapsulate','options':{'pre':character[1]}}};} |
136 | | -if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).click(function(){var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},'fast');$(this).addClass('current');}else{$sections.animate({'height':0});} |
| 135 | +if('action'in character&&'label'in character){actions[character.label]=character.action;return'<a rel="'+character.label+'" href="#">'+character.label+'</a>';}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span />').attr({'class':'tab tab-'+id,'rel':id}).append($('<a />').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.autoMsg(section,'label')).data('context',context).bind('mouseup',function(e){$(this).blur();}).bind('mousedown',function(e){if(e.button!==0){return true;} |
| 136 | +var $sections=$(this).data('context').$ui.find('.sections');var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));var show=$section.css('display')=='none';$previousSections=$section.parent().find('.section:visible');$previousSections.css('position','absolute');$previousSections.fadeOut('fast',function(){$(this).css('position','relative');});$(this).parent().parent().find('a').removeClass('current');$sections.css('overflow','hidden');if(show){$section.fadeIn('fast');$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2,function(){$(this).css('overflow','visible').css('height','auto');});$(this).addClass('current');}else{$sections.css('height',$section.outerHeight()).animate({'height':0},$section.outerHeight()*2,function(){$(this).css('overflow','visible');});} |
137 | 137 | if($.trackAction!=undefined){$.trackAction($section.attr('rel')+'.'+(show?'show':'hide'));} |
138 | | -$.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}} |
| 138 | +$.cookie('wikiEditor-'+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);}).click(function(){return false;}));},buildSection:function(context,id,section){context.$textarea.trigger('wikiEditor-toolbar-buildSection-'+id,[section]);var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div />').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in section){for(group in section.groups){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,section.groups[group]));}} |
139 | 139 | break;case'booklet':var $pages=$('<div />').addClass('pages');var $index=$('<div />').addClass('index');if('pages'in section){for(page in section.pages){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,section.pages[page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,section.pages[page]));}} |
140 | 140 | $section=$('<div />').attr({'class':'booklet section section-'+id,'rel':id}).append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;} |
141 | 141 | if($section!==null&&id!=='main'){var show=selected==id;$section.css('display',show?'block':'none');} |
142 | 142 | return $section;},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);var $selectedIndex=$index.find('*[rel='+selected+']');if($selectedIndex.size()==0){selected=$index.children().eq(0).attr('rel');$.cookie(cookie,selected);} |
143 | 143 | $pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$selectedIndex.addClass('current');},build:function(context,config){var $tabs=$('<div />').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div />').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div />').css('clear','both'));var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{sectionQueue.push({'$sections':$sections,'context':context,'id':section,'config':config[section]});$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,config[section]));}} |
144 | | -$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},'fast');}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
| 144 | +$.eachAsync(sectionQueue,{'bulk':0,'end':function(){$('body').css('position','static');$('body').css('position','relative');},'loop':function(i,s){s.$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(s.context,s.id,s.config));var $section=s.$sections.find('.section:visible');if($section.size()){$sections.animate({'height':$section.outerHeight()},$section.outerHeight()*2);}}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;} |
145 | 145 | context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');var height=context.$ui.find('.wikiEditor-ui-bottom').height() |
146 | | -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','marginTop':-(height)});context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(1000,'keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('a').removeClass('currentSelection');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);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++;} |
| 146 | +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','marginTop':-(height)});context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context,config);context.$textarea.delayedBind(250,'mouseup scrollToPosition focus keyup encapsulateSelection change',function(event){var context=$(this).data('wikiEditor-context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(){var context=$(this).data('wikiEditor-context');context.$textarea.delayedBindCancel(250,'mouseup scrollToPosition focus keyup encapsulateSelection change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);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++;} |
147 | 147 | section=Math.max(0,section);} |
148 | | -var sectionLink=context.modules.$toc.find('a.section-'+section);sectionLink.addClass('currentSelection');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
| 148 | +var sectionLink=context.modules.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
149 | 149 | context.modules.$toc.scrollTop(scrollTop+relTop);else if(relTop+sectionHeight>divHeight) |
150 | 150 | context.modules.$toc.scrollTop(scrollTop+relTop+sectionHeight-divHeight);}},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;} |
151 | 151 | sections[sections.length]=outline[i];}else if(outline[i].nLevel<level){break;}} |
152 | 152 | return sections;} |
153 | | -function buildList(structure){var list=$('<ul />');for(i in structure){var item=$('<li />').append($('<a />').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).click(function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);if(typeof $.trackAction!='undefined') |
154 | | -$.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text));if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
| 153 | +function buildList(structure){var list=$('<ul></ul>');for(i in structure){var div=$('<div></div>').attr('href','#').addClass('section-'+structure[i].index).data('textbox',context.$textarea).data('position',structure[i].position).bind('mousedown',function(event){$(this).data('textbox').focus().setSelection($(this).data('position')).scrollToCaretPosition(true);if(typeof $.trackAction!='undefined') |
| 154 | +$.trackAction('ntoc.heading');event.preventDefault();}).text(structure[i].text);if(structure[i].text=='') |
| 155 | +div.html(' ');var item=$('<li></li>').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
155 | 156 | list.append(item);} |
156 | 157 | return list;} |
157 | | -var outline=[];var wikitext=$.wikiEditor.fixOperaBrokenness(context.$textarea.val());var headings=wikitext.match(/^={1,6}.+={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;} |
| 158 | +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;} |
158 | 159 | var startLevel=0;for(var c=0;c<text.length;c++){if(text.charAt(c)=='='){startLevel++;}else{break;}} |
159 | 160 | var endLevel=0;for(var c=text.length-1;c>=0;c--){if(text.charAt(c)=='='){endLevel++;}else{break;}} |
160 | 161 | var level=Math.min(startLevel,endLevel);text=$.trim(text.substr(level,text.length-(level*2)));outline[h]={'text':text,'position':position,'level':level,'index':h+1};} |
— | — | @@ -161,5 +162,5 @@ |
162 | 163 | else if(outline[i].level<lastLevel){nLevel-=Math.max(1,lastLevel-outline[i].level);} |
163 | 164 | if(nLevel<=0){nLevel=1;} |
164 | 165 | outline[i].nLevel=nLevel;lastLevel=outline[i].level;} |
165 | | -var structure=buildStructure(outline);if($('input[name=wpSection]').val()=='') |
166 | | -structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});context.modules.$toc.html(buildList(structure));context.modules.$toc.find('ul').css('width','10em');var links=context.modules.$toc.find('ul a');links.addClass('currentSelection');links.autoEllipse({'position':'right','tooltip':true});links.removeClass('currentSelection');context.data.outline=outline;}}};})(jQuery); |
\ No newline at end of file |
| 166 | +var structure=buildStructure(outline);if($('input[name=wpSection]').val()==''){structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});} |
| 167 | +context.modules.$toc.html(buildList(structure));context.modules.$toc.find('div').autoEllipse({'position':'right','tooltip':true});context.data.outline=outline;}}};})(jQuery); |
\ No newline at end of file |
Index: branches/usability/acaifix/Makefile |
— | — | @@ -4,30 +4,34 @@ |
5 | 5 | # For more info on JSMin, see: http://www.crockford.com/javascript/jsmin.html |
6 | 6 | # |
7 | 7 | |
8 | | -CSS := css/suggestions.css\ |
9 | | - css/wikiEditor.css\ |
10 | | - css/wikiEditor.dialogs.css\ |
11 | | - css/wikiEditor.toc.css\ |
12 | | - css/wikiEditor.toolbar.css |
| 8 | +CSS := \ |
| 9 | + css/suggestions.css\ |
| 10 | + css/wikiEditor.css\ |
| 11 | + css/wikiEditor.dialogs.css\ |
| 12 | + css/wikiEditor.toc.css\ |
| 13 | + css/wikiEditor.toolbar.css |
13 | 14 | |
14 | | -JS2 := js/js2/jquery-1.3.2.js\ |
15 | | - js/js2/jquery-ui-1.7.2.js\ |
16 | | - js/js2/js2.js |
| 15 | +JS2 := \ |
| 16 | + js/js2/jquery-1.3.2.js\ |
| 17 | + js/js2/jquery-ui-1.7.2.js\ |
| 18 | + js/js2/js2.js |
17 | 19 | |
18 | | -PLUGINS := js/plugins/jquery.async.js\ |
19 | | - js/plugins/jquery.autoEllipse.js\ |
20 | | - js/plugins/jquery.browser.js\ |
21 | | - js/plugins/jquery.cookie.js\ |
22 | | - js/plugins/jquery.delayedBind.js\ |
23 | | - js/plugins/jquery.namespaceSelect.js\ |
24 | | - js/plugins/jquery.suggestions.js\ |
25 | | - js/plugins/jquery.textSelection.js\ |
26 | | - js/plugins/jquery.wikiEditor.js\ |
27 | | - js/plugins/jquery.wikiEditor.dialogs.js\ |
28 | | - js/plugins/jquery.wikiEditor.toolbar.js\ |
29 | | - js/plugins/jquery.wikiEditor.toc.js |
| 20 | +PLUGINS := \ |
| 21 | + js/plugins/jquery.async.js\ |
| 22 | + js/plugins/jquery.autoEllipse.js\ |
| 23 | + js/plugins/jquery.browser.js\ |
| 24 | + js/plugins/jquery.cookie.js\ |
| 25 | + js/plugins/jquery.delayedBind.js\ |
| 26 | + js/plugins/jquery.namespaceSelect.js\ |
| 27 | + js/plugins/jquery.suggestions.js\ |
| 28 | + js/plugins/jquery.textSelection.js\ |
| 29 | + js/plugins/jquery.wikiEditor.js\ |
| 30 | + js/plugins/jquery.wikiEditor.dialogs.js\ |
| 31 | + js/plugins/jquery.wikiEditor.toolbar.js\ |
| 32 | + js/plugins/jquery.wikiEditor.toc.js |
30 | 33 | |
31 | | -all: css/combined.css\ |
| 34 | +all: \ |
| 35 | + css/combined.css\ |
32 | 36 | css/combined.min.css\ |
33 | 37 | js/js2.combined.js\ |
34 | 38 | js/js2.combined.min.js\ |
— | — | @@ -43,17 +47,25 @@ |
44 | 48 | js/plugins.combined.js: $(PLUGINS) |
45 | 49 | cat $(PLUGINS) > js/plugins.combined.js |
46 | 50 | |
47 | | -js/js2.combined.min.js : js/js2.combined.js |
48 | | - jsmin < js/js2.combined.js > js/js2.combined.min.js |
| 51 | +js/js2.combined.min.js : js/js2.combined.js jsmin |
| 52 | + if [ -e ./jsmin ]; then ./jsmin < js/js2.combined.js > js/js2.combined.min.js;\ |
| 53 | + else jsmin < js/js2.combined.js > js/js2.combined.min.js; fi |
49 | 54 | |
50 | | -js/plugins.combined.min.js : js/plugins.combined.js |
51 | | - jsmin < js/plugins.combined.js > js/plugins.combined.min.js |
| 55 | +js/plugins.combined.min.js : js/plugins.combined.js jsmin |
| 56 | + if [ -e ./jsmin ]; then ./jsmin < js/plugins.combined.js > js/plugins.combined.min.js;\ |
| 57 | + else jsmin < js/plugins.combined.js > js/plugins.combined.min.js; fi |
52 | 58 | |
53 | 59 | css/combined.min.css : css/combined.css |
54 | | - cat css/combined.css |\ |
55 | | - sed -e 's/^[ ]*//g; s/[ ]*$$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$$/d'\ |
| 60 | + cat css/combined.css | sed -e 's/^[ ]*//g; s/[ ]*$$//g; s/\([:{;,]\) /\1/g; s/ {/{/g; s/\/\*.*\*\///g; /^$$/d'\ |
56 | 61 | > css/combined.min.css |
57 | 62 | |
| 63 | +jsmin: |
| 64 | + type -P jsmin &>/dev/null || ( wget http://www.crockford.com/javascript/jsmin.c; gcc jsmin.c -o jsmin ) |
| 65 | + |
| 66 | +distclean: clean |
| 67 | + rm -rf jsmin |
| 68 | + rm -rf jsmin.c |
| 69 | + |
58 | 70 | clean: |
59 | 71 | rm -f js/js2.combined.* |
60 | 72 | rm -f js/plugins.combined.* |
Index: branches/usability/acaifix/css/wikiEditor.toolbar.css |
— | — | @@ -11,7 +11,6 @@ |
12 | 12 | width: 100%; |
13 | 13 | clear: both; |
14 | 14 | height: 0; |
15 | | - overflow: hidden; |
16 | 15 | } |
17 | 16 | body.rtl .wikiEditor-ui-toolbar .sections { |
18 | 17 | float: right; |
Index: branches/usability/acaifix/css/wikiEditor.toc.css |
— | — | @@ -21,33 +21,55 @@ |
22 | 22 | } |
23 | 23 | .wikiEditor-ui-toc ul { |
24 | 24 | padding: 0; |
25 | | - margin: 0.5em 1em; |
| 25 | + margin: 0; |
26 | 26 | list-style: none; |
27 | 27 | /* IE needs to be told in great detail how to act, or it misbehaves */ |
28 | 28 | list-style-image: none; |
29 | 29 | list-style-position: outside; |
30 | 30 | list-style-type: none; |
| 31 | + width: 100%; |
31 | 32 | } |
| 33 | +.wikiEditor-ui-toc li { |
| 34 | + padding: 0; |
| 35 | + margin: 0; |
| 36 | +} |
32 | 37 | .wikiEditor-ui-toc ul ul { |
33 | 38 | padding: 0; |
34 | 39 | margin: 0; |
35 | | - margin-left: 0.75em; |
36 | 40 | margin-bottom: 0 !important; |
37 | 41 | margin-top: 0 !important; |
38 | 42 | list-style: none; |
39 | 43 | } |
40 | | -body.rtl .wikiEditor-ui-toc ul ul { |
41 | | - margin-left: 0; |
42 | | - margin-right: 0.75em; |
43 | | -} |
44 | | -.wikiEditor-ui-toc ul li a { |
| 44 | +.wikiEditor-ui-toc ul li div { |
45 | 45 | display: block; |
46 | 46 | font-size: 0.9em; |
| 47 | + padding: 0.125em; |
| 48 | + padding-left: 1em; |
| 49 | + cursor: pointer; |
| 50 | + color: #0645ad; |
47 | 51 | } |
48 | | -.wikiEditor-ui-toc ul li a.currentSelection { |
49 | | - font-weight: bold; |
| 52 | +.wikiEditor-ui-toc ul ul li div { |
| 53 | + padding-left: 2em; |
50 | 54 | } |
51 | | -.wikiEditor-ui-toc ul li a.section-0 { |
| 55 | +.wikiEditor-ui-toc ul ul ul li div { |
| 56 | + padding-left: 3em; |
| 57 | +} |
| 58 | +.wikiEditor-ui-toc ul ul ul ul li div { |
| 59 | + padding-left: 4em; |
| 60 | +} |
| 61 | +.wikiEditor-ui-toc ul ul ul ul ul li div { |
| 62 | + padding-left: 5em; |
| 63 | +} |
| 64 | +.wikiEditor-ui-toc ul ul ul ul ul ul li div { |
| 65 | + padding-left: 6em; |
| 66 | +} |
| 67 | +.wikiEditor-ui-toc ul li div.current { |
| 68 | + background-color: #FAFAFA; |
| 69 | + color: #333333; |
| 70 | +} |
| 71 | +.wikiEditor-ui-toc ul li div.section-0 { |
52 | 72 | font-size: 1em; |
| 73 | + padding-top: 0.5em; |
| 74 | + padding-bottom: 0.5em; |
53 | 75 | border-bottom: solid 1px #DDDDDD; |
54 | | -} |
\ No newline at end of file |
| 76 | +} |
Index: branches/usability/acaifix/css/combined.css |
— | — | @@ -126,36 +126,59 @@ |
127 | 127 | } |
128 | 128 | .wikiEditor-ui-toc ul { |
129 | 129 | padding: 0; |
130 | | - margin: 0.5em 1em; |
| 130 | + margin: 0; |
131 | 131 | list-style: none; |
132 | 132 | /* IE needs to be told in great detail how to act, or it misbehaves */ |
133 | 133 | list-style-image: none; |
134 | 134 | list-style-position: outside; |
135 | 135 | list-style-type: none; |
| 136 | + width: 100%; |
136 | 137 | } |
| 138 | +.wikiEditor-ui-toc li { |
| 139 | + padding: 0; |
| 140 | + margin: 0; |
| 141 | +} |
137 | 142 | .wikiEditor-ui-toc ul ul { |
138 | 143 | padding: 0; |
139 | 144 | margin: 0; |
140 | | - margin-left: 0.75em; |
141 | 145 | margin-bottom: 0 !important; |
142 | 146 | margin-top: 0 !important; |
143 | 147 | list-style: none; |
144 | 148 | } |
145 | | -body.rtl .wikiEditor-ui-toc ul ul { |
146 | | - margin-left: 0; |
147 | | - margin-right: 0.75em; |
148 | | -} |
149 | | -.wikiEditor-ui-toc ul li a { |
| 149 | +.wikiEditor-ui-toc ul li div { |
150 | 150 | display: block; |
151 | 151 | font-size: 0.9em; |
| 152 | + padding: 0.125em; |
| 153 | + padding-left: 1em; |
| 154 | + cursor: pointer; |
| 155 | + color: #0645ad; |
152 | 156 | } |
153 | | -.wikiEditor-ui-toc ul li a.currentSelection { |
154 | | - font-weight: bold; |
| 157 | +.wikiEditor-ui-toc ul ul li div { |
| 158 | + padding-left: 2em; |
155 | 159 | } |
156 | | -.wikiEditor-ui-toc ul li a.section-0 { |
| 160 | +.wikiEditor-ui-toc ul ul ul li div { |
| 161 | + padding-left: 3em; |
| 162 | +} |
| 163 | +.wikiEditor-ui-toc ul ul ul ul li div { |
| 164 | + padding-left: 4em; |
| 165 | +} |
| 166 | +.wikiEditor-ui-toc ul ul ul ul ul li div { |
| 167 | + padding-left: 5em; |
| 168 | +} |
| 169 | +.wikiEditor-ui-toc ul ul ul ul ul ul li div { |
| 170 | + padding-left: 6em; |
| 171 | +} |
| 172 | +.wikiEditor-ui-toc ul li div.current { |
| 173 | + background-color: #FAFAFA; |
| 174 | + color: #333333; |
| 175 | +} |
| 176 | +.wikiEditor-ui-toc ul li div.section-0 { |
157 | 177 | font-size: 1em; |
| 178 | + padding-top: 0.5em; |
| 179 | + padding-bottom: 0.5em; |
158 | 180 | border-bottom: solid 1px #DDDDDD; |
159 | | -}/* wikiEditor toolbar module */ |
| 181 | +} |
| 182 | +/* wikiEditor toolbar module */ |
160 | 183 | |
161 | 184 | .wikiEditor-ui-toolbar { |
162 | 185 | position: relative; |
— | — | @@ -168,7 +191,6 @@ |
169 | 192 | width: 100%; |
170 | 193 | clear: both; |
171 | 194 | height: 0; |
172 | | - overflow: hidden; |
173 | 195 | } |
174 | 196 | body.rtl .wikiEditor-ui-toolbar .sections { |
175 | 197 | float: right; |
Index: branches/usability/acaifix/css/combined.min.css |
— | — | @@ -114,33 +114,55 @@ |
115 | 115 | } |
116 | 116 | .wikiEditor-ui-toc ul{ |
117 | 117 | padding:0; |
118 | | -margin:0.5em 1em; |
| 118 | +margin:0; |
119 | 119 | list-style:none; |
120 | 120 | list-style-image:none; |
121 | 121 | list-style-position:outside; |
122 | 122 | list-style-type:none; |
| 123 | +width:100%; |
123 | 124 | } |
| 125 | +.wikiEditor-ui-toc li{ |
| 126 | +padding:0; |
| 127 | +margin:0; |
| 128 | +} |
124 | 129 | .wikiEditor-ui-toc ul ul{ |
125 | 130 | padding:0; |
126 | 131 | margin:0; |
127 | | -margin-left:0.75em; |
128 | 132 | margin-bottom:0 !important; |
129 | 133 | margin-top:0 !important; |
130 | 134 | list-style:none; |
131 | 135 | } |
132 | | -body.rtl .wikiEditor-ui-toc ul ul{ |
133 | | -margin-left:0; |
134 | | -margin-right:0.75em; |
135 | | -} |
136 | | -.wikiEditor-ui-toc ul li a{ |
| 136 | +.wikiEditor-ui-toc ul li div{ |
137 | 137 | display:block; |
138 | 138 | font-size:0.9em; |
| 139 | +padding:0.125em; |
| 140 | +padding-left:1em; |
| 141 | +cursor:pointer; |
| 142 | +color:#0645ad; |
139 | 143 | } |
140 | | -.wikiEditor-ui-toc ul li a.currentSelection{ |
141 | | -font-weight:bold; |
| 144 | +.wikiEditor-ui-toc ul ul li div{ |
| 145 | +padding-left:2em; |
142 | 146 | } |
143 | | -.wikiEditor-ui-toc ul li a.section-0{ |
| 147 | +.wikiEditor-ui-toc ul ul ul li div{ |
| 148 | +padding-left:3em; |
| 149 | +} |
| 150 | +.wikiEditor-ui-toc ul ul ul ul li div{ |
| 151 | +padding-left:4em; |
| 152 | +} |
| 153 | +.wikiEditor-ui-toc ul ul ul ul ul li div{ |
| 154 | +padding-left:5em; |
| 155 | +} |
| 156 | +.wikiEditor-ui-toc ul ul ul ul ul ul li div{ |
| 157 | +padding-left:6em; |
| 158 | +} |
| 159 | +.wikiEditor-ui-toc ul li div.current{ |
| 160 | +background-color:#FAFAFA; |
| 161 | +color:#333333; |
| 162 | +} |
| 163 | +.wikiEditor-ui-toc ul li div.section-0{ |
144 | 164 | font-size:1em; |
| 165 | +padding-top:0.5em; |
| 166 | +padding-bottom:0.5em; |
145 | 167 | border-bottom:solid 1px #DDDDDD; |
146 | 168 | } |
147 | 169 | .wikiEditor-ui-toolbar{ |
— | — | @@ -152,7 +174,6 @@ |
153 | 175 | width:100%; |
154 | 176 | clear:both; |
155 | 177 | height:0; |
156 | | -overflow:hidden; |
157 | 178 | } |
158 | 179 | body.rtl .wikiEditor-ui-toolbar .sections{ |
159 | 180 | float:right; |
— | — | @@ -459,4 +480,4 @@ |
460 | 481 | background-color:white; |
461 | 482 | text-decoration:none; |
462 | 483 | border-color:#a8d7f9; |
463 | | -} |
| 484 | +} |
\ No newline at end of file |
Index: branches/usability/acaifix/NavigableTOC/NavigableTOC.php |
— | — | @@ -27,7 +27,7 @@ |
28 | 28 | $wgNavigableTOCUserEnable = true; |
29 | 29 | |
30 | 30 | // Bump the version number every time you change any of the .css/.js files |
31 | | -$wgNavigableTOCStyleVersion = 3; |
| 31 | +$wgNavigableTOCStyleVersion = 6; |
32 | 32 | |
33 | 33 | /* Setup */ |
34 | 34 | |