Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -22,16 +22,16 @@ |
23 | 23 | array( 'src' => 'css/wikiEditor.css', 'version' => 7 ), |
24 | 24 | array( 'src' => 'css/wikiEditor.toolbar.css', 'version' => 8 ), |
25 | 25 | array( 'src' => 'css/wikiEditor.dialogs.css', 'version' => 6 ), |
26 | | - array( 'src' => 'css/wikiEditor.toc.css', 'version' => 24 ), |
| 26 | + array( 'src' => 'css/wikiEditor.toc.css', 'version' => 25 ), |
27 | 27 | array( 'src' => 'css/wikiEditor.preview.css', 'version' => 1 ), |
28 | 28 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
29 | 29 | ), |
30 | 30 | 'combined' => array( |
31 | | - array( 'src' => 'css/combined.css', 'version' => 36 ), |
| 31 | + array( 'src' => 'css/combined.css', 'version' => 37 ), |
32 | 32 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
33 | 33 | ), |
34 | 34 | 'minified' => array( |
35 | | - array( 'src' => 'css/combined.min.css', 'version' => 36 ), |
| 35 | + array( 'src' => 'css/combined.min.css', 'version' => 37 ), |
36 | 36 | array( 'src' => 'css/vector/jquery-ui-1.7.2.css', 'version' => '1.7.2y' ), |
37 | 37 | ), |
38 | 38 | ) |
— | — | @@ -74,16 +74,16 @@ |
75 | 75 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 36 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ), |
78 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 48 ), |
| 78 | + array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 49 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 7 ), |
80 | 80 | array( 'src' => 'js/plugins/jquery.wikiEditor.templateEditor.js', 'version' => 1 ), |
81 | 81 | array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ), |
82 | 82 | ), |
83 | 83 | 'combined' => array( |
84 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 102 ), |
| 84 | + array( 'src' => 'js/plugins.combined.js', 'version' => 103 ), |
85 | 85 | ), |
86 | 86 | 'minified' => array( |
87 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 102 ), |
| 87 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 103 ), |
88 | 88 | ), |
89 | 89 | ), |
90 | 90 | ); |
Index: trunk/extensions/UsabilityInitiative/css/wikiEditor.toc.css |
— | — | @@ -1,8 +1,4 @@ |
2 | 2 | /* wikiEditor toc module */ |
3 | | -body.rtl .wikiEditor-ui-text { |
4 | | - border-right: none; |
5 | | - border-left: solid silver 1px; |
6 | | -} |
7 | 3 | .wikiEditor-ui-toc { |
8 | 4 | /* height and width are set dynamically */ |
9 | 5 | /*float: right;*/ |
— | — | @@ -10,17 +6,13 @@ |
11 | 7 | overflow: auto; |
12 | 8 | overflow-x: hidden; |
13 | 9 | } |
14 | | -body.rtl .wikiEditor-ui-toc { |
15 | | - /* |
16 | | - float: left; |
17 | | - right: auto; |
18 | | - left: -1px; |
19 | | - border-left: none; |
20 | | - */ |
21 | | -} |
22 | 10 | .wikiEditor-ui-toc { |
23 | 11 | border-left: solid silver 1px; |
24 | 12 | } |
| 13 | +body.rtl .wikiEditor-ui-toc { |
| 14 | + border-right: solid silver 1px; |
| 15 | + border-left: none; |
| 16 | +} |
25 | 17 | .wikiEditor-ui-toc ul { |
26 | 18 | padding: 0; |
27 | 19 | margin: 0; |
— | — | @@ -31,10 +23,6 @@ |
32 | 24 | list-style-type: none; |
33 | 25 | width: 100%; |
34 | 26 | } |
35 | | -body.rtl .wikiEditor-ui-toc ul { |
36 | | - border-left: none; |
37 | | - border-right: solid silver 1px; |
38 | | -} |
39 | 27 | .tab-toc { |
40 | 28 | /* Should match the toolbar */ |
41 | 29 | background-image: url(../images/wikiEditor/toolbar/base.png); |
— | — | @@ -50,7 +38,7 @@ |
51 | 39 | } |
52 | 40 | body.rtl .tab-toc { |
53 | 41 | background-position: right top; |
54 | | - padding-right: 1em; |
| 42 | + padding-right: 2em; |
55 | 43 | } |
56 | 44 | .tab-toc a { |
57 | 45 | outline: none; |
— | — | @@ -182,6 +170,9 @@ |
183 | 171 | background: url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat; |
184 | 172 | z-index: 0; |
185 | 173 | } |
| 174 | +body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip { |
| 175 | + right: 2px !important; |
| 176 | +} |
186 | 177 | .wikiEditor-ui-toolbar .tab-toc { |
187 | 178 | float: right; |
188 | 179 | margin: 3px 16px 3px 3px; |
Index: trunk/extensions/UsabilityInitiative/css/combined.css |
— | — | @@ -193,10 +193,6 @@ |
194 | 194 | body.rtl .ui-dialog .ui-dialog-buttonpane button { |
195 | 195 | float: left; |
196 | 196 | }/* wikiEditor toc module */ |
197 | | -body.rtl .wikiEditor-ui-text { |
198 | | - border-right: none; |
199 | | - border-left: solid silver 1px; |
200 | | -} |
201 | 197 | .wikiEditor-ui-toc { |
202 | 198 | /* height and width are set dynamically */ |
203 | 199 | /*float: right;*/ |
— | — | @@ -204,17 +200,13 @@ |
205 | 201 | overflow: auto; |
206 | 202 | overflow-x: hidden; |
207 | 203 | } |
208 | | -body.rtl .wikiEditor-ui-toc { |
209 | | - /* |
210 | | - float: left; |
211 | | - right: auto; |
212 | | - left: -1px; |
213 | | - border-left: none; |
214 | | - */ |
215 | | -} |
216 | 204 | .wikiEditor-ui-toc { |
217 | 205 | border-left: solid silver 1px; |
218 | 206 | } |
| 207 | +body.rtl .wikiEditor-ui-toc { |
| 208 | + border-right: solid silver 1px; |
| 209 | + border-left: none; |
| 210 | +} |
219 | 211 | .wikiEditor-ui-toc ul { |
220 | 212 | padding: 0; |
221 | 213 | margin: 0; |
— | — | @@ -225,10 +217,6 @@ |
226 | 218 | list-style-type: none; |
227 | 219 | width: 100%; |
228 | 220 | } |
229 | | -body.rtl .wikiEditor-ui-toc ul { |
230 | | - border-left: none; |
231 | | - border-right: solid silver 1px; |
232 | | -} |
233 | 221 | .tab-toc { |
234 | 222 | /* Should match the toolbar */ |
235 | 223 | background-image: url(../images/wikiEditor/toolbar/base.png); |
— | — | @@ -244,7 +232,7 @@ |
245 | 233 | } |
246 | 234 | body.rtl .tab-toc { |
247 | 235 | background-position: right top; |
248 | | - padding-right: 1em; |
| 236 | + padding-right: 2em; |
249 | 237 | } |
250 | 238 | .tab-toc a { |
251 | 239 | outline: none; |
— | — | @@ -376,6 +364,9 @@ |
377 | 365 | background: url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat; |
378 | 366 | z-index: 0; |
379 | 367 | } |
| 368 | +body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip { |
| 369 | + right: 2px !important; |
| 370 | +} |
380 | 371 | .wikiEditor-ui-toolbar .tab-toc { |
381 | 372 | float: right; |
382 | 373 | margin: 3px 16px 3px 3px; |
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css |
— | — | @@ -181,26 +181,18 @@ |
182 | 182 | body.rtl .ui-dialog .ui-dialog-buttonpane button{ |
183 | 183 | float:left; |
184 | 184 | } |
185 | | -body.rtl .wikiEditor-ui-text{ |
186 | | -border-right:none; |
187 | | -border-left:solid silver 1px; |
188 | | -} |
189 | 185 | .wikiEditor-ui-toc{ |
190 | 186 | padding:0; |
191 | 187 | overflow:auto; |
192 | 188 | overflow-x:hidden; |
193 | 189 | } |
194 | | -body.rtl .wikiEditor-ui-toc{ |
195 | | -/* |
196 | | -float:left; |
197 | | -right:auto; |
198 | | -left:-1px; |
199 | | -border-left:none; |
200 | | -*/ |
201 | | -} |
202 | 190 | .wikiEditor-ui-toc{ |
203 | 191 | border-left:solid silver 1px; |
204 | 192 | } |
| 193 | +body.rtl .wikiEditor-ui-toc{ |
| 194 | +border-right:solid silver 1px; |
| 195 | +border-left:none; |
| 196 | +} |
205 | 197 | .wikiEditor-ui-toc ul{ |
206 | 198 | padding:0; |
207 | 199 | margin:0; |
— | — | @@ -210,10 +202,6 @@ |
211 | 203 | list-style-type:none; |
212 | 204 | width:100%; |
213 | 205 | } |
214 | | -body.rtl .wikiEditor-ui-toc ul{ |
215 | | -border-left:none; |
216 | | -border-right:solid silver 1px; |
217 | | -} |
218 | 206 | .tab-toc{ |
219 | 207 | background-image:url(../images/wikiEditor/toolbar/base.png); |
220 | 208 | background-position:left top; |
— | — | @@ -228,7 +216,7 @@ |
229 | 217 | } |
230 | 218 | body.rtl .tab-toc{ |
231 | 219 | background-position:right top; |
232 | | -padding-right:1em; |
| 220 | +padding-right:2em; |
233 | 221 | } |
234 | 222 | .tab-toc a{ |
235 | 223 | outline:none; |
— | — | @@ -352,6 +340,9 @@ |
353 | 341 | background:url(../images/wikiEditor/toc/grip.png) 50% 50% no-repeat; |
354 | 342 | z-index:0; |
355 | 343 | } |
| 344 | +body.rtl .wikiEditor-ui-right .wikiEditor-ui-toc-resize-grip{ |
| 345 | +right:2px !important; |
| 346 | +} |
356 | 347 | .wikiEditor-ui-toolbar .tab-toc{ |
357 | 348 | float:right; |
358 | 349 | margin:3px 16px 3px 3px; |
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js |
— | — | @@ -1704,7 +1704,7 @@ |
1705 | 1705 | if ( !wgWikiEditorPreferences || !( wgWikiEditorPreferences.templateEditor && wgWikiEditorPreferences.templateEditor.enable ) ) { |
1706 | 1706 | return true; |
1707 | 1707 | } |
1708 | | - // Add the highlight module |
| 1708 | + // Add the templateEditor module |
1709 | 1709 | if ( $j.wikiEditor ) { |
1710 | 1710 | $j( 'textarea#wpTextbox1' ).wikiEditor( 'addModule', 'templateEditor' ); |
1711 | 1711 | } |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toc.js |
— | — | @@ -1,6 +1,6 @@ |
2 | 2 | /* TOC Module for wikiEditor */ |
3 | 3 | ( function( $ ) { $.wikiEditor.modules.toc = { |
4 | | - |
| 4 | + |
5 | 5 | /** |
6 | 6 | * Default width of table of contents |
7 | 7 | */ |
— | — | @@ -40,6 +40,12 @@ |
41 | 41 | context.$textarea.delayedBindCancel( 250, 'mouseup scrollToTop keyup change' ); |
42 | 42 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
43 | 43 | }); |
| 44 | + }, |
| 45 | + resize: function( context, event ) { |
| 46 | + context.modules.toc.$toc.height( |
| 47 | + context.$ui.find( '.wikiEditor-ui-left' ).height() - |
| 48 | + context.$ui.find( '.tab-toc' ).outerHeight() |
| 49 | + ); |
44 | 50 | } |
45 | 51 | }, |
46 | 52 | /** |
— | — | @@ -255,6 +261,7 @@ |
256 | 262 | .text( gM( 'wikieditor-toc-show' ) ); |
257 | 263 | $collapseControl.insertBefore( context.modules.toc.$toc ); |
258 | 264 | context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl ); |
| 265 | + context.fn.trigger( 'resize' ); |
259 | 266 | } |
260 | 267 | /** |
261 | 268 | * Initializes resizing controls on the TOC and sets the width of |
— | — | @@ -299,9 +306,10 @@ |
300 | 307 | } |
301 | 308 | }); |
302 | 309 | // Convert our east resize handle into a secondary west resize handle |
303 | | - context.$ui.find( '.ui-resizable-e' ) |
304 | | - .removeClass( 'ui-resizable-e' ) |
305 | | - .addClass( 'ui-resizable-w' ) |
| 310 | + var handle = $j( 'body' ).is( '.rtl' ) ? 'w' : 'e' |
| 311 | + context.$ui.find( '.ui-resizable-' + handle ) |
| 312 | + .removeClass( 'ui-resizable-' + handle ) |
| 313 | + .addClass( 'ui-resizable-' + ( handle == 'w' ? 'e' : 'w' ) ) |
306 | 314 | .addClass( 'wikiEditor-ui-toc-resize-grip' ); |
307 | 315 | // Bind collapse and expand event handlers to the TOC |
308 | 316 | context.modules.toc.$toc |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1515,6 +1515,7 @@ |
1516 | 1516 | } |
1517 | 1517 | }; |
1518 | 1518 | // Allow modules to extend the API |
| 1519 | + if($.wikiEditor.modules){ |
1519 | 1520 | for ( module in $.wikiEditor.modules ) { |
1520 | 1521 | if ( 'api' in $.wikiEditor.modules[module] ) { |
1521 | 1522 | for ( call in $.wikiEditor.modules[module].api ) { |
— | — | @@ -1525,7 +1526,7 @@ |
1526 | 1527 | } |
1527 | 1528 | } |
1528 | 1529 | } |
1529 | | - } |
| 1530 | + }} |
1530 | 1531 | |
1531 | 1532 | /* |
1532 | 1533 | * Event Handlers |
— | — | @@ -1562,6 +1563,7 @@ |
1563 | 1564 | |
1564 | 1565 | /* Internal Functions */ |
1565 | 1566 | |
| 1567 | + //$(this).data( 'wikiEditor-context', context ); |
1566 | 1568 | context.fn = { |
1567 | 1569 | 'trigger': function( name, event ) { |
1568 | 1570 | // Event is an optional argument, but from here on out, at least the type field should be dependable |
— | — | @@ -1648,7 +1650,11 @@ |
1649 | 1651 | context.$content = $( context.$iframe[0].contentWindow.document.body ); |
1650 | 1652 | // We need to properly escape any HTML entities like &, < and > so they end up as visible |
1651 | 1653 | // characters rather than actual HTML tags in the code editor container. |
1652 | | - context.$content.append( $( '<div />' ).text( context.$textarea.val() ).html() ); |
| 1654 | + |
| 1655 | + context.$content.append( |
| 1656 | + context.$textarea.val().replace( /</g, '<' ).replace( />/g, '>' ) |
| 1657 | + ); |
| 1658 | + |
1653 | 1659 | // Reflect direction of parent frame into child |
1654 | 1660 | if ( $( 'body' ).is( '.rtl' ) ) { |
1655 | 1661 | context.$content.addClass( 'rtl' ).attr( 'dir', 'rtl' ); |
— | — | @@ -1673,12 +1679,13 @@ |
1674 | 1680 | * Gets the complete contents of the iframe |
1675 | 1681 | */ |
1676 | 1682 | 'getContents': function() { |
| 1683 | + // FIXME: Evil ua-sniffing action! |
| 1684 | + if ( $.browser.name == 'msie' ) { |
| 1685 | + return context.$content.text(); |
| 1686 | + } |
1677 | 1687 | // We use .html() instead of .text() so HTML entities are handled right |
1678 | 1688 | // Setting the HTML of the textarea doesn't work on all browsers, use a dummy <div> instead |
1679 | | - |
1680 | | - return $( '<div />' ) |
1681 | | - .html( context.$content.html().replace( /\<br\>/g, "\n" ) ) |
1682 | | - .text(); |
| 1689 | + return $( '<div />' ).html( context.$content.html().replace( /\<br\>/g, "\n" ) ).text(); |
1683 | 1690 | }, |
1684 | 1691 | 'setContents': function( options ) { |
1685 | 1692 | context.$content.text( options.contents ); |
— | — | @@ -2106,7 +2113,7 @@ |
2107 | 2114 | * Internally used event handlers |
2108 | 2115 | */ |
2109 | 2116 | evt: { |
2110 | | - change: function( event ) { |
| 2117 | + change: function( context, event ) { |
2111 | 2118 | /* |
2112 | 2119 | * Triggered on any of the following events, with the intent on detecting if something was added, deleted or |
2113 | 2120 | * replaced due to user action. |
— | — | @@ -2129,8 +2136,13 @@ |
2130 | 2137 | * ; Definition |
2131 | 2138 | * : Definition |
2132 | 2139 | */ |
| 2140 | + if(event.data.scope == 'do_not_trigger'){ |
| 2141 | + $.wikiEditor.modules.highlight.fn.scan(context, ""); |
| 2142 | + $.wikiEditor.modules.highlight.fn.mark(context, "", ""); |
| 2143 | + } |
2133 | 2144 | } |
2134 | 2145 | }, |
| 2146 | + |
2135 | 2147 | /** |
2136 | 2148 | * Internally used functions |
2137 | 2149 | */ |
— | — | @@ -2157,17 +2169,75 @@ |
2158 | 2170 | strip: function( context, division ) { |
2159 | 2171 | return $( '<div />' ).html( division.html().replace( /\<br[^\>]*\>/g, "\n" ) ).text(); |
2160 | 2172 | }, |
| 2173 | + tokenArray : [], |
2161 | 2174 | scan: function( context, division ) { |
2162 | 2175 | /* |
2163 | 2176 | * We need to look over some text and find interesting areas, then return the positions of those areas as tokens |
2164 | 2177 | */ |
2165 | | - return []; // array of tokens? |
| 2178 | + token = function(offset, label){ |
| 2179 | + this.offset = offset; |
| 2180 | + this.label = label; |
| 2181 | + } |
| 2182 | + |
| 2183 | + this.tokenArray = new Array(); |
| 2184 | + var text = context.fn.getContents(); |
| 2185 | + for ( module in $.wikiEditor.modules ) { |
| 2186 | + if ( 'exp' in $.wikiEditor.modules[module] ) { |
| 2187 | + for(var i = 0; i < $.wikiEditor.modules[module].exp.length; i++){ |
| 2188 | + var regex = $.wikiEditor.modules[module].exp[i].regex; |
| 2189 | + var label = $.wikiEditor.modules[module].exp[i].label; |
| 2190 | + var markAfter = false; |
| 2191 | + if(typeof($.wikiEditor.modules[module].exp[i].markAfter) != 'undefined'){ |
| 2192 | + markAfter = true; |
| 2193 | + } |
| 2194 | + match = text.match(regex); |
| 2195 | + var oldOffset = 0; |
| 2196 | + while(match != null){ |
| 2197 | + var markOffset = 0; |
| 2198 | + if(markAfter){ |
| 2199 | + markOffset += match[0].length; |
| 2200 | + } |
| 2201 | + this.tokenArray.push(new token(match.index + oldOffset + markOffset, label)); |
| 2202 | + oldOffset += (match.index + match[0].length); |
| 2203 | + newSubstring = text.substring(oldOffset); |
| 2204 | + match = newSubstring.match(regex); |
| 2205 | + } |
| 2206 | + } |
| 2207 | + } |
| 2208 | + } |
| 2209 | + |
| 2210 | + return this.tokenArray; // array of tokens |
2166 | 2211 | }, |
| 2212 | + markers: [], |
2167 | 2213 | mark: function( context, division, tokens ) { |
2168 | 2214 | /* |
2169 | 2215 | * We need to markup some text based on some tokens |
2170 | 2216 | */ |
2171 | | - } |
| 2217 | + var rawText = context.fn.getContents(); |
| 2218 | + |
| 2219 | + |
| 2220 | + //get all markers |
| 2221 | + for ( module in $.wikiEditor.modules ) { |
| 2222 | + if ( 'evt' in $.wikiEditor.modules[module] && 'mark' in $.wikiEditor.modules[module].evt) { |
| 2223 | + $.wikiEditor.modules[module].evt.mark(); |
| 2224 | + } |
| 2225 | + } |
| 2226 | + markedText = ""; |
| 2227 | + var previousIndex = 0; |
| 2228 | + for(var currentIndex in this.markers){ |
| 2229 | + markedText+= rawText.substring(previousIndex, currentIndex); |
| 2230 | + |
| 2231 | + for(var i = 0 ; i < this.markers[currentIndex].length; i++){ |
| 2232 | + markedText += this.markers[currentIndex][i]; |
| 2233 | + } |
| 2234 | + |
| 2235 | + previousIndex = currentIndex; |
| 2236 | + } |
| 2237 | + if(markedText != ""){ |
| 2238 | + markedText.replace(/\n/g, '<br\>'); |
| 2239 | + context.fn.setContents({contents:markedText}); |
| 2240 | + } |
| 2241 | + }//endmark |
2172 | 2242 | } |
2173 | 2243 | |
2174 | 2244 | }; })( jQuery );/* Preview module for wikiEditor */ |
— | — | @@ -2429,7 +2499,7 @@ |
2430 | 2500 | |
2431 | 2501 | }; } )( jQuery );/* TOC Module for wikiEditor */ |
2432 | 2502 | ( function( $ ) { $.wikiEditor.modules.toc = { |
2433 | | - |
| 2503 | + |
2434 | 2504 | /** |
2435 | 2505 | * Default width of table of contents |
2436 | 2506 | */ |
— | — | @@ -2469,6 +2539,12 @@ |
2470 | 2540 | context.$textarea.delayedBindCancel( 250, 'mouseup scrollToTop keyup change' ); |
2471 | 2541 | $.wikiEditor.modules.toc.fn.unhighlight( context ); |
2472 | 2542 | }); |
| 2543 | + }, |
| 2544 | + resize: function( context, event ) { |
| 2545 | + context.modules.toc.$toc.height( |
| 2546 | + context.$ui.find( '.wikiEditor-ui-left' ).height() - |
| 2547 | + context.$ui.find( '.tab-toc' ).outerHeight() |
| 2548 | + ); |
2473 | 2549 | } |
2474 | 2550 | }, |
2475 | 2551 | /** |
— | — | @@ -2684,6 +2760,7 @@ |
2685 | 2761 | .text( gM( 'wikieditor-toc-show' ) ); |
2686 | 2762 | $collapseControl.insertBefore( context.modules.toc.$toc ); |
2687 | 2763 | context.$ui.find( '.wikiEditor-ui-left .wikiEditor-ui-top' ).append( $expandControl ); |
| 2764 | + context.fn.trigger( 'resize' ); |
2688 | 2765 | } |
2689 | 2766 | /** |
2690 | 2767 | * Initializes resizing controls on the TOC and sets the width of |
— | — | @@ -2728,9 +2805,10 @@ |
2729 | 2806 | } |
2730 | 2807 | }); |
2731 | 2808 | // Convert our east resize handle into a secondary west resize handle |
2732 | | - context.$ui.find( '.ui-resizable-e' ) |
2733 | | - .removeClass( 'ui-resizable-e' ) |
2734 | | - .addClass( 'ui-resizable-w' ) |
| 2809 | + var handle = $j( 'body' ).is( '.rtl' ) ? 'w' : 'e' |
| 2810 | + context.$ui.find( '.ui-resizable-' + handle ) |
| 2811 | + .removeClass( 'ui-resizable-' + handle ) |
| 2812 | + .addClass( 'ui-resizable-' + ( handle == 'w' ? 'e' : 'w' ) ) |
2735 | 2813 | .addClass( 'wikiEditor-ui-toc-resize-grip' ); |
2736 | 2814 | // Bind collapse and expand event handlers to the TOC |
2737 | 2815 | context.modules.toc.$toc |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}},'getIcon':function(icon,path,lang){lang=lang||wgUserLanguage;path=path||$.wikiEditor.imgPath;var src=icon[lang]||icon['default']||icon;if(src.substr(0,7)!='http://'&&src.substr(0,8)!='https://'&&src[0]!='/') |
91 | 91 | src=path+src;return src+'?'+wgWikiEditorIconVersion;},'fixOperaBrokenness':function(s){return s;}};$.fn.wikiEditor=function(){if($j.wikiEditor.isSupportKnown()&&!$j.wikiEditor.isSupported()){return $(this);} |
92 | 92 | var context=$(this).data('wikiEditor-context');if(typeof context=='undefined'){var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'views':{},'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);context.api={'addModule':function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){context.modules[module]={};$.wikiEditor.modules[module].fn[call](context,data);}} |
93 | | -if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}} |
| 93 | +if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};if($.wikiEditor.modules){for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}}} |
94 | 94 | context.evt={'change':function(event){switch(event.type){case'keypress':if(true){event.data.scope='division';}else{event.data.scope='character';} |
95 | 95 | break;case'mousedown':if(true){event.data.scope='division';}else{return false;} |
96 | 96 | break;default:event.data.scope='division';break;} |
— | — | @@ -99,8 +99,9 @@ |
100 | 100 | for(module in context.modules){if(module in $.wikiEditor.modules&&'evt'in $.wikiEditor.modules[module]&&name in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt[name](context,event);}}},'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);} |
101 | 101 | event.preventDefault();return false;}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
102 | 102 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
103 | | -addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append($('<div />').text(context.$textarea.val()).html());if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
104 | | -context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
| 103 | +addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);context.$content.append(context.$textarea.val().replace(/</g,'<').replace(/>/g,'>'));if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
| 104 | +context.$textarea.attr('disabled',true);context.$textarea.hide();context.$iframe.show();context.fn.trigger('ready');},'isSetup':function(){return context.$content!=undefined&&context.$content[0].innerHTML!=undefined;},'getContents':function(){if($.browser.name=='msie'){return context.$content.text();} |
| 105 | +return $('<div />').html(context.$content.html().replace(/\<br\>/g,"\n")).text();},'setContents':function(options){context.$content.text(options.contents);return context.$textarea;},'getSelection':function(){var retval;if(context.$iframe[0].contentWindow.getSelection){retval=context.$iframe[0].contentWindow.getSelection();}else if(context.$iframe[0].contentWindow.document.selection){retval=context.$iframe[0].contentWindow.document.selection.createRange();} |
105 | 106 | if(retval.text){retval=retval.text;}else if(retval.toString){retval=retval.toString();} |
106 | 107 | return retval;},'encapsulateSelection':function(options){var selText=$(this).textSelection('getSelection');var selectAfter=false;var pre=options.pre,post=options.post;if(!selText){selText=options.peri;selectAfter=true;}else if(options.replace){selText=options.peri;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' ';} |
107 | 108 | var range=context.$iframe[0].contentWindow.getSelection().getRangeAt(0);if(options.ownline){if(range.startOffset!=0) |
— | — | @@ -123,7 +124,14 @@ |
124 | 125 | dialogDiv.bind('dialogopen',$.wikiEditor.modules.dialogs.fn.resize).find('.ui-tabs').bind('tabsshow',function(){$(this).closest('.ui-dialog-content').each($.wikiEditor.modules.dialogs.fn.resize);});var maxTI=0;$j('[tabindex]').each(function(){var ti=parseInt($j(this).attr('tabindex'));if(ti>maxTI) |
125 | 126 | maxTI=ti;});var tabIndex=maxTI+1;$j('.ui-dialog input, .ui-dialog button').not('[tabindex]').each(function(){$j(this).attr('tabindex',tabIndex++);});}}});},resize:function(){var wrapper=$(this).closest('.ui-dialog');var oldWidth=wrapper.width();var oldHidden=$(this).find('*').not(':visible');oldHidden.each(function(){$(this).data('oldstyle',$(this).attr('style'));});oldHidden.show();var oldWS=$(this).css('white-space');$(this).css('white-space','nowrap');if(wrapper.width()<=$(this).get(0).scrollWidth){var thisWidth=$(this).data('thisWidth')?$(this).data('thisWidth'):0;thisWidth=Math.max($(this).get(0).scrollWidth,thisWidth);$(this).width(thisWidth);$(this).data('thisWidth',thisWidth);var wrapperWidth=$(this).data('wrapperWidth')?$(this).data('wrapperWidth'):0;wrapperWidth=Math.max(wrapper.get(0).scrollWidth,wrapperWidth);wrapper.width(wrapperWidth);$(this).data('wrapperWidth',wrapperWidth);$(this).dialog({'width':wrapper.width()});wrapper.css('left',parseInt(wrapper.css('left'))- |
126 | 127 | (wrapper.width()-oldWidth)/2);} |
127 | | -$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;} |
| 128 | +$(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(context,event){if(event.data.scope=='do_not_trigger'){$.wikiEditor.modules.highlight.fn.scan(context,"");$.wikiEditor.modules.highlight.fn.mark(context,"","");}}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},tokenArray:[],scan:function(context,division){token=function(offset,label){this.offset=offset;this.label=label;} |
| 129 | +this.tokenArray=new Array();var text=context.fn.getContents();for(module in $.wikiEditor.modules){if('exp'in $.wikiEditor.modules[module]){for(var i=0;i<$.wikiEditor.modules[module].exp.length;i++){var regex=$.wikiEditor.modules[module].exp[i].regex;var label=$.wikiEditor.modules[module].exp[i].label;var markAfter=false;if(typeof($.wikiEditor.modules[module].exp[i].markAfter)!='undefined'){markAfter=true;} |
| 130 | +match=text.match(regex);var oldOffset=0;while(match!=null){var markOffset=0;if(markAfter){markOffset+=match[0].length;} |
| 131 | +this.tokenArray.push(new token(match.index+oldOffset+markOffset,label));oldOffset+=(match.index+match[0].length);newSubstring=text.substring(oldOffset);match=newSubstring.match(regex);}}}} |
| 132 | +return this.tokenArray;},markers:[],mark:function(context,division,tokens){var rawText=context.fn.getContents();for(module in $.wikiEditor.modules){if('evt'in $.wikiEditor.modules[module]&&'mark'in $.wikiEditor.modules[module].evt){$.wikiEditor.modules[module].evt.mark();}} |
| 133 | +markedText="";var previousIndex=0;for(var currentIndex in this.markers){markedText+=rawText.substring(previousIndex,currentIndex);for(var i=0;i<this.markers[currentIndex].length;i++){markedText+=this.markers[currentIndex][i];} |
| 134 | +previousIndex=currentIndex;} |
| 135 | +if(markedText!=""){markedText.replace(/\n/g,'<br\>');context.fn.setContents({contents:markedText});}}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('initialized'in context.modules.preview){return;} |
128 | 136 | context.modules.preview={'initialized':true,'previewText':null,'changesText':null};context.modules.preview.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previewText==wikitext){return;} |
129 | 137 | context.modules.preview.$preview.find('.wikiEditor-preview-contents').empty();context.modules.preview.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(typeof data.parse=='undefined'||typeof data.parse.text=='undefined'||typeof data.parse.text['*']=='undefined'){return;} |
130 | 138 | context.modules.preview.previewText=wikitext;context.modules.preview.$preview.find('.wikiEditor-preview-loading').hide();context.modules.preview.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']).find('a:not([href^=#])').click(function(){return false;});},'json');}});context.$changesTab=context.fn.addView({'name':'changes','titleMsg':'wikieditor-preview-changes-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.changesText==wikitext){return;} |
— | — | @@ -153,7 +161,8 @@ |
154 | 162 | $('#wikiEditor-'+context.instance+'-dialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
155 | 163 | $('#wikiEditor-'+context.instance+'-dialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
156 | 164 | $('#wikiEditor-'+context.instance+'-dialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
157 | | -$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={defaultWidth:'166px',minimumWidth:'70px',api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});}},fn:{create:function(context,config){if('$toc'in context.modules.toc){return;} |
| 165 | +$('#wikiEditor-'+context.instance+'-dialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-dialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-dialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-dialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-dialog-summary').val());$('#editform').submit();},'wikieditor-publish-dialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-dialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={defaultWidth:'166px',minimumWidth:'70px',api:{},evt:{ready:function(context,event){$.wikiEditor.modules.toc.fn.build(context);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},resize:function(context,event){context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height()- |
| 166 | +context.$ui.find('.tab-toc').outerHeight());}},fn:{create:function(context,config){if('$toc'in context.modules.toc){return;} |
158 | 167 | var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.toc.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.toc.$toc);context.modules.toc.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);},unhighlight:function(context){context.modules.toc.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('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++;} |
159 | 168 | section=Math.max(0,section);} |
160 | 169 | var sectionLink=context.modules.toc.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.toc.$toc.offset().top;var scrollTop=context.modules.toc.$toc.scrollTop();var divHeight=context.modules.toc.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |
— | — | @@ -166,9 +175,10 @@ |
167 | 176 | div.html(' ');var item=$('<li />').append(div);if(structure[i].sections!==undefined){item.append(buildList(structure[i].sections));} |
168 | 177 | list.append(item);} |
169 | 178 | return list;} |
170 | | -function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');return false;}).find('a').text(gM('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('expand.wikiEditor-toc');return false;}).hide().find('a').text(gM('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);} |
| 179 | +function buildCollapseControls(){var $collapseControl=$('<div />'),$expandControl=$('<div />');$collapseControl.addClass('tab').addClass('tab-toc').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc');return false;}).find('a').text(gM('wikieditor-toc-hide'));$expandControl.addClass('wikiEditor-ui-toc-expandControl').append('<a href="#" />').bind('click.wikiEditor-toc',function(){context.modules.toc.$toc.trigger('expand.wikiEditor-toc');return false;}).hide().find('a').text(gM('wikieditor-toc-show'));$collapseControl.insertBefore(context.modules.toc.$toc);context.$ui.find('.wikiEditor-ui-left .wikiEditor-ui-top').append($expandControl);context.fn.trigger('resize');} |
171 | 180 | function buildResizeControls(){context.$ui.data('resizableDone',true).find('.wikiEditor-ui-right').data('wikiEditor-ui-left',context.$ui.find('.wikiEditor-ui-left')).resizable({handles:'w,e',preventPositionLeftChange:true,minWidth:50,start:function(e,ui){var $this=$(this);$('<div />').addClass('wikiEditor-ui-resize-mask').css({'position':'absolute','z-index':2,'left':0,'top':0,'bottom':0,'right':0}).appendTo(context.$ui.find('.wikiEditor-ui-left'));$this.resizable('option','maxWidth',$this.parent().width()-450);},resize:function(e,ui){$(this).css({'width':ui.size.width,'top':'auto','height':'auto'}).data('wikiEditor-ui-left').css('marginRight',(-1*ui.size.width)).children().css('marginRight',ui.size.width);context.fn.trigger('resize');},stop:function(e,ui){context.$ui.find('.wikiEditor-ui-resize-mask').remove();context.$content.trigger('mouseup');if(ui.size.width<parseFloat($.wikiEditor.modules.toc.minimumWidth)){context.modules.toc.$toc.trigger('collapse');}else{context.modules.toc.$toc.data('openWidth',ui.size.width);$.cookie('wikiEditor-'+context.instance+'-toc-width',ui.size.width);} |
172 | | -context.fn.trigger('resize');}});context.$ui.find('.ui-resizable-e').removeClass('ui-resizable-e').addClass('ui-resizable-w').addClass('wikiEditor-ui-toc-resize-grip');context.modules.toc.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.toc.$toc.data('openWidth',$.wikiEditor.modules.toc.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.minimumWidth)) |
| 181 | +context.fn.trigger('resize');}});var handle=$j('body').is('.rtl')?'w':'e' |
| 182 | +context.$ui.find('.ui-resizable-'+handle).removeClass('ui-resizable-'+handle).addClass('ui-resizable-'+(handle=='w'?'e':'w')).addClass('wikiEditor-ui-toc-resize-grip');context.modules.toc.$toc.bind('collapse.wikiEditor-toc',$.wikiEditor.modules.toc.fn.collapse).bind('expand.wikiEditor-toc',$.wikiEditor.modules.toc.fn.expand);context.modules.toc.$toc.data('openWidth',$.wikiEditor.modules.toc.defaultWidth);if($.cookie('wikiEditor-'+context.instance+'-toc-width')==0){context.modules.toc.$toc.trigger('collapse.wikiEditor-toc',{data:context});}else if($.cookie('wikiEditor-'+context.instance+'-toc-width')>0){var initialWidth=$.cookie('wikiEditor-'+context.instance+'-toc-width');if(initialWidth<parseFloat($.wikiEditor.modules.toc.minimumWidth)) |
173 | 183 | initialWidth=parseFloat($.wikiEditor.modules.toc.minimumWidth)+1;context.modules.toc.$toc.data('openWidth',initialWidth+'px');context.$ui.find('.wikiEditor-ui-right').css('width',initialWidth+'px');context.$ui.find('.wikiEditor-ui-left').css('marginRight',(parseFloat(initialWidth)*-1)+'px').children().css('marginRight',initialWidth+'px');}} |
174 | 184 | var outline=[],h=0;function traverseTextNodes(){if(this.nodeName!='#text'){$(this.childNodes).each(traverseTextNodes);return;} |
175 | 185 | var text=this.nodeValue;var p=this;while(!p.previousSibling) |