r55012 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55011‎ | r55012 | r55013 >
Date:11:59, 14 August 2009
Author:catrope
Status:deferred
Tags:
Comment:
EditToolbar: Make the link CGD replace the selection (but preserving leading and trailing whitespace), making it a full-blown link editor. Also:
* don't clear the text fields when the dialog is closed
* prevent editing an external link from clearing fields in the internal link tab or v.v.
* recombine CSS/JS for r54967
* build AJAX status images with jQuery instead of as HTML, turned out to be faster :O
Modified paths:
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/css/combined.min.css (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php
@@ -56,16 +56,16 @@
5757 array( 'src' => 'js/plugins/jquery.async.js', 'version' => 3 ),
5858 array( 'src' => 'js/plugins/jquery.browser.js', 'version' => 3 ),
5959 array( 'src' => 'js/plugins/jquery.cookie.js', 'version' => 3 ),
60 - array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 8 ),
 60+ array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 9 ),
6161 array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 4 ),
62 - array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 9 ),
 62+ array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 10 ),
6363 array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 4 ),
6464 ),
6565 'combined' => array(
66 - array( 'src' => 'js/plugins.combined.js', 'version' => 13 ),
 66+ array( 'src' => 'js/plugins.combined.js', 'version' => 14 ),
6767 ),
6868 'minified' => array(
69 - array( 'src' => 'js/plugins.combined.min.js', 'version' => 13 ),
 69+ array( 'src' => 'js/plugins.combined.min.js', 'version' => 14 ),
7070 ),
7171 ),
7272 );
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.js
@@ -98,10 +98,26 @@
9999 var invalidMsg = gM( 'edittoolbar-tool-link-int-target-status-invalid' );
100100 var loadingMsg = gM( 'edittoolbar-tool-link-int-target-status-loading' );
101101 $j( '#edittoolbar-link-int-target-status' )
102 - .html( '<img id="edittoolbar-link-int-target-status-exists" src="' + existsImg + '" alt="' + existsMsg + '" title="' + existsMsg + '" />' +
103 - '<img id="edittoolbar-link-int-target-status-notexists" src="' + notexistsImg + '" alt="' + notexistsMsg + '" title="' + notexistsMsg + '" />' +
104 - '<img id="edittoolbar-link-int-target-status-invalid" src="' + invalidImg + '" alt="' + invalidMsg + '" title="' + invalidMsg + '" />' +
105 - '<img id="edittoolbar-link-int-target-status-loading" src="' + loadingImg + '" alt="' + loadingMsg + '" title="' + loadingMsg + '" />' )
 102+ .append( $j( '<img />' ).attr( {
 103+ 'id': 'edittoolbar-link-int-target-status-exists',
 104+ 'src': existsImg,
 105+ 'alt': existsMsg,
 106+ 'title': existsMsg } ) )
 107+ .append( $j( '<img />' ).attr( {
 108+ 'id': 'edittoolbar-link-int-target-status-notexists',
 109+ 'src': notexistsImg,
 110+ 'alt': notexistsMsg,
 111+ 'title': notexistsMsg } ) )
 112+ .append( $j( '<img />' ).attr( {
 113+ 'id': 'edittoolbar-link-int-target-status-invalid',
 114+ 'src': invalidImg,
 115+ 'alt': invalidMsg,
 116+ 'title': invalidMsg } ) )
 117+ .append( $j( '<img />' ).attr( {
 118+ 'id': 'edittoolbar-link-int-target-status-loading',
 119+ 'src': loadingImg,
 120+ 'alt': loadingMsg,
 121+ 'title': loadingMsg } ) )
106122 .data( 'cache', {} )
107123 .children().hide();
108124
@@ -195,6 +211,7 @@
196212 return s.replace( /(]+)/g, '<nowiki>$1</nowiki>' );
197213 }
198214 var insertText = '';
 215+ var whitespace = [ '', '' ];
199216 switch ( $j( '#edittoolbar-link-tabs' ).tabs( 'option', 'selected' ) ) {
200217 case 0: // Internal link
201218 // FIXME: Exactly how fragile is this?
@@ -205,6 +222,7 @@
206223 }
207224 var target = $j( '#edittoolbar-link-int-target' ).val();
208225 var text = $j( '#edittoolbar-link-int-text' ).val();
 226+ whitespace = $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace' );
209227 if ( target == text )
210228 insertText = '[[' + target + ']]';
211229 else
@@ -215,6 +233,7 @@
216234 var text = $j( '#edittoolbar-link-ext-text' ).val();
217235 var escTarget = escapeExternalTarget( target );
218236 var escText = escapeExternalText( text );
 237+ whitespace = $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace' );
219238 if ( escTarget == escText )
220239 insertText = escTarget;
221240 else if ( text == '' )
@@ -223,8 +242,10 @@
224243 insertText = '[' + escTarget + ' ' + escText + ']';
225244 break;
226245 }
 246+ // Preserve whitespace in selection when replacing
 247+ insertText = whitespace[0] + insertText + whitespace[1];
227248 $j.wikiEditor.modules.toolbar.fn.doAction( $j(this).data( 'context' ), {
228 - type: 'encapsulate',
 249+ type: 'replace',
229250 options: {
230251 pre: insertText
231252 }
@@ -235,48 +256,49 @@
236257 $j(this).dialog( 'close' );
237258 }
238259 },
239 - close: function() {
240 - // Clear text fields
241 - $j(this).find( 'input' ).val( '' );
242 - },
243260 open: function() {
244261 // Smart pre-fill text fields
245 - // TODO: Replace selection, replace button
246 - // TODO: Don't clear fields in other tab
247262 var selection = $j(this).data( 'context' ).$textarea.getSelection();
248263 if ( selection != '' ) {
249264 var inttext, inttarget, exttext, exttarget;
250265 var matches;
251266 var tab = -1;
252 - if ( ( matches = selection.match( /^\s*\[\[([^\]\|]+)(\|([^\]\|]*))?\]\]\s*$/ ) ) ) {
 267+ $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ '', '' ] );
 268+ $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ '', '' ] );
 269+ if ( ( matches = selection.match( /^(\s*)\[\[([^\]\|]+)(\|([^\]\|]*))?\]\](\s*)$/ ) ) ) {
253270 // [[foo|bar]] or [[foo]]
254 - inttarget = matches[1];
255 - inttext = ( matches[3] ? matches[3] : matches[1] );
256 - exttarget = 'http://';
257 - exttext = '';
 271+ inttarget = matches[2];
 272+ inttext = ( matches[4] ? matches[4] : matches[2] );
258273 tab = 0;
259 - } else if ( ( matches = selection.match( /^\s*\[([^\] ]+)( ([^\]]+))?\]\s*$/ ) ) ) {
 274+ // Preserve whitespace when replacing
 275+ $j( '#edittoolbar-link-dialog-tab-int' ).data( 'whitespace', [ matches[1], matches[5] ] );
 276+ } else if ( ( matches = selection.match( /^(\s*)\[([^\] ]+)( ([^\]]+))?\](\s*)$/ ) ) ) {
260277 // [http://www.example.com foo] or [http://www.example.com]
261 - exttarget = matches[1];
262 - exttext = ( matches[3] ? matches[3] : '' );
263 - inttarget = '';
264 - inttext = '';
 278+ exttarget = matches[2];
 279+ exttext = ( matches[4] ? matches[4] : '' );
265280 tab = 1;
 281+ // Preserve whitespace when replacing
 282+ $j( '#edittoolbar-link-dialog-tab-ext' ).data( 'whitespace', [ matches[1], matches[5] ] );
266283 } else {
267284 inttarget = inttext = exttext = selection;
268285 exttarget = 'http://';
269286 }
270287
271288 // val() doesn't trigger the change event, so let's do that ourselves
272 - $j( '#edittoolbar-link-int-text' ).val( inttext ).change();
273 - $j( '#edittoolbar-link-int-target' ).val( inttarget ).change();
274 - $j( '#edittoolbar-link-ext-text' ).val( exttext ).change();
275 - $j( '#edittoolbar-link-ext-target' ).val( exttarget ).change();
 289+ if ( typeof inttext != 'undefined' )
 290+ $j( '#edittoolbar-link-int-text' ).val( inttext ).change();
 291+ if ( typeof inttarget != 'undefined' )
 292+ $j( '#edittoolbar-link-int-target' ).val( inttarget ).change();
 293+ if ( typeof exttext != 'undefined' )
 294+ $j( '#edittoolbar-link-ext-text' ).val( exttext ).change();
 295+ if ( typeof exttarget != 'undefined' )
 296+ $j( '#edittoolbar-link-ext-target' ).val( exttarget ).change();
276297 if ( tab != -1 )
277298 $j( '#edittoolbar-link-tabs' ).tabs( 'select', tab );
278299 }
279 - if ( $j( '#edittoolbar-link-int-text' ).val() == $j( '#edittoolbar-link-int-target' ).val() )
280 - $j( '#edittoolbar-link-int-text' ).data( 'untouched', true );
 300+ $j( '#edittoolbar-link-int-text' ).data( 'untouched',
 301+ $j( '#edittoolbar-link-int-text' ).val() == $j( '#edittoolbar-link-int-target' ).val()
 302+ );
281303 }
282304 }
283305 }
Index: trunk/extensions/UsabilityInitiative/EditToolbar/EditToolbar.php
@@ -19,7 +19,7 @@
2020 /* Configuration */
2121
2222 // Bump the version number every time you change any of the .css/.js files
23 -$wgEditToolbarStyleVersion = 24;
 23+$wgEditToolbarStyleVersion = 25;
2424
2525 // Set this to true to simply override the stock toolbar for everyone
2626 $wgEditToolbarGlobalEnable = false;
Index: trunk/extensions/UsabilityInitiative/css/combined.css
@@ -91,21 +91,21 @@
9292 border-bottom: solid 1px #DDDDDD;
9393 }/* wikiEditor toolbar module */
9494
95 -.wikiEditor-ui .wikiEditor-ui-toolbar {
 95+.wikiEditor-ui-toolbar {
9696 position: relative;
9797 width: 100%;
9898 }
9999
100100 /* Expandable Sections */
101 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections {
 101+.wikiEditor-ui-toolbar .sections {
102102 float: left;
103103 width: 100%;
104104 clear: both;
105105 }
106 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .sections {
 106+body.rtl .wikiEditor-ui-toolbar .sections {
107107 float: right;
108108 }
109 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections .section {
 109+.wikiEditor-ui-toolbar .sections .section {
110110 display: none;
111111 float: left;
112112 width: 100%;
@@ -115,20 +115,20 @@
116116 border-top: solid 1px #DDDDDD;
117117 background-color: #F3F3F3;
118118 }
119 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .sections .section {
 119+body.rtl .wikiEditor-ui-toolbar .sections .section {
120120 float: right;
121121 margin-left: auto;
122122 margin-right: -1px;
123123 }
124 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections .loading {
 124+.wikiEditor-ui-toolbar .sections .loading {
125125 padding-top: 0.5em;
126126 padding-bottom: 0.5em;
127127 }
128128 /* Gets overridden when the section div is in class loading - see below */
129 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections div .spinner {
 129+.wikiEditor-ui-toolbar .sections div .spinner {
130130 display: none;
131131 }
132 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections .loading .spinner {
 132+.wikiEditor-ui-toolbar .sections .loading .spinner {
133133 display: block;
134134 background-image: url(../images/wikiEditor/toolbar/loading.gif);
135135 background-position: left center;
@@ -138,7 +138,7 @@
139139 float: left;
140140 color: #666666;
141141 }
142 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .sections .loading .spinner {
 142+body.rtl .wikiEditor-ui-toolbar .sections .loading .spinner {
143143 background-position: right center;
144144 padding-left: 0;
145145 padding-right: 32px;
@@ -147,25 +147,25 @@
148148 float: right;
149149 }
150150 /* Top Level Containers */
151 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs,
152 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-main {
 151+.wikiEditor-ui-toolbar .tabs,
 152+.wikiEditor-ui-toolbar .section-main {
153153 position: relative;
154154 float: left;
155155 height: 26px;
156156 }
157 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs,
158 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-main {
 157+body.rtl .wikiEditor-ui-toolbar .tabs,
 158+body.rtl .wikiEditor-ui-toolbar .section-main {
159159 float: right;
160160 }
161161 /* Groups */
162 -.wikiEditor-ui .wikiEditor-ui-toolbar .group {
 162+.wikiEditor-ui-toolbar .group {
163163 float: left;
164164 height: 26px;
165165 padding-right: 6px;
166166 border-right: solid 1px #DDDDDD;
167167 margin: 3px;
168168 }
169 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group {
 169+body.rtl .wikiEditor-ui-toolbar .group {
170170 float: right;
171171 padding-right: 0;
172172 padding-left: 6px;
@@ -173,25 +173,25 @@
174174 border-left: solid 1px #DDDDDD;
175175 }
176176 /* Tabs */
177 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs {
 177+.wikiEditor-ui-toolbar .tabs {
178178 list-style: none;
179179 margin: 3px;
180180 }
181 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab {
 181+.wikiEditor-ui-toolbar .tabs span.tab {
182182 display: inline-block;
183183 float: left;
184184 line-height: 26px;
185185 }
186186 /* IGNORED BY IE6 */
187 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs > span.tab {
 187+.wikiEditor-ui-toolbar .tabs > span.tab {
188188 display: block;
189189 }
190190 /* IGNORED BY IE6 */
191 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs > span.tab {
 191+body.rtl .wikiEditor-ui-toolbar .tabs > span.tab {
192192 float: right;
193193 }
194 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a,
195 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a:visited {
 194+.wikiEditor-ui-toolbar .tabs span.tab a,
 195+.wikiEditor-ui-toolbar .tabs span.tab a:visited {
196196 display: inline-block;
197197 float: left;
198198 padding-left: 18px;
@@ -203,32 +203,32 @@
204204 background-position: left center;
205205 background-repeat: no-repeat;
206206 }
207 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a,
208 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a:visited {
 207+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a,
 208+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a:visited {
209209 padding-left: 12px;
210210 padding-right: 18px;
211211 background-image: url(../images/wikiEditor/toolbar/arrow-left.png);
212212 background-position: right center;
213213 }
214214 /* IGNORED BY IE6 */
215 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs > span.tab > a,
216 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs > pan.tab > a:visited {
 215+body.rtl .wikiEditor-ui-toolbar .tabs > span.tab > a,
 216+body.rtl .wikiEditor-ui-toolbar .tabs > pan.tab > a:visited {
217217 float: right;
218218 }
219 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current,
220 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current:visited {
 219+.wikiEditor-ui-toolbar .tabs span.tab a.current,
 220+.wikiEditor-ui-toolbar .tabs span.tab a.current:visited {
221221 color: #333333;
222222 background-image: url(../images/wikiEditor/toolbar/arrow-down.png);
223223 }
224 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current,
225 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current:visited {
 224+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a.current,
 225+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a.current:visited {
226226 background-image: url(../images/wikiEditor/toolbar/arrow-down.png);
227227 }
228 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current:hover {
 228+.wikiEditor-ui-toolbar .tabs span.tab a.current:hover {
229229 text-decoration: none;
230230 }
231231 /* Toolbar */
232 -.wikiEditor-ui .wikiEditor-ui-toolbar .group .label {
 232+.wikiEditor-ui-toolbar .group .label {
233233 float: left;
234234 border: 0px;
235235 height: 22px;
@@ -240,12 +240,12 @@
241241 cursor: default;
242242 }
243243 /* IGNORED BY IE6 */
244 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group > .label {
 244+body.rtl .wikiEditor-ui-toolbar .group > .label {
245245 float: right;
246246 margin-left: 8px;
247247 margin-right: 5px;
248248 }
249 -.wikiEditor-ui .wikiEditor-ui-toolbar .group img.tool {
 249+.wikiEditor-ui-toolbar .group img.tool {
250250 float: left;
251251 border: 0px;
252252 height: 22px;
@@ -254,90 +254,90 @@
255255 cursor: pointer;
256256 }
257257 /* IGNORED BY IE6 */
258 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group > img.tool {
 258+body.rtl .wikiEditor-ui-toolbar .group > img.tool {
259259 float: right;
260260 }
261 -.wikiEditor-ui .wikiEditor-ui-toolbar .group select {
 261+.wikiEditor-ui-toolbar .group select {
262262 float: left;
263263 margin: 2px;
264264 height: 22px;
265265 cursor: pointer;
266266 }
267267 /* IGNORED BY IE6 */
268 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group > select {
 268+body.rtl .wikiEditor-ui-toolbar .group > select {
269269 float: right;
270270 font-size: 0.9em;
271271 }
272272 /* Booklet */
273 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index {
 273+.wikiEditor-ui-toolbar .booklet .index {
274274 float: left;
275275 width: 20%;
276276 height: 125px;
277277 overflow: auto;
278278 }
279 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index {
 279+body.rtl .wikiEditor-ui-toolbar .booklet .index {
280280 float: right;
281281 }
282 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index div {
 282+.wikiEditor-ui-toolbar .booklet .index div {
283283 padding: 4px;
284284 padding-left: 6px;
285285 cursor: pointer;
286286 color: #0645ad;
287287 }
288 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index div {
 288+body.rtl .wikiEditor-ui-toolbar .booklet .index div {
289289 padding-left: 4px;
290290 padding-right: 6px;
291291 }
292 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index .current {
 292+.wikiEditor-ui-toolbar .booklet .index .current {
293293 background-color: #FAFAFA;
294294 color: #333333;
295295 cursor: default;
296296 }
297 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .pages {
 297+.wikiEditor-ui-toolbar .booklet .pages {
298298 float: right;
299299 width: 80%;
300300 height: 125px;
301301 overflow: auto;
302302 background-color: #FAFAFA;
303303 }
304 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .booklet .pages {
 304+body.rtl .wikiEditor-ui-toolbar .booklet .pages {
305305 float: left;
306306 }
307307 /* Help Pages */
308 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table {
 308+.wikiEditor-ui-toolbar .page-table table {
309309 padding-left: 5px;
310310 padding-right: 5px;
311311 background: none;
312312 }
313 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table th {
 313+.wikiEditor-ui-toolbar .page-table th {
314314 color: #999999;
315315 }
316 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td {
 316+.wikiEditor-ui-toolbar .page-table td {
317317 color: black;
318318 border-top: solid 1px #EEEEEE;
319319 }
320 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table th,
321 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td {
 320+.wikiEditor-ui-toolbar .page-table th,
 321+.wikiEditor-ui-toolbar .page-table td {
322322 text-align: left;
323323 padding: 5px;
324324 margin: 0px;
325325 }
326 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table th,
327 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td {
 326+body.rtl .wikiEditor-ui-toolbar .page-table th,
 327+body.rtl .wikiEditor-ui-toolbar .page-table td {
328328 text-align: right;
329329 }
330 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.syntax {
 330+.wikiEditor-ui-toolbar .section-help .page-table td.syntax {
331331 font-family: monospace;
332332 }
333 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.syntax,
334 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.result {
 333+.wikiEditor-ui-toolbar .section-help .page-table td.syntax,
 334+.wikiEditor-ui-toolbar .section-help .page-table td.result {
335335 width: 40%;
336336 }
337 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.description {
 337+.wikiEditor-ui-toolbar .section-help .page-table td.description {
338338 width: 20%;
339339 }
340340 /* Characters Pages */
341 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters div a {
 341+.wikiEditor-ui-toolbar .page-characters div a {
342342 border: solid 1px #DDDDDD;
343343 padding: 5px;
344344 padding-left: 8px;
@@ -350,14 +350,14 @@
351351 color: black;
352352 text-decoration: none;
353353 }
354 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters > div > a,
355 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters div[dir=rtl] a {
 354+body.rtl .wikiEditor-ui-toolbar .page-characters > div > a,
 355+.wikiEditor-ui-toolbar .page-characters div[dir=rtl] a {
356356 direction: rtl;
357357 float: right;
358358 margin-left: 0;
359359 margin-right: 5px;
360360 }
361 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters div a:hover {
 361+.wikiEditor-ui-toolbar .page-characters div a:hover {
362362 background-color: white;
363363 text-decoration: none;
364364 border-color: #a8d7f9;
Index: trunk/extensions/UsabilityInitiative/css/combined.min.css
@@ -81,19 +81,19 @@
8282 font-size:1em;
8383 border-bottom:solid 1px #DDDDDD;
8484 }
85 -.wikiEditor-ui .wikiEditor-ui-toolbar{
 85+.wikiEditor-ui-toolbar{
8686 position:relative;
8787 width:100%;
8888 }
89 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections{
 89+.wikiEditor-ui-toolbar .sections{
9090 float:left;
9191 width:100%;
9292 clear:both;
9393 }
94 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .sections{
 94+body.rtl .wikiEditor-ui-toolbar .sections{
9595 float:right;
9696 }
97 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections .section{
 97+.wikiEditor-ui-toolbar .sections .section{
9898 display:none;
9999 float:left;
100100 width:100%;
@@ -103,19 +103,19 @@
104104 border-top:solid 1px #DDDDDD;
105105 background-color:#F3F3F3;
106106 }
107 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .sections .section{
 107+body.rtl .wikiEditor-ui-toolbar .sections .section{
108108 float:right;
109109 margin-left:auto;
110110 margin-right:-1px;
111111 }
112 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections .loading{
 112+.wikiEditor-ui-toolbar .sections .loading{
113113 padding-top:0.5em;
114114 padding-bottom:0.5em;
115115 }
116 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections div .spinner{
 116+.wikiEditor-ui-toolbar .sections div .spinner{
117117 display:none;
118118 }
119 -.wikiEditor-ui .wikiEditor-ui-toolbar .sections .loading .spinner{
 119+.wikiEditor-ui-toolbar .sections .loading .spinner{
120120 display:block;
121121 background-image:url(../images/wikiEditor/toolbar/loading.gif);
122122 background-position:left center;
@@ -125,7 +125,7 @@
126126 float:left;
127127 color:#666666;
128128 }
129 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .sections .loading .spinner{
 129+body.rtl .wikiEditor-ui-toolbar .sections .loading .spinner{
130130 background-position:right center;
131131 padding-left:0;
132132 padding-right:32px;
@@ -133,47 +133,47 @@
134134 margin-right:1em;
135135 float:right;
136136 }
137 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs,
138 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-main{
 137+.wikiEditor-ui-toolbar .tabs,
 138+.wikiEditor-ui-toolbar .section-main{
139139 position:relative;
140140 float:left;
141141 height:26px;
142142 }
143 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs,
144 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-main{
 143+body.rtl .wikiEditor-ui-toolbar .tabs,
 144+body.rtl .wikiEditor-ui-toolbar .section-main{
145145 float:right;
146146 }
147 -.wikiEditor-ui .wikiEditor-ui-toolbar .group{
 147+.wikiEditor-ui-toolbar .group{
148148 float:left;
149149 height:26px;
150150 padding-right:6px;
151151 border-right:solid 1px #DDDDDD;
152152 margin:3px;
153153 }
154 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group{
 154+body.rtl .wikiEditor-ui-toolbar .group{
155155 float:right;
156156 padding-right:0;
157157 padding-left:6px;
158158 border-right:none;
159159 border-left:solid 1px #DDDDDD;
160160 }
161 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs{
 161+.wikiEditor-ui-toolbar .tabs{
162162 list-style:none;
163163 margin:3px;
164164 }
165 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab{
 165+.wikiEditor-ui-toolbar .tabs span.tab{
166166 display:inline-block;
167167 float:left;
168168 line-height:26px;
169169 }
170 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs > span.tab{
 170+.wikiEditor-ui-toolbar .tabs > span.tab{
171171 display:block;
172172 }
173 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs > span.tab{
 173+body.rtl .wikiEditor-ui-toolbar .tabs > span.tab{
174174 float:right;
175175 }
176 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a,
177 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a:visited{
 176+.wikiEditor-ui-toolbar .tabs span.tab a,
 177+.wikiEditor-ui-toolbar .tabs span.tab a:visited{
178178 display:inline-block;
179179 float:left;
180180 padding-left:18px;
@@ -185,30 +185,30 @@
186186 background-position:left center;
187187 background-repeat:no-repeat;
188188 }
189 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a,
190 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a:visited{
 189+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a,
 190+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a:visited{
191191 padding-left:12px;
192192 padding-right:18px;
193193 background-image:url(../images/wikiEditor/toolbar/arrow-left.png);
194194 background-position:right center;
195195 }
196 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs > span.tab > a,
197 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs > pan.tab > a:visited{
 196+body.rtl .wikiEditor-ui-toolbar .tabs > span.tab > a,
 197+body.rtl .wikiEditor-ui-toolbar .tabs > pan.tab > a:visited{
198198 float:right;
199199 }
200 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current,
201 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current:visited{
 200+.wikiEditor-ui-toolbar .tabs span.tab a.current,
 201+.wikiEditor-ui-toolbar .tabs span.tab a.current:visited{
202202 color:#333333;
203203 background-image:url(../images/wikiEditor/toolbar/arrow-down.png);
204204 }
205 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current,
206 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current:visited{
 205+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a.current,
 206+body.rtl .wikiEditor-ui-toolbar .tabs span.tab a.current:visited{
207207 background-image:url(../images/wikiEditor/toolbar/arrow-down.png);
208208 }
209 -.wikiEditor-ui .wikiEditor-ui-toolbar .tabs span.tab a.current:hover{
 209+.wikiEditor-ui-toolbar .tabs span.tab a.current:hover{
210210 text-decoration:none;
211211 }
212 -.wikiEditor-ui .wikiEditor-ui-toolbar .group .label{
 212+.wikiEditor-ui-toolbar .group .label{
213213 float:left;
214214 border:0px;
215215 height:22px;
@@ -219,12 +219,12 @@
220220 color:#777777;
221221 cursor:default;
222222 }
223 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group > .label{
 223+body.rtl .wikiEditor-ui-toolbar .group > .label{
224224 float:right;
225225 margin-left:8px;
226226 margin-right:5px;
227227 }
228 -.wikiEditor-ui .wikiEditor-ui-toolbar .group img.tool{
 228+.wikiEditor-ui-toolbar .group img.tool{
229229 float:left;
230230 border:0px;
231231 height:22px;
@@ -232,86 +232,86 @@
233233 padding:2px;
234234 cursor:pointer;
235235 }
236 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group > img.tool{
 236+body.rtl .wikiEditor-ui-toolbar .group > img.tool{
237237 float:right;
238238 }
239 -.wikiEditor-ui .wikiEditor-ui-toolbar .group select{
 239+.wikiEditor-ui-toolbar .group select{
240240 float:left;
241241 margin:2px;
242242 height:22px;
243243 cursor:pointer;
244244 }
245 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .group > select{
 245+body.rtl .wikiEditor-ui-toolbar .group > select{
246246 float:right;
247247 font-size:0.9em;
248248 }
249 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index{
 249+.wikiEditor-ui-toolbar .booklet .index{
250250 float:left;
251251 width:20%;
252252 height:125px;
253253 overflow:auto;
254254 }
255 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index{
 255+body.rtl .wikiEditor-ui-toolbar .booklet .index{
256256 float:right;
257257 }
258 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index div{
 258+.wikiEditor-ui-toolbar .booklet .index div{
259259 padding:4px;
260260 padding-left:6px;
261261 cursor:pointer;
262262 color:#0645ad;
263263 }
264 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index div{
 264+body.rtl .wikiEditor-ui-toolbar .booklet .index div{
265265 padding-left:4px;
266266 padding-right:6px;
267267 }
268 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .index .current{
 268+.wikiEditor-ui-toolbar .booklet .index .current{
269269 background-color:#FAFAFA;
270270 color:#333333;
271271 cursor:default;
272272 }
273 -.wikiEditor-ui .wikiEditor-ui-toolbar .booklet .pages{
 273+.wikiEditor-ui-toolbar .booklet .pages{
274274 float:right;
275275 width:80%;
276276 height:125px;
277277 overflow:auto;
278278 background-color:#FAFAFA;
279279 }
280 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .booklet .pages{
 280+body.rtl .wikiEditor-ui-toolbar .booklet .pages{
281281 float:left;
282282 }
283 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table{
 283+.wikiEditor-ui-toolbar .page-table table{
284284 padding-left:5px;
285285 padding-right:5px;
286286 background:none;
287287 }
288 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table th{
 288+.wikiEditor-ui-toolbar .page-table th{
289289 color:#999999;
290290 }
291 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td{
 291+.wikiEditor-ui-toolbar .page-table td{
292292 color:black;
293293 border-top:solid 1px #EEEEEE;
294294 }
295 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table th,
296 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td{
 295+.wikiEditor-ui-toolbar .page-table th,
 296+.wikiEditor-ui-toolbar .page-table td{
297297 text-align:left;
298298 padding:5px;
299299 margin:0px;
300300 }
301 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table th,
302 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td{
 301+body.rtl .wikiEditor-ui-toolbar .page-table th,
 302+body.rtl .wikiEditor-ui-toolbar .page-table td{
303303 text-align:right;
304304 }
305 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.syntax{
 305+.wikiEditor-ui-toolbar .section-help .page-table td.syntax{
306306 font-family:monospace;
307307 }
308 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.syntax,
309 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.result{
 308+.wikiEditor-ui-toolbar .section-help .page-table td.syntax,
 309+.wikiEditor-ui-toolbar .section-help .page-table td.result{
310310 width:40%;
311311 }
312 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-help .page-table table td.description{
 312+.wikiEditor-ui-toolbar .section-help .page-table td.description{
313313 width:20%;
314314 }
315 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters div a{
 315+.wikiEditor-ui-toolbar .page-characters div a{
316316 border:solid 1px #DDDDDD;
317317 padding:5px;
318318 padding-left:8px;
@@ -324,15 +324,15 @@
325325 color:black;
326326 text-decoration:none;
327327 }
328 -body.rtl .wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters > div > a,
329 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters div[dir=rtl] a{
 328+body.rtl .wikiEditor-ui-toolbar .page-characters > div > a,
 329+.wikiEditor-ui-toolbar .page-characters div[dir=rtl] a{
330330 direction:rtl;
331331 float:right;
332332 margin-left:0;
333333 margin-right:5px;
334334 }
335 -.wikiEditor-ui .wikiEditor-ui-toolbar .section-characters .page-characters div a:hover{
 335+.wikiEditor-ui-toolbar .page-characters div a:hover{
336336 background-color:white;
337337 text-decoration:none;
338338 border-color:#a8d7f9;
339 -}
 339+}
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.textSelection.js
@@ -2,18 +2,6 @@
33 * These plugins provide extra functionality for interaction with textareas.
44 */
55 ( function( $ ) { $.fn.extend( {
6 -/**
7 - * Ported from skins/common/edit.js by Trevor Parscal
8 - * (c) 2009 Wikimedia Foundation (GPLv2) - http://www.wikimedia.org
9 - *
10 - * Inserts text at the begining and end of a text selection, optionally
11 - * inserting text at the caret when selection is empty.
12 - *
13 - * @param pre Text to insert before selection
14 - * @param peri Text to insert at caret if selection is empty
15 - * @param post Text to insert after selection
16 - * @param ownline If true, put the inserted text is on its own line
17 - */
186
197 getSelection: function() {
208 var e = this.jquery ? this[0] : this;
@@ -28,8 +16,22 @@
2917 }
3018 return retval;
3119 },
 20+
 21+/**
 22+ * Ported from skins/common/edit.js by Trevor Parscal
 23+ * (c) 2009 Wikimedia Foundation (GPLv2) - http://www.wikimedia.org
 24+ *
 25+ * Inserts text at the begining and end of a text selection, optionally
 26+ * inserting text at the caret when selection is empty.
 27+ *
 28+ * @param pre Text to insert before selection
 29+ * @param peri Text to insert at caret if selection is empty
 30+ * @param post Text to insert after selection
 31+ * @param ownline If true, put the inserted text is on its own line
 32+ * @param replace If true, replaces any selected text with peri; if false, peri is ignored and selected text is left alone
 33+ */
3234
33 -encapsulateSelection: function( pre, peri, post, ownline ) {
 35+encapsulateSelection: function( pre, peri, post, ownline, replace ) {
3436 /**
3537 * Check if the selected text is the same as the insert text
3638 */
@@ -37,6 +39,8 @@
3840 if ( !selText ) {
3941 selText = peri;
4042 isSample = true;
 43+ } else if ( replace ) {
 44+ selText = peri;
4145 } else if ( selText.charAt( selText.length - 1 ) == ' ' ) {
4246 // Exclude ending space char
4347 selText = selText.substring(0, selText.length - 1);
@@ -111,7 +115,7 @@
112116 }
113117 e.scrollTop = textScroll;
114118 }
115 - $(this).trigger( 'encapsulateSelection', [ pre, peri, post, ownline ] );
 119+ $(this).trigger( 'encapsulateSelection', [ pre, peri, post, ownline, replace ] );
116120 },
117121 /**
118122 * Ported from Wikia's LinkSuggest extension
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.toolbar.js
@@ -221,6 +221,7 @@
222222 */
223223 doAction: function( context, action ) {
224224 switch ( action.type ) {
 225+ case 'replace':
225226 case 'encapsulate':
226227 var parts = { 'pre': '', 'peri': '', 'post': '' };
227228 for ( part in parts ) {
@@ -235,7 +236,8 @@
236237 }
237238 context.$textarea.encapsulateSelection(
238239 parts.pre, parts.peri, parts.post,
239 - action.options.ownline
 240+ action.options.ownline,
 241+ action.type == 'replace'
240242 );
241243 break;
242244 case 'dialog':
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js
@@ -259,18 +259,6 @@
260260 * These plugins provide extra functionality for interaction with textareas.
261261 */
262262 ( function( $ ) { $.fn.extend( {
263 -/**
264 - * Ported from skins/common/edit.js by Trevor Parscal
265 - * (c) 2009 Wikimedia Foundation (GPLv2) - http://www.wikimedia.org
266 - *
267 - * Inserts text at the begining and end of a text selection, optionally
268 - * inserting text at the caret when selection is empty.
269 - *
270 - * @param pre Text to insert before selection
271 - * @param peri Text to insert at caret if selection is empty
272 - * @param post Text to insert after selection
273 - * @param ownline If true, put the inserted text is on its own line
274 - */
275263
276264 getSelection: function() {
277265 var e = this.jquery ? this[0] : this;
@@ -285,8 +273,22 @@
286274 }
287275 return retval;
288276 },
 277+
 278+/**
 279+ * Ported from skins/common/edit.js by Trevor Parscal
 280+ * (c) 2009 Wikimedia Foundation (GPLv2) - http://www.wikimedia.org
 281+ *
 282+ * Inserts text at the begining and end of a text selection, optionally
 283+ * inserting text at the caret when selection is empty.
 284+ *
 285+ * @param pre Text to insert before selection
 286+ * @param peri Text to insert at caret if selection is empty
 287+ * @param post Text to insert after selection
 288+ * @param ownline If true, put the inserted text is on its own line
 289+ * @param replace If true, replaces any selected text with peri; if false, peri is ignored and selected text is left alone
 290+ */
289291
290 -encapsulateSelection: function( pre, peri, post, ownline ) {
 292+encapsulateSelection: function( pre, peri, post, ownline, replace ) {
291293 /**
292294 * Check if the selected text is the same as the insert text
293295 */
@@ -294,6 +296,8 @@
295297 if ( !selText ) {
296298 selText = peri;
297299 isSample = true;
 300+ } else if ( replace ) {
 301+ selText = peri;
298302 } else if ( selText.charAt( selText.length - 1 ) == ' ' ) {
299303 // Exclude ending space char
300304 selText = selText.substring(0, selText.length - 1);
@@ -368,7 +372,7 @@
369373 }
370374 e.scrollTop = textScroll;
371375 }
372 - $(this).trigger( 'encapsulateSelection', [ pre, peri, post, ownline ] );
 376+ $(this).trigger( 'encapsulateSelection', [ pre, peri, post, ownline, replace ] );
373377 },
374378 /**
375379 * Ported from Wikia's LinkSuggest extension
@@ -663,16 +667,16 @@
664668 }
665669 }
666670 }
667 -// Each browser seems to do this differently, so let's keep our editor
668 -// consistent by allways starting at the begining
669 -context.$textarea.scrollToCaretPosition( 0 );
670671 // If there was a configuration passed, it's assumed to be for the addModule
671672 // API call, so we can just send it on it's way right now
672673 if ( arguments.length > 0 && typeof arguments[0] == 'object' ) {
673674 context.api.addModule( context, arguments[0] );
674675 }
 676+//Each browser seems to do this differently, so let's keep our editor
 677+//consistent by always starting at the begining
 678+context.$textarea.scrollToCaretPosition( 0 );
675679 // Store the context for next time, and support chaining
676 -return $(this).data( 'context', context );;
 680+return $(this).data( 'context', context );
677681
678682 };})(jQuery);/**
679683 * TOC Module for wikiEditor
@@ -917,11 +921,134 @@
918922 */
919923 api: {
920924 addToToolbar: function( context, data ) {
921 - //
 925+ for ( type in data ) {
 926+ switch ( type ) {
 927+ case 'sections':
 928+ var $sections =
 929+ context.modules.$toolbar.find( 'div.sections' );
 930+ var $tabs = context.modules.$toolbar.find( 'div.tabs' );
 931+ for ( section in data[type] ) {
 932+ if ( section == 'main' ) {
 933+ // Section
 934+ context.modules.$toolbar.prepend(
 935+ $.wikiEditor.modules.toolbar.fn.buildSection(
 936+ context, section, data[type][section]
 937+ )
 938+ );
 939+ continue;
 940+ }
 941+ // Section
 942+ $sections.append(
 943+ $.wikiEditor.modules.toolbar.fn.buildSection(
 944+ context, section, data[type][section]
 945+ )
 946+ );
 947+ // Tab
 948+ $tabs.append(
 949+ $.wikiEditor.modules.toolbar.fn.buildTab(
 950+ context, section, data[type][section]
 951+ )
 952+ );
 953+ }
 954+ break;
 955+ case 'groups':
 956+ if ( !( 'section' in data ) ) {
 957+ continue;
 958+ }
 959+ var $section = context.modules.$toolbar.find(
 960+ 'div[rel=' + data.section + '].section'
 961+ );
 962+ for ( group in data[type] ) {
 963+ // Group
 964+ $section.append(
 965+ $.wikiEditor.modules.toolbar.fn.buildGroup(
 966+ context, group, data[type][group]
 967+ )
 968+ );
 969+ }
 970+ break;
 971+ case 'tools':
 972+ if ( !( 'section' in data && 'group' in data ) ) {
 973+ continue;
 974+ }
 975+ var $group = context.modules.$toolbar.find(
 976+ 'div[rel=' + data.section + '].section ' +
 977+ 'div[rel=' + data.group + '].group'
 978+ );
 979+ for ( tool in data[type] ) {
 980+ // Tool
 981+ $group.append(
 982+ $.wikiEditor.modules.toolbar.fn.buildTool(
 983+ context, tool, data[type][tool]
 984+ )
 985+ );
 986+ }
 987+ break;
 988+ case 'pages':
 989+ if ( !( 'section' in data ) ) {
 990+ continue;
 991+ }
 992+ var $pages = context.modules.$toolbar.find(
 993+ 'div[rel=' + data.section + '].section .pages'
 994+ );
 995+ var $index = context.modules.$toolbar.find(
 996+ 'div[rel=' + data.section + '].section .index'
 997+ );
 998+ for ( page in data[type] ) {
 999+ // Page
 1000+ $pages.append(
 1001+ $.wikiEditor.modules.toolbar.fn.buildPage(
 1002+ context, page, data[type][page]
 1003+ )
 1004+ );
 1005+ // Index
 1006+ $index.append(
 1007+ $.wikiEditor.modules.toolbar.fn.buildBookmark(
 1008+ context, page, data[type][page]
 1009+ )
 1010+ );
 1011+ }
 1012+ $.wikiEditor.modules.toolbar.fn.updateBookletSelection(
 1013+ context, page, $pages, $index
 1014+ );
 1015+ break;
 1016+ case 'rows':
 1017+ if ( !( 'section' in data && 'page' in data ) ) {
 1018+ continue;
 1019+ }
 1020+ var $table = context.modules.$toolbar.find(
 1021+ 'div[rel=' + data.section + '].section ' +
 1022+ 'div[rel=' + data.page + '].page table'
 1023+ )
 1024+ for ( row in data[type] ) {
 1025+ // Row
 1026+ $table.append(
 1027+ $.wikiEditor.modules.toolbar.fn.buildRow(
 1028+ context, data[type][row]
 1029+ )
 1030+ );
 1031+ }
 1032+ break;
 1033+ case 'characters':
 1034+ if ( !( 'section' in data && 'page' in data ) ) {
 1035+ continue;
 1036+ }
 1037+ $characters = context.modules.$toolbar.find(
 1038+ 'div[rel=' + data.section + '].section ' +
 1039+ 'div[rel=' + data.page + '].page div'
 1040+ );
 1041+ for ( character in data[type] ) {
 1042+ // Character
 1043+ $characters.append(
 1044+ $.wikiEditor.modules.toolbar.fn.buildCharacter(
 1045+ context, data[type][character]
 1046+ )
 1047+ );
 1048+ }
 1049+ break;
 1050+ }
 1051+ }
9221052 },
923 - modifyToolbar: function( context, data ) {
924 - //
925 - },
9261053 removeFromToolbar: function( context, data ) {
9271054 if ( typeof data.section == 'string' ) {
9281055 // Section
@@ -947,6 +1074,12 @@
9481075 } else {
9491076 // Just a page, remove the index too!
9501077 context.modules.$toolbar.find( index ).remove();
 1078+ $.wikiEditor.modules.toolbar.fn.updateBookletSelection(
 1079+ context,
 1080+ null,
 1081+ context.modules.$toolbar.find( target ),
 1082+ context.modules.$toolbar.find( index )
 1083+ );
9511084 }
9521085 } else {
9531086 // Just a section, remove the tab too!
@@ -995,6 +1128,7 @@
9961129 */
9971130 doAction: function( context, action ) {
9981131 switch ( action.type ) {
 1132+ case 'replace':
9991133 case 'encapsulate':
10001134 var parts = { 'pre': '', 'peri': '', 'post': '' };
10011135 for ( part in parts ) {
@@ -1009,7 +1143,8 @@
10101144 }
10111145 context.$textarea.encapsulateSelection(
10121146 parts.pre, parts.peri, parts.post,
1013 - action.options.ownline
 1147+ action.options.ownline,
 1148+ action.type == 'replace'
10141149 );
10151150 break;
10161151 case 'dialog':
@@ -1043,35 +1178,6 @@
10441179 default: break;
10451180 }
10461181 },
1047 - buildSection: function( context, id, section ) {
1048 - switch ( section.type ) {
1049 - case 'toolbar':
1050 - return $.wikiEditor.modules.toolbar.fn.buildToolbar(
1051 - context, id, section
1052 - );
1053 - case 'booklet':
1054 - return $.wikiEditor.modules.toolbar.fn.buildBooklet(
1055 - context, id, section
1056 - );
1057 - default: return null;
1058 - }
1059 - },
1060 - buildToolbar: function( context, id, toolbar ) {
1061 - var $toolbar = $( '<div></div>' ).attr( {
1062 - 'class': 'toolbar section section-' + id,
1063 - 'rel': id
1064 - } );
1065 - if ( 'groups' in toolbar ) {
1066 - for ( group in toolbar.groups ) {
1067 - $toolbar.append(
1068 - $.wikiEditor.modules.toolbar.fn.buildGroup(
1069 - context, group, toolbar.groups[group]
1070 - )
1071 - );
1072 - }
1073 - }
1074 - return $toolbar;
1075 - },
10761182 buildGroup: function( context, id, group ) {
10771183 var $group = $( '<div></div>' ).attr( {
10781184 'class': 'group group-' + id,
@@ -1105,8 +1211,15 @@
11061212 var label = $.wikiEditor.modules.toolbar.fn.autoMsg( tool, 'label' );
11071213 switch ( tool.type ) {
11081214 case 'button':
 1215+ var src = tool.icon;
 1216+ if (
 1217+ src.indexOf( 'http://' ) !== 0 &&
 1218+ src.indexOf( 'https://' ) !== 0
 1219+ ) {
 1220+ src = $.wikiEditor.modules.toolbar.imgPath + src;
 1221+ }
11091222 $button = $( '<img />' ).attr( {
1110 - 'src': $.wikiEditor.modules.toolbar.imgPath + tool.icon,
 1223+ 'src': src,
11111224 'width': 22,
11121225 'height': 22,
11131226 'alt': label,
@@ -1166,42 +1279,6 @@
11671280 default: return null;
11681281 }
11691282 },
1170 - buildBooklet: function( context, id, booklet ) {
1171 - var selected = $.cookie(
1172 - 'wikiEditor-' + context.instance + '-booklet-' + id + '-page'
1173 - );
1174 - var $booklet = $( '<div></div>' ).attr( {
1175 - 'class': 'booklet section section-' + id,
1176 - 'rel': id
1177 - } );
1178 - var $pages = $( '<div></div>' ).attr( 'class', 'pages' );
1179 - var $index = $( '<div></div>' ).attr( 'class', 'index' );
1180 - if ( 'pages' in booklet ) {
1181 - if ( !( selected in booklet.pages ) ) {
1182 - selected = null;
1183 - }
1184 - for ( page in booklet.pages ) {
1185 - if ( selected === null ) {
1186 - selected = page;
1187 - }
1188 - var $page = $.wikiEditor.modules.toolbar.fn.buildPage(
1189 - context, page, booklet.pages[page]
1190 - );
1191 - var $bookmark = $.wikiEditor.modules.toolbar.fn.buildBookmark(
1192 - context, page, booklet.pages[page]
1193 - );
1194 - if ( selected == page ) {
1195 - $page.show();
1196 - $bookmark.addClass( 'current' );
1197 - } else {
1198 - $page.hide();
1199 - }
1200 - $pages.append( $page );
1201 - $index.append( $bookmark );
1202 - }
1203 - }
1204 - return $booklet.append( $index ).append( $pages );
1205 - },
12061283 buildBookmark: function( context, id, page ) {
12071284 var label = $.wikiEditor.modules.toolbar.fn.autoMsg( page, 'label' );
12081285 return $( '<div></div>' )
@@ -1245,36 +1322,19 @@
12461323 'class': 'table table-' + id
12471324 } );
12481325 if ( 'headings' in page ) {
1249 - var $headings = $( '<tr></tr>' );
1250 - for ( heading in page.headings ) {
1251 - var content =
1252 - $.wikiEditor.modules.toolbar.fn.autoMsg(
1253 - page.headings[heading], 'content'
1254 - );
1255 - $headings.append(
1256 - $( '<th></th>' ).text( content )
1257 - );
1258 - }
1259 - $table.append( $headings );
 1326+ $table.append(
 1327+ $.wikiEditor.modules.toolbar.fn.buildHeading(
 1328+ context, page.headings
 1329+ )
 1330+ );
12601331 }
12611332 if ( 'rows' in page ) {
12621333 for ( row in page.rows ) {
1263 - var $row = $( '<tr></tr>' );
1264 - for ( cell in page.rows[row] ) {
1265 - var $cell = $( '<td></td>' ).attr( {
1266 - 'class': 'cell cell-' + cell,
1267 - 'valign': 'top'
1268 - } );
1269 - var content =
1270 - $.wikiEditor.modules.toolbar.fn.autoMsg(
1271 - page.rows[row][cell], 'content'
1272 - );
1273 - $cell.append(
1274 - $( '<span></span>' ).html( content )
1275 - );
1276 - $row.append( $cell );
1277 - }
1278 - $table.append( $row );
 1334+ $table.append(
 1335+ $.wikiEditor.modules.toolbar.fn.buildRow(
 1336+ context, page.rows[row]
 1337+ )
 1338+ );
12791339 }
12801340 }
12811341 $page.append( $table );
@@ -1290,47 +1350,198 @@
12911351 }
12921352 if ( 'characters' in page ) {
12931353 for ( character in page.characters ) {
1294 - var tool = page.characters[character];
1295 - if ( typeof tool == 'string' ) {
1296 - tool = {
1297 - 'label': tool,
1298 - 'action': {
1299 - 'type': 'encapsulate',
1300 - 'options': { 'pre': tool }
1301 - }
1302 - };
1303 - } else if ( 0 in tool && 1 in tool ) {
1304 - tool = {
1305 - 'label': tool[0],
1306 - 'action': {
1307 - 'type': 'encapsulate',
1308 - 'options': { 'pre': tool[1] }
1309 - }
1310 - };
1311 - }
1312 - if ( 'action' in tool && 'label' in tool ) {
1313 - var $character = $( '<a></a>' )
1314 - .attr( 'rel', tool.label )
1315 - .attr( 'href', '#' )
1316 - .text( tool.label )
1317 - .data( 'context', context )
1318 - .data( 'action', tool.action )
1319 - .click( function() {
1320 - $.wikiEditor.modules.toolbar.fn.doAction(
1321 - $(this).data( 'context' ),
1322 - $(this).data( 'action' )
1323 - );
1324 - return false;
1325 - } );
1326 - $characters.append( $character );
1327 - }
 1354+ $characters.append(
 1355+ $.wikiEditor.modules.toolbar.fn.buildCharacter(
 1356+ context, page.characters[character]
 1357+ )
 1358+ );
13281359 }
1329 - $page.append( $characters );
13301360 }
 1361+ $page.append( $characters );
13311362 break;
13321363 }
13331364 return $page;
13341365 },
 1366+ buildHeading: function( context, headings ) {
 1367+ var $headings = $( '<tr></tr>' );
 1368+ for ( heading in headings ) {
 1369+ $headings.append(
 1370+ $( '<th></th>' ).text(
 1371+ $.wikiEditor.modules.toolbar.fn.autoMsg(
 1372+ headings[heading], 'content'
 1373+ )
 1374+ )
 1375+ );
 1376+ }
 1377+ return $headings;
 1378+ },
 1379+ buildRow: function( context, row ) {
 1380+ var $row = $( '<tr></tr>' );
 1381+ for ( cell in row ) {
 1382+ $row.append(
 1383+ $( '<td></td>' )
 1384+ .attr( {
 1385+ 'class': 'cell cell-' + cell,
 1386+ 'valign': 'top'
 1387+ } )
 1388+ .append(
 1389+ $( '<span></span>' ).html(
 1390+ $.wikiEditor.modules.toolbar.fn.autoMsg(
 1391+ row[cell], 'content'
 1392+ )
 1393+ )
 1394+ )
 1395+ );
 1396+ }
 1397+ return $row;
 1398+ },
 1399+ buildCharacter: function( context, character ) {
 1400+ if ( typeof character == 'string' ) {
 1401+ character = {
 1402+ 'label': character,
 1403+ 'action': {
 1404+ 'type': 'encapsulate',
 1405+ 'options': { 'pre': character }
 1406+ }
 1407+ };
 1408+ } else if ( 0 in character && 1 in character ) {
 1409+ character = {
 1410+ 'label': character[0],
 1411+ 'action': {
 1412+ 'type': 'encapsulate',
 1413+ 'options': { 'pre': character[1] }
 1414+ }
 1415+ };
 1416+ }
 1417+ if ( 'action' in character && 'label' in character ) {
 1418+ return $( '<a></a>' )
 1419+ .attr( 'rel', character.label )
 1420+ .attr( 'href', '#' )
 1421+ .text( character.label )
 1422+ .data( 'context', context )
 1423+ .data( 'action', character.action )
 1424+ .click( function() {
 1425+ $.wikiEditor.modules.toolbar.fn.doAction(
 1426+ $(this).data( 'context' ),
 1427+ $(this).data( 'action' )
 1428+ );
 1429+ return false;
 1430+ } );
 1431+ }
 1432+ },
 1433+ buildTab: function( context, id, section ) {
 1434+ var selected = $.cookie(
 1435+ 'wikiEditor-' + context.instance + '-toolbar-section'
 1436+ );
 1437+ return $( '<span></span>' )
 1438+ .attr( {
 1439+ 'class': 'tab tab-' + id,
 1440+ 'rel': id
 1441+ } )
 1442+ .append(
 1443+ $( '<a></a>' )
 1444+ .addClass( selected == id ? 'current' : null )
 1445+ .attr( 'href', '#' )
 1446+ .text(
 1447+ $.wikiEditor.modules.toolbar.fn.autoMsg( section, 'label' )
 1448+ )
 1449+ .data( 'context', context )
 1450+ .click( function() {
 1451+ var $section =
 1452+ $(this).data( 'context' ).$ui.find(
 1453+ '.section-' + $(this).parent().attr( 'rel' )
 1454+ );
 1455+ $(this).blur();
 1456+ var show = $section.css( 'display' ) == 'none';
 1457+ $section.parent().children().hide();
 1458+ $(this)
 1459+ .parent()
 1460+ .parent()
 1461+ .find( 'a' )
 1462+ .removeClass( 'current' );
 1463+ if ( show ) {
 1464+ $section.show();
 1465+ $(this).addClass( 'current' );
 1466+ }
 1467+ $.cookie(
 1468+ 'wikiEditor-' +
 1469+ $(this).data( 'context' ).instance +
 1470+ '-toolbar-section',
 1471+ show ? $section.attr( 'rel' ) : null
 1472+ );
 1473+ return false;
 1474+ } )
 1475+ );
 1476+ },
 1477+ buildSection: function( context, id, section ) {
 1478+ var selected = $.cookie(
 1479+ 'wikiEditor-' + context.instance + '-toolbar-section'
 1480+ );
 1481+ var $section;
 1482+ switch ( section.type ) {
 1483+ case 'toolbar':
 1484+ var $section = $( '<div></div>' ).attr( {
 1485+ 'class': 'toolbar section section-' + id,
 1486+ 'rel': id
 1487+ } );
 1488+ if ( 'groups' in section ) {
 1489+ for ( group in section.groups ) {
 1490+ $section.append(
 1491+ $.wikiEditor.modules.toolbar.fn.buildGroup(
 1492+ context, group, section.groups[group]
 1493+ )
 1494+ );
 1495+ }
 1496+ }
 1497+ break;
 1498+ case 'booklet':
 1499+ var $pages = $( '<div></div>' ).attr( 'class', 'pages' );
 1500+ var $index = $( '<div></div>' ).attr( 'class', 'index' );
 1501+ if ( 'pages' in section ) {
 1502+
 1503+ for ( page in section.pages ) {
 1504+ $pages.append(
 1505+ $.wikiEditor.modules.toolbar.fn.buildPage(
 1506+ context, page, section.pages[page]
 1507+ )
 1508+ );
 1509+ $index.append(
 1510+ $.wikiEditor.modules.toolbar.fn.buildBookmark(
 1511+ context, page, section.pages[page]
 1512+ )
 1513+ );
 1514+ }
 1515+ }
 1516+ $section = $( '<div></div>' )
 1517+ .attr( {
 1518+ 'class': 'booklet section section-' + id,
 1519+ 'rel': id
 1520+ } )
 1521+ .append( $index )
 1522+ .append( $pages );
 1523+ $.wikiEditor.modules.toolbar.fn.updateBookletSelection(
 1524+ context, page, $pages, $index
 1525+ );
 1526+ break;
 1527+ }
 1528+ if ( $section !== null && id !== 'main' ) {
 1529+ $section.css( 'display', selected == id ? 'block' : 'none' );
 1530+ }
 1531+ return $section;
 1532+ },
 1533+ updateBookletSelection: function( context, id, $pages, $index ) {
 1534+ var cookie =
 1535+ 'wikiEditor-' + context.instance + '-booklet-' + id + '-page';
 1536+ var selected = $.cookie( cookie );
 1537+ if ( $index.find( '*[rel=' + selected + ']' ).size() == 0 ) {
 1538+ selected = $index.find( ':first' ).attr( 'rel' );
 1539+ $.cookie( cookie, selected );
 1540+ }
 1541+ $pages.children().hide();
 1542+ $pages.find( '*[rel=' + selected + ']' ).show();
 1543+ $index.children().removeClass( 'current' );
 1544+ $index.find( '*[rel=' + selected + ']' ).addClass( 'current' );
 1545+ },
13351546 build: function( context, config ) {
13361547 var $tabs = $( '<div></div>' )
13371548 .addClass( 'tabs' )
@@ -1341,9 +1552,6 @@
13421553 context.modules.$toolbar.append(
13431554 $( '<div></div>' ).css( 'clear', 'both' )
13441555 );
1345 - var selected = $.cookie(
1346 - 'wikiEditor-' + context.instance + '-toolbar-section'
1347 - );
13481556 var sectionQueue = [];
13491557 for ( section in config ) {
13501558 if ( section == 'main' ) {
@@ -1353,58 +1561,16 @@
13541562 )
13551563 );
13561564 } else {
1357 - s = {
 1565+ sectionQueue.push( {
 1566+ '$sections': $sections,
13581567 'context': context,
1359 - '$sections': $sections,
1360 - '$tabs': $tabs,
1361 - 'section': section,
1362 - 'config': config[section],
1363 - 'selected': ( selected == section )
1364 - };
1365 - sectionQueue[sectionQueue.length] = s;
1366 - s.$tabs.append(
1367 - $( '<span></span>' )
1368 - .attr( {
1369 - 'class': 'tab tab-' + s.section,
1370 - 'rel': s.section
1371 - } )
1372 - .append(
1373 - $( '<a></a>' )
1374 - .addClass( s.selected ? 'current' : null )
1375 - .attr( 'href', '#' )
1376 - .text(
1377 - $.wikiEditor.modules.toolbar.fn.autoMsg(
1378 - s.config, 'label'
1379 - )
1380 - )
1381 - .data( 'context', s.context )
1382 - .click( function() {
1383 - var $section =
1384 - $(this).data( 'context' ).$ui.find(
1385 - '.section-' +
1386 - $(this).parent().attr( 'rel' )
1387 - );
1388 - $(this).blur();
1389 - var show = $section.css( 'display' ) == 'none';
1390 - $section.parent().children().hide();
1391 - $(this)
1392 - .parent()
1393 - .parent()
1394 - .find( 'a' )
1395 - .removeClass( 'current' );
1396 - if ( show ) {
1397 - $section.show();
1398 - $(this).addClass( 'current' );
1399 - }
1400 - $.cookie(
1401 - 'wikiEditor-' +
1402 - $(this).data( 'context' ).instance +
1403 - '-toolbar-section',
1404 - show ? $section.attr( 'rel' ) : null
1405 - );
1406 - return false;
1407 - } )
1408 - )
 1568+ 'id': section,
 1569+ 'config': config[section]
 1570+ } );
 1571+ $tabs.append(
 1572+ $.wikiEditor.modules.toolbar.fn.buildTab(
 1573+ context, section, config[section]
 1574+ )
14091575 );
14101576 }
14111577 }
@@ -1419,11 +1585,9 @@
14201586 'loop': function( i, s ) {
14211587 s.$sections.append(
14221588 $.wikiEditor.modules.toolbar.fn.buildSection(
1423 - s.context, s.section, s.config
 1589+ s.context, s.id, s.config
14241590 )
1425 - .css( 'display', s.selected ? 'block' : 'none' )
14261591 );
1427 -
14281592 }
14291593 } );
14301594 }
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js
@@ -19,7 +19,7 @@
2020 expires='; expires='+date.toUTCString();}
2121 var path=options.path?'; path='+(options.path):'';var domain=options.domain?'; domain='+(options.domain):'';var secure=options.secure?'; secure':'';document.cookie=[name,'=',encodeURIComponent(value),expires,path,domain,secure].join('');}else{var cookieValue=null;if(document.cookie&&document.cookie!=''){var cookies=document.cookie.split(';');for(var i=0;i<cookies.length;i++){var cookie=jQuery.trim(cookies[i]);if(cookie.substring(0,name.length+1)==(name+'=')){cookieValue=decodeURIComponent(cookie.substring(name.length+1));break;}}}
2222 return cookieValue;}};(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);}
23 -return retval;},encapsulateSelection:function(pre,peri,post,ownline){function checkSelectedText(){if(!selText){selText=peri;isSample=true;}else if(selText.charAt(selText.length-1)==' '){selText=selText.substring(0,selText.length-1);post+=' '}}
 23+return retval;},encapsulateSelection:function(pre,peri,post,ownline,replace){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+=' '}}
2424 var e=this.jquery?this[0]:this;var selText=$(this).getSelection();var isSample=false;if(e.style.display=='none'){}else if(document.selection&&document.selection.createRange){if(document.documentElement&&document.documentElement.scrollTop){var winScroll=document.documentElement.scrollTop;}else if(document.body){var winScroll=document.body.scrollTop;}
2525 $(this).focus();var range=document.selection.createRange();if(ownline&&range.moveStart){var range2=document.selection.createRange();range2.collapse();range2.moveStart('character',-1);if(range2.text!="\r"&&range2.text!="\n"&&range3.text!="")
2626 pre="\n"+pre;var range3=document.selection.createRange();range3.collapse(false);range3.moveEnd('character',1);if(range3.text!="\r"&&range3.text!="\n"&&range3.text!="")
@@ -32,7 +32,7 @@
3333 e.value=e.value.substring(0,startPos)+pre+selText+post+
3434 e.value.substring(endPos,e.value.length);if(isSample){e.selectionStart=startPos+pre.length;e.selectionEnd=startPos+pre.length+selText.length;}else{e.selectionStart=startPos+pre.length+selText.length+post.length;e.selectionEnd=e.selectionStart;}
3535 e.scrollTop=textScroll;}
36 -$(this).trigger('encapsulateSelection',[pre,peri,post,ownline]);},getCaretPosition:function(){function getCaret(e){var caretPos=0;if($.browser.msie){var postFinished=false;var periFinished=false;var postFinished=false;var preText,rawPreText,periText;var rawPeriText,postText,rawPostText;var periRange=document.selection.createRange().duplicate();var preRange=document.body.createTextRange();preRange.moveToElementText(e);preRange.setEndPoint("EndToStart",periRange);var postRange=document.body.createTextRange();postRange.moveToElementText(e);postRange.setEndPoint("StartToEnd",periRange);preText=rawPreText=preRange.text;periText=rawPeriText=periRange.text;postText=rawPostText=postRange.text;do{if(!postFinished){if(preRange.compareEndPoints("StartToEnd",preRange)==0){postFinished=true;}else{preRange.moveEnd("character",-1)
 36+$(this).trigger('encapsulateSelection',[pre,peri,post,ownline,replace]);},getCaretPosition:function(){function getCaret(e){var caretPos=0;if($.browser.msie){var postFinished=false;var periFinished=false;var postFinished=false;var preText,rawPreText,periText;var rawPeriText,postText,rawPostText;var periRange=document.selection.createRange().duplicate();var preRange=document.body.createTextRange();preRange.moveToElementText(e);preRange.setEndPoint("EndToStart",periRange);var postRange=document.body.createTextRange();postRange.moveToElementText(e);postRange.setEndPoint("StartToEnd",periRange);preText=rawPreText=preRange.text;periText=rawPeriText=periRange.text;postText=rawPostText=postRange.text;do{if(!postFinished){if(preRange.compareEndPoints("StartToEnd",preRange)==0){postFinished=true;}else{preRange.moveEnd("character",-1)
3737 if(preRange.text==preText){rawPreText+="\r\n";}else{postFinished=true;}}}
3838 if(!periFinished){if(periRange.compareEndPoints("StartToEnd",periRange)==0){periFinished=true;}else{periRange.moveEnd("character",-1)
3939 if(periRange.text==periText){rawPeriText+="\r\n";}else{periFinished=true;}}}
@@ -52,8 +52,8 @@
5353 return $(this);}
5454 var instance=$.wikiEditor.instances.length;context={'$textarea':$(this),'modules':{},'data':{},'instance':instance};$.wikiEditor.instances[instance]=$(this);$(this).wrap($('<div></div>').addClass('wikiEditor-ui').attr('id','wikiEditor-ui')).wrap($('<div></div>').addClass('wikiEditor-ui-bottom').attr('id','wikiEditor-ui-bottom')).wrap($('<div></div>').addClass('wikiEditor-ui-text').attr('id','wikiEditor-ui-text'));context.$ui=$(this).parent().parent().parent();context.$ui.after($('<div style="clear:both;"></div>'));context.$ui.prepend($('<div></div>').addClass('wikiEditor-ui-top').attr('id','wikiEditor-ui-top'));context.api={addModule:function(context,data){function callModuleApi(module,call,data){if(module in $.wikiEditor.modules&&'fn'in $.wikiEditor.modules[module]&&call in $.wikiEditor.modules[module].fn){$.wikiEditor.modules[module].fn[call](context,data);}}
5555 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];}}}}
56 -context.$textarea.scrollToCaretPosition(0);if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);}
57 -return $(this).data('context',context);;};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;}
 56+if(arguments.length>0&&typeof arguments[0]=='object'){context.api.addModule(context,arguments[0]);}
 57+context.$textarea.scrollToCaretPosition(0);return $(this).data('context',context);};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},fn:{create:function(context,config){if('$toc'in context.modules){return;}
5858 context.modules.$toc=$('<div></div>').addClass('wikiEditor-ui-toc').attr('id','wikiEditor-ui-toc');$.wikiEditor.modules.toc.fn.build(context,config);context.$ui.find('.wikiEditor-ui-bottom').append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-bottom').height());context.modules.$toc.css('width','12em');context.$ui.find('.wikiEditor-ui-text').css(($('body.rtl').size()?'marginLeft':'marginRight'),'12em');$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);context.$textarea.bind('keyup encapsulateSelection',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).bind('mouseup scrollToPosition',function(event){var context=$(this).data('context');$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.update(context);}});});},update:function(context){context.modules.$toc.find('a').removeClass('currentSelection');var position=context.$textarea.getCaretPosition();var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;}
5959 section=Math.max(0,section);}
6060 context.modules.$toc.find('a.section-'+section).addClass('currentSelection');}},build:function(context){function buildStructure(outline,offset,level){if(offset==undefined)offset=0;if(level==undefined)level=1;var sections=[];for(var i=offset;i<outline.length;i++){if(outline[i].nLevel==level){var sub=buildStructure(outline,i+1,level+1);if(sub.length){outline[i].sections=sub;}
@@ -69,35 +69,47 @@
7070 var lastLevel=0;var nLevel=0;for(var i=0;i<outline.length;i++){if(outline[i].level>lastLevel){nLevel++;}
7171 else if(outline[i].level<lastLevel){nLevel-=Math.max(1,lastLevel-outline[i].level);}
7272 outline[i].nLevel=nLevel;lastLevel=nLevel;}
73 -var structure=buildStructure(outline);structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});context.modules.$toc.html(buildList(structure));context.data.outline=outline;}}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/toolbar/',api:{addToToolbar:function(context,data){},modifyToolbar:function(context,data){},removeFromToolbar:function(context,data){if(typeof data.section=='string'){var tab='div.tabs span[rel='+data.section+'].tab';var target='div[rel='+data.section+'].section';if(typeof data.group=='string'){target+=' div[rel='+data.group+'].group';if(typeof data.tool=='string'){target+=' div[rel='+data.tool+'].tool';}}else if(typeof data.page=='string'){var index=target+' div.index div[rel='+data.page+']';target+=' div.pages div[rel='+data.page+'].page';if(typeof data.character=='string'){target+=' a[rel='+data.character+']';}else if(typeof data.row=='number'){target+=' table tr:not(:has(th)):eq('+data.row+')';}else{context.modules.$toolbar.find(index).remove();}}else{context.modules.$toolbar.find(tab).remove();}
 73+var structure=buildStructure(outline);structure.unshift({'text':wgPageName.replace(/_/g,' '),'level':1,'index':0,'position':0});context.modules.$toc.html(buildList(structure));context.data.outline=outline;}}};})(jQuery);(function($){$.wikiEditor.modules.toolbar={imgPath:wgScriptPath+'/extensions/UsabilityInitiative/images/wikiEditor/toolbar/',api:{addToToolbar:function(context,data){for(type in data){switch(type){case'sections':var $sections=context.modules.$toolbar.find('div.sections');var $tabs=context.modules.$toolbar.find('div.tabs');for(section in data[type]){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));continue;}
 74+$sections.append($.wikiEditor.modules.toolbar.fn.buildSection(context,section,data[type][section]));$tabs.append($.wikiEditor.modules.toolbar.fn.buildTab(context,section,data[type][section]));}
 75+break;case'groups':if(!('section'in data)){continue;}
 76+var $section=context.modules.$toolbar.find('div[rel='+data.section+'].section');for(group in data[type]){$section.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,data[type][group]));}
 77+break;case'tools':if(!('section'in data&&'group'in data)){continue;}
 78+var $group=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.group+'].group');for(tool in data[type]){$group.append($.wikiEditor.modules.toolbar.fn.buildTool(context,tool,data[type][tool]));}
 79+break;case'pages':if(!('section'in data)){continue;}
 80+var $pages=context.modules.$toolbar.find('div[rel='+data.section+'].section .pages');var $index=context.modules.$toolbar.find('div[rel='+data.section+'].section .index');for(page in data[type]){$pages.append($.wikiEditor.modules.toolbar.fn.buildPage(context,page,data[type][page]));$index.append($.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,data[type][page]));}
 81+$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;case'rows':if(!('section'in data&&'page'in data)){continue;}
 82+var $table=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page table')
 83+for(row in data[type]){$table.append($.wikiEditor.modules.toolbar.fn.buildRow(context,data[type][row]));}
 84+break;case'characters':if(!('section'in data&&'page'in data)){continue;}
 85+$characters=context.modules.$toolbar.find('div[rel='+data.section+'].section '+'div[rel='+data.page+'].page div');for(character in data[type]){$characters.append($.wikiEditor.modules.toolbar.fn.buildCharacter(context,data[type][character]));}
 86+break;}}},removeFromToolbar:function(context,data){if(typeof data.section=='string'){var tab='div.tabs span[rel='+data.section+'].tab';var target='div[rel='+data.section+'].section';if(typeof data.group=='string'){target+=' div[rel='+data.group+'].group';if(typeof data.tool=='string'){target+=' div[rel='+data.tool+'].tool';}}else if(typeof data.page=='string'){var index=target+' div.index div[rel='+data.page+']';target+=' div.pages div[rel='+data.page+'].page';if(typeof data.character=='string'){target+=' a[rel='+data.character+']';}else if(typeof data.row=='number'){target+=' table tr:not(:has(th)):eq('+data.row+')';}else{context.modules.$toolbar.find(index).remove();$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,null,context.modules.$toolbar.find(target),context.modules.$toolbar.find(index));}}else{context.modules.$toolbar.find(tab).remove();}
7487 context.modules.$toolbar.find(target).remove();}}},fn:{autoMsg:function(object,property){if(property in object){return object[property];}else if(property+'Msg'in object){return gM(object[property+'Msg']);}else{return'';}},create:function(context,config){if('$toolbar'in context.modules){return;}
75 -context.modules.$toolbar=$('<div></div>').addClass('wikiEditor-ui-toolbar').attr('id','wikiEditor-ui-toolbar');$.wikiEditor.modules.toolbar.fn.build(context,config);context.$ui.find('.wikiEditor-ui-top').append(context.modules.$toolbar);},doAction:function(context,action){switch(action.type){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]||'')}}
76 -context.$textarea.encapsulateSelection(parts.pre,parts.peri,parts.post,action.options.ownline);break;case'dialog':if($j('#'+action.id).size()==0){var dialogConf=action.dialog;dialogConf.bgiframe=true;dialogConf.autoOpen=false;dialogConf.modal=true;dialogConf.title=gM(action.titleMsg);for(msg in dialogConf.buttons){dialogConf.buttons[gM(msg)]=dialogConf.buttons[msg];delete dialogConf.buttons[msg];}
 88+context.modules.$toolbar=$('<div></div>').addClass('wikiEditor-ui-toolbar').attr('id','wikiEditor-ui-toolbar');$.wikiEditor.modules.toolbar.fn.build(context,config);context.$ui.find('.wikiEditor-ui-top').append(context.modules.$toolbar);},doAction:function(context,action){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]||'')}}
 89+context.$textarea.encapsulateSelection(parts.pre,parts.peri,parts.post,action.options.ownline,action.type=='replace');break;case'dialog':if($j('#'+action.id).size()==0){var dialogConf=action.dialog;dialogConf.bgiframe=true;dialogConf.autoOpen=false;dialogConf.modal=true;dialogConf.title=gM(action.titleMsg);for(msg in dialogConf.buttons){dialogConf.buttons[gM(msg)]=dialogConf.buttons[msg];delete dialogConf.buttons[msg];}
7790 $j('<div></div> ').attr('id',action.id).html(action.html).data('context',context).appendTo($j('body')).each(action.init).dialog(dialogConf);}
78 -$j('#'+action.id).dialog('open');break;default:break;}},buildSection:function(context,id,section){switch(section.type){case'toolbar':return $.wikiEditor.modules.toolbar.fn.buildToolbar(context,id,section);case'booklet':return $.wikiEditor.modules.toolbar.fn.buildBooklet(context,id,section);default:return null;}},buildToolbar:function(context,id,toolbar){var $toolbar=$('<div></div>').attr({'class':'toolbar section section-'+id,'rel':id});if('groups'in toolbar){for(group in toolbar.groups){$toolbar.append($.wikiEditor.modules.toolbar.fn.buildGroup(context,group,toolbar.groups[group]));}}
79 -return $toolbar;},buildGroup:function(context,id,group){var $group=$('<div></div>').attr({'class':'group group-'+id,'rel':id});var label=$.wikiEditor.modules.toolbar.fn.autoMsg(group,'label');if(label){$group.append($('<div></div>').text(label).addClass('label'))}
 91+$j('#'+action.id).dialog('open');break;default:break;}},buildGroup:function(context,id,group){var $group=$('<div></div>').attr({'class':'group group-'+id,'rel':id});var label=$.wikiEditor.modules.toolbar.fn.autoMsg(group,'label');if(label){$group.append($('<div></div>').text(label).addClass('label'))}
8092 if('tools'in group){for(tool in group.tools){$group.append($.wikiEditor.modules.toolbar.fn.buildTool(context,tool,group.tools[tool]));}}
8193 return $group;},buildTool:function(context,id,tool){if('filters'in tool){for(filter in tool.filters){if($(tool.filters[filter]).size()==0){return null;}}}
82 -var label=$.wikiEditor.modules.toolbar.fn.autoMsg(tool,'label');switch(tool.type){case'button':$button=$('<img />').attr({'src':$.wikiEditor.modules.toolbar.imgPath+tool.icon,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-'+id});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'));return false;});}
 94+var label=$.wikiEditor.modules.toolbar.fn.autoMsg(tool,'label');switch(tool.type){case'button':var src=tool.icon;if(src.indexOf('http://')!==0&&src.indexOf('https://')!==0){src=$.wikiEditor.modules.toolbar.imgPath+src;}
 95+$button=$('<img />').attr({'src':src,'width':22,'height':22,'alt':label,'title':label,'rel':id,'class':'tool tool-'+id});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'));return false;});}
8396 return $button;case'select':var $select=$('<select></select>').attr({'rel':id,'class':'tool tool-'+id});$select.append($('<option></option>').text(label))
8497 if('list'in tool){$select.data('list',tool.list).data('context',context).click(function(){var list=$(this).data('list');var val=$(this).val();if(val in list&&'action'in list[val]){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),list[val].action);}
8598 $(this).find(":selected").attr('selected',false).find(":first").attr('selected',true);return false;});for(option in tool.list){var optionLabel=$.wikiEditor.modules.toolbar.fn.autoMsg(tool.list[option],'label');$select.append($('<option></option>').text(optionLabel).attr('value',option));}}
86 -return $select;default:return null;}},buildBooklet:function(context,id,booklet){var selected=$.cookie('wikiEditor-'+context.instance+'-booklet-'+id+'-page');var $booklet=$('<div></div>').attr({'class':'booklet section section-'+id,'rel':id});var $pages=$('<div></div>').attr('class','pages');var $index=$('<div></div>').attr('class','index');if('pages'in booklet){if(!(selected in booklet.pages)){selected=null;}
87 -for(page in booklet.pages){if(selected===null){selected=page;}
88 -var $page=$.wikiEditor.modules.toolbar.fn.buildPage(context,page,booklet.pages[page]);var $bookmark=$.wikiEditor.modules.toolbar.fn.buildBookmark(context,page,booklet.pages[page]);if(selected==page){$page.show();$bookmark.addClass('current');}else{$page.hide();}
89 -$pages.append($page);$index.append($bookmark);}}
90 -return $booklet.append($index).append($pages);},buildBookmark:function(context,id,page){var label=$.wikiEditor.modules.toolbar.fn.autoMsg(page,'label');return $('<div></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');$.cookie('wikiEditor-'+$(this).data('context').instance+'-booklet-'+section+'-page',$(this).attr('rel'));});},buildPage:function(context,id,page){var $page=$('<div></div>').attr({'class':'page page-'+id,'rel':id});switch(page.layout){case'table':$page.addClass('page-table');var $table=$('<table></table>').attr({'cellpadding':'0','cellspacing':'0','border':'0','width':'100%','class':'table table-'+id});if('headings'in page){var $headings=$('<tr></tr>');for(heading in page.headings){var content=$.wikiEditor.modules.toolbar.fn.autoMsg(page.headings[heading],'content');$headings.append($('<th></th>').text(content));}
91 -$table.append($headings);}
92 -if('rows'in page){for(row in page.rows){var $row=$('<tr></tr>');for(cell in page.rows[row]){var $cell=$('<td></td>').attr({'class':'cell cell-'+cell,'valign':'top'});var content=$.wikiEditor.modules.toolbar.fn.autoMsg(page.rows[row][cell],'content');$cell.append($('<span></span>').html(content));$row.append($cell);}
93 -$table.append($row);}}
 99+return $select;default:return null;}},buildBookmark:function(context,id,page){var label=$.wikiEditor.modules.toolbar.fn.autoMsg(page,'label');return $('<div></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');$.cookie('wikiEditor-'+$(this).data('context').instance+'-booklet-'+section+'-page',$(this).attr('rel'));});},buildPage:function(context,id,page){var $page=$('<div></div>').attr({'class':'page page-'+id,'rel':id});switch(page.layout){case'table':$page.addClass('page-table');var $table=$('<table></table>').attr({'cellpadding':'0','cellspacing':'0','border':'0','width':'100%','class':'table table-'+id});if('headings'in page){$table.append($.wikiEditor.modules.toolbar.fn.buildHeading(context,page.headings));}
 100+if('rows'in page){for(row in page.rows){$table.append($.wikiEditor.modules.toolbar.fn.buildRow(context,page.rows[row]));}}
94101 $page.append($table);break;case'characters':$page.addClass('page-characters');$characters=$('<div></div>');if('language'in page){$characters.attr('lang',page.language);}
95102 if('direction'in page){$characters.attr('dir',page.direction);}
96 -if('characters'in page){for(character in page.characters){var tool=page.characters[character];if(typeof tool=='string'){tool={'label':tool,'action':{'type':'encapsulate','options':{'pre':tool}}};}else if(0 in tool&&1 in tool){tool={'label':tool[0],'action':{'type':'encapsulate','options':{'pre':tool[1]}}};}
97 -if('action'in tool&&'label'in tool){var $character=$('<a></a>').attr('rel',tool.label).attr('href','#').text(tool.label).data('context',context).data('action',tool.action).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'));return false;});$characters.append($character);}}
98 -$page.append($characters);}
99 -break;}
100 -return $page;},build:function(context,config){var $tabs=$('<div></div>').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div></div>').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div></div>').css('clear','both'));var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var sectionQueue=[];for(section in config){if(section=='main'){context.modules.$toolbar.prepend($.wikiEditor.modules.toolbar.fn.buildSection(context,section,config[section]));}else{s={'context':context,'$sections':$sections,'$tabs':$tabs,'section':section,'config':config[section],'selected':(selected==section)};sectionQueue[sectionQueue.length]=s;s.$tabs.append($('<span></span>').attr({'class':'tab tab-'+s.section,'rel':s.section}).append($('<a></a>').addClass(s.selected?'current':null).attr('href','#').text($.wikiEditor.modules.toolbar.fn.autoMsg(s.config,'label')).data('context',s.context).click(function(){var $section=$(this).data('context').$ui.find('.section-'+
101 -$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$section.parent().children().hide();$(this).parent().parent().find('a').removeClass('current');if(show){$section.show();$(this).addClass('current');}
 103+if('characters'in page){for(character in page.characters){$characters.append($.wikiEditor.modules.toolbar.fn.buildCharacter(context,page.characters[character]));}}
 104+$page.append($characters);break;}
 105+return $page;},buildHeading:function(context,headings){var $headings=$('<tr></tr>');for(heading in headings){$headings.append($('<th></th>').text($.wikiEditor.modules.toolbar.fn.autoMsg(headings[heading],'content')));}
 106+return $headings;},buildRow:function(context,row){var $row=$('<tr></tr>');for(cell in row){$row.append($('<td></td>').attr({'class':'cell cell-'+cell,'valign':'top'}).append($('<span></span>').html($.wikiEditor.modules.toolbar.fn.autoMsg(row[cell],'content'))));}
 107+return $row;},buildCharacter:function(context,character){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]}}};}
 108+if('action'in character&&'label'in character){return $('<a></a>').attr('rel',character.label).attr('href','#').text(character.label).data('context',context).data('action',character.action).click(function(){$.wikiEditor.modules.toolbar.fn.doAction($(this).data('context'),$(this).data('action'));return false;});}},buildTab:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');return $('<span></span>').attr({'class':'tab tab-'+id,'rel':id}).append($('<a></a>').addClass(selected==id?'current':null).attr('href','#').text($.wikiEditor.modules.toolbar.fn.autoMsg(section,'label')).data('context',context).click(function(){var $section=$(this).data('context').$ui.find('.section-'+$(this).parent().attr('rel'));$(this).blur();var show=$section.css('display')=='none';$section.parent().children().hide();$(this).parent().parent().find('a').removeClass('current');if(show){$section.show();$(this).addClass('current');}
102109 $.cookie('wikiEditor-'+
103 -$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;})));}}
104 -$.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.section,s.config).css('display',s.selected?'block':'none'));}});}}};})(jQuery);
\ No newline at end of file
 110+$(this).data('context').instance+'-toolbar-section',show?$section.attr('rel'):null);return false;}));},buildSection:function(context,id,section){var selected=$.cookie('wikiEditor-'+context.instance+'-toolbar-section');var $section;switch(section.type){case'toolbar':var $section=$('<div></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]));}}
 111+break;case'booklet':var $pages=$('<div></div>').attr('class','pages');var $index=$('<div></div>').attr('class','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]));}}
 112+$section=$('<div></div>').attr({'class':'booklet section section-'+id,'rel':id}).append($index).append($pages);$.wikiEditor.modules.toolbar.fn.updateBookletSelection(context,page,$pages,$index);break;}
 113+if($section!==null&&id!=='main'){$section.css('display',selected==id?'block':'none');}
 114+return $section;},updateBookletSelection:function(context,id,$pages,$index){var cookie='wikiEditor-'+context.instance+'-booklet-'+id+'-page';var selected=$.cookie(cookie);if($index.find('*[rel='+selected+']').size()==0){selected=$index.find(':first').attr('rel');$.cookie(cookie,selected);}
 115+$pages.children().hide();$pages.find('*[rel='+selected+']').show();$index.children().removeClass('current');$index.find('*[rel='+selected+']').addClass('current');},build:function(context,config){var $tabs=$('<div></div>').addClass('tabs').appendTo(context.modules.$toolbar);var $sections=$('<div></div>').addClass('sections').appendTo(context.modules.$toolbar);context.modules.$toolbar.append($('<div></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]));}}
 116+$.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));}});}}};})(jQuery);
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r55532EditToolbar:...catrope17:55, 23 August 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r54967Finished the API for the toolbar module of wikiEditor. Now users can add and ...tparscal20:52, 13 August 2009

Status & tagging log